Skip to content

Commit

Permalink
Embed images into executable, and fix potential null dereference in d…
Browse files Browse the repository at this point in the history
…ungeon tracker.
  • Loading branch information
jpark37 committed Jun 16, 2018
1 parent 952100d commit ed23786
Show file tree
Hide file tree
Showing 42 changed files with 563 additions and 49 deletions.
78 changes: 39 additions & 39 deletions ZeldaRandomizerMap/ImageConstants.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System.Drawing;
using ZeldaRandomizerMap.Properties;

namespace ZeldaRandomizerMap
{
class ImageConstants
{
private static Bitmap MakeDecal(string fileName)
private static Bitmap MakeDecal(Bitmap original)
{
Bitmap original = new Bitmap(fileName);
Bitmap decal = new Bitmap(128, 128);
for (int y = 0; y < decal.Height; ++y)
{
Expand All @@ -33,43 +33,43 @@ private static Bitmap MakeSolidBitmap(Color color)
return bitmap;
}

public static readonly Bitmap BaseImage = new Bitmap(@"zelda\map_dark.png");
public static readonly Bitmap Level1Image = MakeDecal(@"zelda\level_1.png");
public static readonly Bitmap Level2Image = MakeDecal(@"zelda\level_2.png");
public static readonly Bitmap Level3Image = MakeDecal(@"zelda\level_3.png");
public static readonly Bitmap Level4Image = MakeDecal(@"zelda\level_4.png");
public static readonly Bitmap Level5Image = MakeDecal(@"zelda\level_5.png");
public static readonly Bitmap Level6Image = MakeDecal(@"zelda\level_6.png");
public static readonly Bitmap Level7Image = MakeDecal(@"zelda\level_7.png");
public static readonly Bitmap Level8Image = MakeDecal(@"zelda\level_8.png");
public static readonly Bitmap Level9Image = MakeDecal(@"zelda\level_9.png");
public static readonly Bitmap BibleImage = MakeDecal(@"zelda\bible.png");
public static readonly Bitmap CandleImage = MakeDecal(@"zelda\candle.png");
public static readonly Bitmap ArrowImage = MakeDecal(@"zelda\arrow.png");
public static readonly Bitmap FoodCheapImage = MakeDecal(@"zelda\food.png");
public static readonly Bitmap FoodExpensiveImage = MakeDecal(@"zelda\food_expensive.png");
public static readonly Bitmap BlueRingImage = MakeDecal(@"zelda\blue_ring.png");
public static readonly Bitmap KeyCheapImage = MakeDecal(@"zelda\key.png");
public static readonly Bitmap KeyExpensiveImage = MakeDecal(@"zelda\key_expensive.png");
public static readonly Bitmap BombImage = MakeDecal(@"zelda\bomb.png");
public static readonly Bitmap HintImage = MakeDecal(@"zelda\hint.png");
public static readonly Bitmap MagicalSwordImage = MakeDecal(@"zelda\magical_sword.png");
public static readonly Bitmap MoneyImage = MakeDecal(@"zelda\money.png");
public static readonly Bitmap HeartImage = MakeDecal(@"zelda\heart.png");
public static readonly Bitmap PotionImage = MakeDecal(@"zelda\potion.png");
public static readonly Bitmap SwordImage = MakeDecal(@"zelda\sword.png");
public static readonly Bitmap WarpZone1Image = MakeDecal(@"zelda\warp_zone_1.png");
public static readonly Bitmap WarpZone2Image = MakeDecal(@"zelda\warp_zone_2.png");
public static readonly Bitmap WarpZone3Image = MakeDecal(@"zelda\warp_zone_3.png");
public static readonly Bitmap WarpZone4Image = MakeDecal(@"zelda\warp_zone_4.png");
public static readonly Bitmap WhiteSwordImage = MakeDecal(@"zelda\white_sword.png");
public static readonly Bitmap StairsRoomBitmapA = new Bitmap(@"zelda\stairs_a.png");
public static readonly Bitmap StairsRoomBitmapB = new Bitmap(@"zelda\stairs_b.png");
public static readonly Bitmap StairsRoomBitmapC = new Bitmap(@"zelda\stairs_c.png");
public static readonly Bitmap StairsRoomBitmapD = new Bitmap(@"zelda\stairs_d.png");
public static readonly Bitmap StairsRoomBitmapE = new Bitmap(@"zelda\stairs_e.png");
public static readonly Bitmap StairsRoomBitmapF = new Bitmap(@"zelda\stairs_f.png");
public static readonly Bitmap StairsRoomBitmapX = new Bitmap(@"zelda\stairs_x.png");
public static readonly Bitmap BaseImage = Resources.MapDark;
public static readonly Bitmap Level1Image = MakeDecal(Resources.Level1);
public static readonly Bitmap Level2Image = MakeDecal(Resources.Level2);
public static readonly Bitmap Level3Image = MakeDecal(Resources.Level3);
public static readonly Bitmap Level4Image = MakeDecal(Resources.Level4);
public static readonly Bitmap Level5Image = MakeDecal(Resources.Level5);
public static readonly Bitmap Level6Image = MakeDecal(Resources.Level6);
public static readonly Bitmap Level7Image = MakeDecal(Resources.Level7);
public static readonly Bitmap Level8Image = MakeDecal(Resources.Level8);
public static readonly Bitmap Level9Image = MakeDecal(Resources.Level9);
public static readonly Bitmap BibleImage = MakeDecal(Resources.Bible);
public static readonly Bitmap CandleImage = MakeDecal(Resources.Candle);
public static readonly Bitmap ArrowImage = MakeDecal(Resources.Arrow);
public static readonly Bitmap FoodCheapImage = MakeDecal(Resources.Food);
public static readonly Bitmap FoodExpensiveImage = MakeDecal(Resources.FoodExpensive);
public static readonly Bitmap BlueRingImage = MakeDecal(Resources.BlueRing);
public static readonly Bitmap KeyCheapImage = MakeDecal(Resources.Key);
public static readonly Bitmap KeyExpensiveImage = MakeDecal(Resources.KeyExpensive);
public static readonly Bitmap BombImage = MakeDecal(Resources.Bomb);
public static readonly Bitmap HintImage = MakeDecal(Resources.Hint);
public static readonly Bitmap MagicalSwordImage = MakeDecal(Resources.MagicalSword);
public static readonly Bitmap MoneyImage = MakeDecal(Resources.Money);
public static readonly Bitmap HeartImage = MakeDecal(Resources.Heart);
public static readonly Bitmap PotionImage = MakeDecal(Resources.Potion);
public static readonly Bitmap SwordImage = MakeDecal(Resources.Sword);
public static readonly Bitmap WarpZone1Image = MakeDecal(Resources.WarpZone1);
public static readonly Bitmap WarpZone2Image = MakeDecal(Resources.WarpZone2);
public static readonly Bitmap WarpZone3Image = MakeDecal(Resources.WarpZone3);
public static readonly Bitmap WarpZone4Image = MakeDecal(Resources.WarpZone4);
public static readonly Bitmap WhiteSwordImage = MakeDecal(Resources.WhiteSword);
public static readonly Bitmap StairsRoomBitmapA = Resources.StairsA;
public static readonly Bitmap StairsRoomBitmapB = Resources.StairsB;
public static readonly Bitmap StairsRoomBitmapC = Resources.StairsC;
public static readonly Bitmap StairsRoomBitmapD = Resources.StairsD;
public static readonly Bitmap StairsRoomBitmapE = Resources.StairsE;
public static readonly Bitmap StairsRoomBitmapF = Resources.StairsF;
public static readonly Bitmap StairsRoomBitmapX = Resources.StairsX;
public static readonly Bitmap PendingRoomBitmap = MakeSolidBitmap(Color.Black);
public static readonly Bitmap ClearRoomBitmap = MakeSolidBitmap(Color.White);
public static readonly Bitmap SolidRoomBitmap = MakeSolidBitmap(Color.Red);
Expand Down
Binary file added ZeldaRandomizerMap/Images/arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/bible.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/blue_ring.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/bomb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/candle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/food.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/food_expensive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/heart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/hint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/key_expensive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/level_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/level_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/level_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/level_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/level_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/level_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/level_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/level_8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/level_9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/magical_sword.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/map_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/money.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/potion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ZeldaRandomizerMap/Images/stairs_a.png
Binary file added ZeldaRandomizerMap/Images/stairs_b.png
Binary file added ZeldaRandomizerMap/Images/stairs_c.png
Binary file added ZeldaRandomizerMap/Images/stairs_d.png
Binary file added ZeldaRandomizerMap/Images/stairs_e.png
Binary file added ZeldaRandomizerMap/Images/stairs_f.png
Binary file added ZeldaRandomizerMap/Images/stairs_x.png
Binary file added ZeldaRandomizerMap/Images/sword.png
Binary file added ZeldaRandomizerMap/Images/warp_zone_1.png
Binary file added ZeldaRandomizerMap/Images/warp_zone_2.png
Binary file added ZeldaRandomizerMap/Images/warp_zone_3.png
Binary file added ZeldaRandomizerMap/Images/warp_zone_4.png
Binary file added ZeldaRandomizerMap/Images/white_sword.png
24 changes: 20 additions & 4 deletions ZeldaRandomizerMap/LevelTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,22 +220,38 @@ public void SetRoomSolid()
{
if (m_levelColumn > 0)
{
m_horizontalPictureBoxes[m_levelRow, m_levelColumn - 1].Image = ImageConstants.SolidWallBitmap;
PictureBox box = m_horizontalPictureBoxes[m_levelRow, m_levelColumn - 1];
if (box != null)
{
box.Image = ImageConstants.SolidWallBitmap;
}
}
if (m_levelColumn < 7)
{
m_horizontalPictureBoxes[m_levelRow, m_levelColumn].Image = ImageConstants.SolidWallBitmap;
PictureBox box = m_horizontalPictureBoxes[m_levelRow, m_levelColumn];
if (box != null)
{
box.Image = ImageConstants.SolidWallBitmap;
}
}
}
if (m_levelColumn < 8)
{
if (m_levelRow > 0)
{
m_verticalPictureBoxes[m_levelRow - 1, m_levelColumn].Image = ImageConstants.SolidWallBitmap;
PictureBox box = m_verticalPictureBoxes[m_levelRow - 1, m_levelColumn];
if (box != null)
{
box.Image = ImageConstants.SolidWallBitmap;
}
}
if (m_levelRow < 7)
{
m_verticalPictureBoxes[m_levelRow, m_levelColumn].Image = ImageConstants.SolidWallBitmap;
PictureBox box = m_verticalPictureBoxes[m_levelRow, m_levelColumn];
if (box != null)
{
box.Image = ImageConstants.SolidWallBitmap;
}
}
}
}
Expand Down
Loading

0 comments on commit ed23786

Please sign in to comment.