Esempio n. 1
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (!groupBox3.Visible) //Not side room
            {
                if (gb.ReadByte(lastAddress + 4) == 0xFF)
                {
                    MessageBox.Show("Unable to continue. End of warp data for that group.", "Cannot Advance");
                    return;
                }
                lastAddress += 4;
                int  address = lastAddress;
                Warp w       = warpLoader.loadWarp(address);
                loadedWarp = w;

                if ((w.opcode & 0x40) != 0)
                {
                    groupBox2.Visible = true;
                    groupBox1.Visible = false;
                    groupBox2.Text    = "Warp Header - 0x" + address.ToString("X");
                    nFType.Value      = w.opcode;
                    nFMap.Value       = w.map;
                    nMap.Value        = w.map;
                    nPointer.Value    = 0x10000 + w.fpointer;
                }
                else
                {
                    groupBox2.Visible = false;
                    groupBox1.Visible = true;
                    groupBox1.Text    = "Warp Header - 0x" + address.ToString("X");
                    nType.Value       = w.opcode;
                    nSrcMap.Value     = w.map;
                    nMap.Value        = w.map;
                    nWarp.Value       = w.index;
                    nDestGroup.Value  = w.group;
                    nEntrance.Value   = w.entrance;
                }
            }
            else
            {
                if (gb.ReadByte(lastAddress + 4) == 0xFF)
                {
                    MessageBox.Show("Unable to continue. End of warp data for that group.", "Cannot Advance");
                    return;
                }
                lastAddress += 4;
                int address = lastAddress;
                groupBox3.Text = "Warp Header - 0x" + address.ToString("X");
                Warp w = warpLoader.loadSideWarp(address);
                loadedWarp       = w;
                nX.Value         = w.x;
                nSMap.Value      = w.map;
                nMap.Value       = w.map;
                nSIndex.Value    = w.index;
                nSGroup.Value    = w.group;
                nSEntrance.Value = w.entrance;
            }
        }
Esempio n. 2
0
        public void setPosWarp(int index)
        {
            Warp w = warpLoader.loadWarpProps(index, primaryWarp.group, game);

            propWarp        = w;
            nMap1.Value     = w.map;
            nPos1.Value     = w.pos;
            nUnknown1.Value = w.unknown;
        }
Esempio n. 3
0
        public Warp loadWarpProps(int refByte, int destGroup, Program.GameTypes game)
        {
            Warp w = new Warp();

            gb.BufferLocation  = (game == Program.GameTypes.Ages ? 0x12F5B : 0x12D4E) + (destGroup * 2);
            gb.BufferLocation  = 0x10000 + gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100);
            gb.BufferLocation += refByte * 3;
            w.map              = gb.ReadByte();
            w.pos              = gb.ReadByte();
            w.unknown          = gb.ReadByte();
            return(w);
        }
Esempio n. 4
0
 public void fillWarp(Warp w)
 {
     primaryWarp = w;
     nType.Value = w.opcode;
     nSrcX.Value = w.map;
     nWarp.Value = w.index;
     if (w.index == 0)
     {
         nWarp_ValueChanged(null, null);
     }
     nDestGroup.Value = w.group;
     nEntrance.Value  = w.entrance;
 }
Esempio n. 5
0
        public Warp loadSideWarp(int headerAddress)
        {
            if (headerAddress == -1)
            {
                return(null);
            }
            Warp w = new Warp();

            gb.BufferLocation = headerAddress;
            w.x     = gb.ReadByte();
            w.map   = gb.ReadByte();
            w.index = gb.ReadByte();
            byte b = gb.ReadByte();

            w.group    = (byte)(b >> 4);
            w.entrance = (byte)(b & 0xF);

            return(w);
        }
Esempio n. 6
0
        private void button2_Click(object sender, EventArgs e)
        {
            frmW = new frmWarpProps(warpLoader, loadedWarp.srcGroup, loadedWarp.fpointer + 0x10000, game, gb);
            if (loadedWarp == null)
            {
                return;
            }
            Warp w;

            if (groupBox1.Visible)
            {
                w = warpLoader.loadWarpProps((int)nWarp.Value, (int)nDestGroup.Value, game);
                frmW.grp0.Visible    = true;
                frmW.nMap0.Value     = w.map;
                frmW.nPos0.Value     = w.pos;
                frmW.nUnknown0.Value = w.unknown;
            }
            else if (groupBox2.Visible)
            {
                Warp m = warpLoader.loadWarp(0x10000 + loadedWarp.fpointer);
                frmW.grp1A.Visible = true;
                frmW.grp1B.Visible = true;
                frmW.fillWarp(m);
            }
            else
            {
                w = warpLoader.loadWarpProps((int)nSIndex.Value, (int)nSGroup.Value, game);
                frmW.grp0.Visible    = true;
                frmW.nMap0.Value     = w.map;
                frmW.nPos0.Value     = w.pos;
                frmW.nUnknown0.Value = w.unknown;
            }

            if (frmW.ShowDialog() != DialogResult.OK)
            {
                loadedWarp.secondaryWarp = null;
                frmW = null;
                return;
            }

            loadedWarp.secondaryWarp = frmW.propWarp;
        }
Esempio n. 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool dungeon = new MinimapCreator(gb).dungeon(cboArea.SelectedIndex, game);

            mapLoader.loadMap((int)nMap.Value, new MinimapCreator(gb).getRealMapGroup(cboArea.SelectedIndex, game), 0, true, game);
            bool sideMap = isSidemap(mapLoader.room);

            this.sideMap = sideMap;
            if (!sideMap)
            {
                groupBox3.Visible = false;
                int address = warpLoader.getWarpHeaderAddress(getRealMapGroup(cboArea.SelectedIndex), (int)nMap.Value, new MinimapCreator(gb).dungeon(cboArea.SelectedIndex, game), flag2, game);
                lastAddress = address;
                if (address == -1)
                {
                    groupBox1.Visible = false;
                    groupBox2.Visible = false;
                    button5.Enabled   = false;
                    if (!dungeon)
                    {
                        MessageBox.Show("No warp for that map found. To add one, find\nan existing warp on the same group\nand change the index.", "No Warp Found");
                    }
                    else
                    {
                        MessageBox.Show("No warp for that map found. Either find an\nexisting warp and replace it or have the warp\nlead directly to the underlying or above room.", "No Warp Found");
                    }
                    return;
                }

                Warp w = warpLoader.loadWarp(address);
                w.srcGroup      = (byte)cboArea.SelectedIndex;
                button5.Enabled = true;
                loadedWarp      = w;

                if ((w.opcode & 0x40) != 0)
                {
                    groupBox2.Text    = "Warp Header - 0x" + address.ToString("X");
                    groupBox1.Visible = false;
                    groupBox2.Visible = true;
                    nFType.Value      = w.opcode;
                    nFMap.Value       = w.map;
                    nPointer.Value    = 0x10000 + w.fpointer;
                }
                else
                {
                    groupBox1.Text    = "Warp Header - 0x" + address.ToString("X");
                    groupBox2.Visible = false;
                    groupBox1.Visible = true;
                    nType.Value       = w.opcode;
                    nSrcMap.Value     = w.map;
                    nWarp.Value       = w.index;
                    nDestGroup.Value  = w.group;
                    nEntrance.Value   = w.entrance;
                }
            }
            else
            {
                int address = warpLoader.getSideWarpHeaderAddress((new MinimapCreator(gb).getRealMapGroup(cboArea.SelectedIndex, game) == 4 ? 6 : 7), (int)nMap.Value, game);
                lastAddress       = address;
                groupBox1.Visible = false;
                groupBox2.Visible = false;
                if (address == -1)
                {
                    groupBox3.Visible = false;
                    MessageBox.Show("No warp for that map found. To add one, find\nan existing warp on the same group\nand change the values to match the format similar\nto a regular side-map warp.", "No Warp Found");
                    button5.Enabled = false;
                    return;
                }
                button5.Enabled   = true;
                groupBox3.Text    = "Warp Header - 0x" + address.ToString("X");
                groupBox3.Visible = true;
                Warp w = warpLoader.loadSideWarp(address);
                w.srcGroup       = (byte)cboArea.SelectedIndex;
                nX.Value         = w.x;
                nSMap.Value      = w.map;
                nSIndex.Value    = w.index;
                nSGroup.Value    = w.group;
                nSEntrance.Value = w.entrance;
                loadedWarp       = w;
            }
        }