/*
         * Caves:
         * Number| Tile
         * ------+-------------------
         * 0 | Cracked Stone Wall
         * 1 | Stairs Up
         * 2 | Red Brick Floor
         * 3 | Stairs Down
         * 4 | Treasure Chest
         * 5 | Locked Door
         * 6 | Princess Gwaelin
         * 7 | Black wall ??????
         * 8 | Cracked Stone Wall - Special
         * 9 | Stairs Up - Special
         * A | Red Brick Floor - Special
         * B | Stairs Down - Special
         * C | Treasure Chest - Special
         * D | Locked Door - Special
         * E | Princess Gwaelin - Special
         * F | Black wall ?????? - Special
         */
        private void loadMap()
        {
            ClassDWBackend classDWBackend = new ClassDWBackend(path);

            string garinhamsGraveB3HexData = classDWBackend.getGarinhamsGraveB3Data();
            int    x        = 1;
            bool   hasError = false;

            foreach (char ch in garinhamsGraveB3HexData)
            {
                try
                {
                    PictureBox currentPictureBox = (PictureBox)FormGarinhamsGraveB3.ActiveForm.Controls.Find("pictureBox" + x, true)[0];

                    switch (ch)
                    {
                    case '0':
                        currentPictureBox.Image     = Properties.Resources._0_crackedstonewall;
                        currentPictureBox.Image.Tag = "0-CrackedStoneWall";
                        break;

                    case '1':
                        currentPictureBox.Image     = Properties.Resources._1_stairsup;
                        currentPictureBox.Image.Tag = "1-StairsUp";
                        break;

                    case '2':
                        currentPictureBox.Image     = Properties.Resources._2_redbrickfloor;
                        currentPictureBox.Image.Tag = "2-RedBrickFloor";
                        break;

                    case '3':
                        currentPictureBox.Image     = Properties.Resources._3_stairsdown;
                        currentPictureBox.Image.Tag = "3-StairsDown";
                        break;

                    case '4':
                        currentPictureBox.Image     = Properties.Resources._4_treasurechest;
                        currentPictureBox.Image.Tag = "4-TreasureChest";
                        break;

                    case '5':
                        currentPictureBox.Image     = Properties.Resources._5_lockeddoor;
                        currentPictureBox.Image.Tag = "5-LockedDoor";
                        break;

                    case '6':
                        currentPictureBox.Image     = Properties.Resources._6_princessgwaelin;
                        currentPictureBox.Image.Tag = "6-PrincessGwaelin";
                        break;

                    case '7':
                        currentPictureBox.Image     = Properties.Resources._7_blackwall;
                        currentPictureBox.Image.Tag = "7-BlackWall";
                        break;

                    // So this occurs because it is "roof" tiles for another map, so 8 would be 1000, we ignore the upper bit of the nibble, so treat as 0
                    case '8':
                        currentPictureBox.Image     = Properties.Resources._0_crackedstonewall_special;
                        currentPictureBox.Image.Tag = "8-CrackedStoneWall-Special";
                        break;

                    // So this occurs because it is "roof" tiles for another map, so 9 would be 1001, we ignore the upper bit, so treat as 1
                    case '9':
                        currentPictureBox.Image     = Properties.Resources._1_stairsup_special;
                        currentPictureBox.Image.Tag = "9-StairsUp-Special";
                        break;

                    // Same as above for the remaining
                    case 'A':
                        currentPictureBox.Image     = Properties.Resources._2_redbrickfloor_special;
                        currentPictureBox.Image.Tag = "A-RedBrickFloor-Special";
                        break;

                    case 'B':
                        currentPictureBox.Image     = Properties.Resources._3_stairsdown_special;
                        currentPictureBox.Image.Tag = "B-StairsDown-Special";
                        break;

                    case 'C':
                        currentPictureBox.Image     = Properties.Resources._4_treasurechest_special;
                        currentPictureBox.Image.Tag = "C-TreasureChest-Special";
                        break;

                    case 'D':
                        currentPictureBox.Image     = Properties.Resources._5_lockeddoor_special;
                        currentPictureBox.Image.Tag = "D-LockedDoor-Special";
                        break;

                    case 'E':
                        currentPictureBox.Image     = Properties.Resources._6_princessgwaelin_special;
                        currentPictureBox.Image.Tag = "E-PrincessGwaelin-Special";
                        break;

                    case 'F':
                        currentPictureBox.Image     = Properties.Resources._7_blackwall_special;
                        currentPictureBox.Image.Tag = "F-BlackWall-Special";
                        break;

                    default:
                        break;
                    }

                    currentPictureBox.Refresh();
                    currentPictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
                    currentPictureBox.Visible  = true;

                    x++;
                }
                catch (Exception ex)
                {
                    hasError = true;
                    break;
                }
            }

            if (hasError)
            {
                MessageBox.Show("Failed to populate map tiles. Try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
        }
        private void saveMap()
        {
            ClassDWBackend classDWBackend             = new ClassDWBackend(path);
            string         newGarinhamsGraveB3HexData = "";

            for (int x = 1; x <= 400; x++)
            {
                try
                {
                    PictureBox currentPictureBox = (PictureBox)FormGarinhamsGraveB3.ActiveForm.Controls.Find("pictureBox" + x, true)[0];
                    String     currentImageTag   = currentPictureBox.Image.Tag.ToString();

                    if (currentImageTag == "0-CrackedStoneWall")
                    {
                        newGarinhamsGraveB3HexData += "0";
                    }
                    else if (currentImageTag == "1-StairsUp")
                    {
                        newGarinhamsGraveB3HexData += "1";
                    }
                    else if (currentImageTag == "2-RedBrickFloor")
                    {
                        newGarinhamsGraveB3HexData += "2";
                    }
                    else if (currentImageTag == "3-StairsDown")
                    {
                        newGarinhamsGraveB3HexData += "3";
                    }
                    else if (currentImageTag == "4-TreasureChest")
                    {
                        newGarinhamsGraveB3HexData += "4";
                    }
                    else if (currentImageTag == "5-LockedDoor")
                    {
                        newGarinhamsGraveB3HexData += "5";
                    }
                    else if (currentImageTag == "6-PrincessGwaelin")
                    {
                        newGarinhamsGraveB3HexData += "6";
                    }
                    else if (currentImageTag == "7-BlackWall")
                    {
                        newGarinhamsGraveB3HexData += "7";
                    }
                    else if (currentImageTag == "8-CrackedStoneWall-Special")
                    {
                        newGarinhamsGraveB3HexData += "8";
                    }
                    else if (currentImageTag == "9-StairsUp-Special")
                    {
                        newGarinhamsGraveB3HexData += "9";
                    }
                    else if (currentImageTag == "A-RedBrickFloor-Special")
                    {
                        newGarinhamsGraveB3HexData += "A";
                    }
                    else if (currentImageTag == "B-StairsDown-Special")
                    {
                        newGarinhamsGraveB3HexData += "B";
                    }
                    else if (currentImageTag == "C-TreasureChest-Special")
                    {
                        newGarinhamsGraveB3HexData += "C";
                    }
                    else if (currentImageTag == "D-LockedDoor-Special")
                    {
                        newGarinhamsGraveB3HexData += "D";
                    }
                    else if (currentImageTag == "E-PrincessGwaelin-Special")
                    {
                        newGarinhamsGraveB3HexData += "E";
                    }
                    else if (currentImageTag == "F-BlackWall-Special")
                    {
                        newGarinhamsGraveB3HexData += "F";
                    }
                }
                catch (Exception ex)
                {
                    //MessageBox.Show("Failed to write ROM: " + ex, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            bool result = classDWBackend.setGarinhamsGraveB3Data(newGarinhamsGraveB3HexData);

            if (result)
            {
                MessageBox.Show("Successfully wrote ROM.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Failed to write ROM.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
        /*
         * Towns:
         * Number| Tile
         * ------+-------------------
         * 0 | Grass
         * 1 | Desert
         * 2 | Water
         * 3 | Treasure Chest
         * 4 | Solid Stone Wall
         * 5 | Stairs Up
         * 6 | Red Brick Floor
         * 7 | Stairs Down
         * 8 | Forest
         * 9 | Poisonous Swamp
         * A | Barrier
         * B | Locked Door
         * C | Weapon Shop Sign
         * D | Inn Sign
         * E | Bridge
         * F | Desk
         */
        private void loadMap()
        {
            ClassDWBackend classDWBackend = new ClassDWBackend(path);

            string kolHexData = classDWBackend.getKolData();

            int  x        = 1;
            bool hasError = false;

            foreach (char ch in kolHexData)
            {
                try
                {
                    PictureBox currentPictureBox = (PictureBox)FormKol.ActiveForm.Controls.Find("pictureBox" + x, true)[0];

                    switch (ch)
                    {
                    case '0':
                        currentPictureBox.Image     = Properties.Resources._0_grass;
                        currentPictureBox.Image.Tag = "0-Grass";
                        break;

                    case '1':
                        currentPictureBox.Image     = Properties.Resources._1_desert;
                        currentPictureBox.Image.Tag = "1-Desert";
                        break;

                    case '2':
                        currentPictureBox.Image     = Properties.Resources._2_water;
                        currentPictureBox.Image.Tag = "2-Water";
                        break;

                    case '3':
                        currentPictureBox.Image     = Properties.Resources._3_treasurechest;
                        currentPictureBox.Image.Tag = "3-TreasureChest";
                        break;

                    case '4':
                        currentPictureBox.Image     = Properties.Resources._4_solidstonewall2;
                        currentPictureBox.Image.Tag = "4-SolidStoneWall2";
                        break;

                    case '5':
                        currentPictureBox.Image     = Properties.Resources._5_stairsup;
                        currentPictureBox.Image.Tag = "5-StairsUp";
                        break;

                    case '6':
                        currentPictureBox.Image     = Properties.Resources._6_redbrickfloor;
                        currentPictureBox.Image.Tag = "6-RedBrickFloor";
                        break;

                    case '7':
                        currentPictureBox.Image     = Properties.Resources._7_stairsdown;
                        currentPictureBox.Image.Tag = "7-StairsDown";
                        break;

                    case '8':
                        currentPictureBox.Image     = Properties.Resources._8_forest;
                        currentPictureBox.Image.Tag = "8-Forest";
                        break;

                    case '9':
                        currentPictureBox.Image     = Properties.Resources._9_poisonousswamp;
                        currentPictureBox.Image.Tag = "9-PoisonousSwamp";
                        break;

                    case 'A':
                        currentPictureBox.Image     = Properties.Resources.a_barrier;
                        currentPictureBox.Image.Tag = "A-Barrier";
                        break;

                    case 'B':
                        currentPictureBox.Image     = Properties.Resources.b_lockeddoor;
                        currentPictureBox.Image.Tag = "B-LockedDoor";
                        break;

                    case 'C':
                        currentPictureBox.Image     = Properties.Resources.c_weaponshopsign;
                        currentPictureBox.Image.Tag = "C-WeaponShopSign";
                        break;

                    case 'D':
                        currentPictureBox.Image     = Properties.Resources.d_innsign;
                        currentPictureBox.Image.Tag = "D-InnSign";
                        break;

                    case 'E':
                        currentPictureBox.Image     = Properties.Resources.e_bridge;
                        currentPictureBox.Image.Tag = "E-Bridge";
                        break;

                    case 'F':
                        currentPictureBox.Image     = Properties.Resources.f_desk;
                        currentPictureBox.Image.Tag = "F-Desk";
                        break;

                    default:
                        break;
                    }

                    currentPictureBox.Refresh();
                    currentPictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
                    currentPictureBox.Visible  = true;

                    x++;
                }
                catch (Exception ex)
                {
                    hasError = true;
                    break;
                }
            }

            if (hasError)
            {
                MessageBox.Show("Failed to populate map tiles. Try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
        }
示例#4
0
        private void saveMap()
        {
            ClassDWBackend classDWBackend = new ClassDWBackend(path);
            string         newKolHexData  = "";

            for (int x = 1; x <= 576; x++)
            {
                try
                {
                    PictureBox currentPictureBox = (PictureBox)FormKol.ActiveForm.Controls.Find("pictureBox" + x, true)[0];
                    String     currentImageTag   = currentPictureBox.Image.Tag.ToString();

                    if (currentImageTag == "0-Grass")
                    {
                        newKolHexData += "0";
                    }
                    else if (currentImageTag == "1-Desert")
                    {
                        newKolHexData += "1";
                    }
                    else if (currentImageTag == "2-Water")
                    {
                        newKolHexData += "2";
                    }
                    else if (currentImageTag == "3-TreasureChest")
                    {
                        newKolHexData += "3";
                    }
                    else if (currentImageTag == "4-SolidStoneWall2")
                    {
                        newKolHexData += "4";
                    }
                    else if (currentImageTag == "5-StairsUp")
                    {
                        newKolHexData += "5";
                    }
                    else if (currentImageTag == "6-RedBrickFloor")
                    {
                        newKolHexData += "6";
                    }
                    else if (currentImageTag == "7-StairsDown")
                    {
                        newKolHexData += "7";
                    }
                    else if (currentImageTag == "8-Forest")
                    {
                        newKolHexData += "8";
                    }
                    else if (currentImageTag == "9-PoisonousSwamp")
                    {
                        newKolHexData += "9";
                    }
                    else if (currentImageTag == "A-Barrier")
                    {
                        newKolHexData += "A";
                    }
                    else if (currentImageTag == "B-LockedDoor")
                    {
                        newKolHexData += "B";
                    }
                    else if (currentImageTag == "C-WeaponShopSign")
                    {
                        newKolHexData += "C";
                    }
                    else if (currentImageTag == "D-InnSign")
                    {
                        newKolHexData += "D";
                    }
                    else if (currentImageTag == "E-Bridge")
                    {
                        newKolHexData += "E";
                    }
                    else if (currentImageTag == "F-Desk")
                    {
                        newKolHexData += "F";
                    }
                }
                catch (Exception ex)
                {
                    //MessageBox.Show("Failed to write ROM: " + ex, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            bool result = classDWBackend.setKolData(newKolHexData);

            if (result)
            {
                MessageBox.Show("Successfully wrote ROM.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Failed to write ROM.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        /*
         * Towns:
         * Number| Tile
         * ------+-------------------
         * 0 | Grass
         * 1 | Desert
         * 2 | Water
         * 3 | Treasure Chest
         * 4 | Solid Stone Wall
         * 5 | Stairs Up
         * 6 | Red Brick Floor
         * 7 | Stairs Down
         * 8 | Grass - Special
         * 9 | Desert - Special
         * A | Water - Special
         * B | Treasure Chest - Special
         * C | Solid Stone Wall - Special
         * D | Stairs Up - Special
         * E | Red Brick Floor - Special
         * F | Stairs Down - Special
         */
        private void loadMap()
        {
            ClassDWBackend classDWBackend = new ClassDWBackend(path);

            string rainShrineHexData = classDWBackend.getRainShrineData();

            int  x        = 1;
            bool hasError = false;

            foreach (char ch in rainShrineHexData)
            {
                try
                {
                    PictureBox currentPictureBox = (PictureBox)FormRainShrine.ActiveForm.Controls.Find("pictureBox" + x, true)[0];

                    switch (ch)
                    {
                    case '0':
                        currentPictureBox.Image     = Properties.Resources._0_grass;
                        currentPictureBox.Image.Tag = "0-Grass";
                        break;

                    case '1':
                        currentPictureBox.Image     = Properties.Resources._1_desert;
                        currentPictureBox.Image.Tag = "1-Desert";
                        break;

                    case '2':
                        currentPictureBox.Image     = Properties.Resources._2_water;
                        currentPictureBox.Image.Tag = "2-Water";
                        break;

                    case '3':
                        currentPictureBox.Image     = Properties.Resources._3_treasurechest;
                        currentPictureBox.Image.Tag = "3-TreasureChest";
                        break;

                    case '4':
                        currentPictureBox.Image     = Properties.Resources._4_solidstonewall2;
                        currentPictureBox.Image.Tag = "4-SolidStoneWall2";
                        break;

                    case '5':
                        currentPictureBox.Image     = Properties.Resources._5_stairsup;
                        currentPictureBox.Image.Tag = "5-StairsUp";
                        break;

                    case '6':
                        currentPictureBox.Image     = Properties.Resources._6_redbrickfloor;
                        currentPictureBox.Image.Tag = "6-RedBrickFloor";
                        break;

                    case '7':
                        currentPictureBox.Image     = Properties.Resources._7_stairsdown;
                        currentPictureBox.Image.Tag = "7-StairsDown";
                        break;

                    case '8':
                        currentPictureBox.Image     = Properties.Resources._8_grass_special;
                        currentPictureBox.Image.Tag = "8-Grass-Special";
                        break;

                    case '9':
                        currentPictureBox.Image     = Properties.Resources._9_desert_special;
                        currentPictureBox.Image.Tag = "9-Desert-Special";
                        break;

                    case 'A':
                        currentPictureBox.Image     = Properties.Resources.a_water_special;
                        currentPictureBox.Image.Tag = "A-Water-Special";
                        break;

                    case 'B':
                        currentPictureBox.Image     = Properties.Resources.b_treasurechest_special;
                        currentPictureBox.Image.Tag = "B-TreasureChest-Special";
                        break;

                    case 'C':
                        currentPictureBox.Image     = Properties.Resources.c_solidstonewall_special;
                        currentPictureBox.Image.Tag = "C-SolidStoneWall-Special";
                        break;

                    case 'D':
                        currentPictureBox.Image     = Properties.Resources.d_stairsup_special;
                        currentPictureBox.Image.Tag = "D-StairsUp-Special";
                        break;

                    case 'E':
                        currentPictureBox.Image     = Properties.Resources.e_redbrickfloor_special;
                        currentPictureBox.Image.Tag = "E-RedBrickFloor-Special";
                        break;

                    case 'F':
                        currentPictureBox.Image     = Properties.Resources.f_stairsdown_special;
                        currentPictureBox.Image.Tag = "F-StairsDown-Special";
                        break;

                    default:
                        break;
                    }

                    currentPictureBox.Refresh();
                    currentPictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
                    currentPictureBox.Visible  = true;

                    x++;
                }
                catch (Exception ex)
                {
                    hasError = true;
                    break;
                }
            }

            if (hasError)
            {
                MessageBox.Show("Failed to populate map tiles. Try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
        }
        private void saveMap()
        {
            ClassDWBackend classDWBackend    = new ClassDWBackend(path);
            string         rainShrineHexData = "";

            for (int x = 1; x <= 100; x++)
            {
                try
                {
                    PictureBox currentPictureBox = (PictureBox)FormRainShrine.ActiveForm.Controls.Find("pictureBox" + x, true)[0];
                    String     currentImageTag   = currentPictureBox.Image.Tag.ToString();

                    if (currentImageTag == "0-Grass")
                    {
                        rainShrineHexData += "0";
                    }
                    else if (currentImageTag == "1-Desert")
                    {
                        rainShrineHexData += "1";
                    }
                    else if (currentImageTag == "2-Water")
                    {
                        rainShrineHexData += "2";
                    }
                    else if (currentImageTag == "3-TreasureChest")
                    {
                        rainShrineHexData += "3";
                    }
                    else if (currentImageTag == "4-SolidStoneWall2")
                    {
                        rainShrineHexData += "4";
                    }
                    else if (currentImageTag == "5-StairsUp")
                    {
                        rainShrineHexData += "5";
                    }
                    else if (currentImageTag == "6-RedBrickFloor")
                    {
                        rainShrineHexData += "6";
                    }
                    else if (currentImageTag == "7-StairsDown")
                    {
                        rainShrineHexData += "7";
                    }
                    else if (currentImageTag == "8-Grass-Special")
                    {
                        rainShrineHexData += "8";
                    }
                    else if (currentImageTag == "9-Desert-Special")
                    {
                        rainShrineHexData += "9";
                    }
                    else if (currentImageTag == "A-Water-Special")
                    {
                        rainShrineHexData += "A";
                    }
                    else if (currentImageTag == "B-TreasureChest-Special")
                    {
                        rainShrineHexData += "B";
                    }
                    else if (currentImageTag == "C-SolidStoneWall-Special")
                    {
                        rainShrineHexData += "C";
                    }
                    else if (currentImageTag == "D-StairsUp-Special")
                    {
                        rainShrineHexData += "D";
                    }
                    else if (currentImageTag == "E-RedBrickFloor-Special")
                    {
                        rainShrineHexData += "E";
                    }
                    else if (currentImageTag == "F-StairsDown-Special")
                    {
                        rainShrineHexData += "F";
                    }
                }
                catch (Exception ex)
                {
                    //MessageBox.Show("Failed to write ROM: " + ex, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            bool result = classDWBackend.setRainShrineData(rainShrineHexData);

            if (result)
            {
                MessageBox.Show("Successfully wrote ROM.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Failed to write ROM.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }