示例#1
0
        private void bCreateWarp_Click(object sender, EventArgs e)
        {
            Warps w = new Warps();

            w.region = 0;
            w.map    = 0;
            w.type   = 0;
            w.x      = 0;
            w.y      = 0;
            warpList.Add(w);
            nIndex.Maximum++;
        }
示例#2
0
        public void getCollisionDataDungeon(byte map, byte dungeon, bool magGlass)
        {
            objects = new List <LAObject>();
            warps   = new List <Warps>();
            if (magGlass && map == 0xF5 && dungeon >= 0x1A || magGlass && map == 0xF5 && dungeon < 6)
            {
                gb.BufferLocation  = gb.Get2BytePointerAddress(0x3198).Address;
                gb.BufferLocation += 0x28001;
            }
            else
            {
                gb.BufferLocation = 0x28000;
                if (dungeon >= 6 && dungeon < 0x1A)
                {
                    gb.BufferLocation += 0x4000;
                }
                else if (dungeon == 0xFF)
                {
                    gb.BufferLocation = 0x2BB77;
                }
                gb.BufferLocation = gb.Get3BytePointerAddress((byte)(gb.BufferLocation / 0x4000), gb.BufferLocation + (map * 2)).Address + 1; //skip animation
            }
            mapAddress = gb.BufferLocation - 1;
            byte b = gb.ReadByte();

            while ((b = gb.ReadByte()) != 0xFE) //0xFE = End of room
            {
                if (b >> 4 == 0xE)
                {
                    Warps w = new Warps();
                    w.type   = (byte)(b & 0x0F);
                    w.region = gb.ReadByte();
                    w.map    = gb.ReadByte();
                    w.x      = gb.ReadByte();
                    w.y      = gb.ReadByte();
                    warps.Add(w);
                    continue;
                }
                if (b >> 4 == 8 || b >> 4 == 0xC) //3-Byte objects
                {
                    LAObject o = new LAObject();
                    o.is3Byte   = true;
                    o.length    = (byte)(b & 0xF);
                    o.direction = (byte)(b >> 4);
                    byte b2 = gb.ReadByte();
                    o.y  = (byte)(b2 >> 4);
                    o.x  = (byte)(b2 & 0xF);
                    o.id = gb.ReadByte();
                    objects.Add(o);
                    continue;
                }
                LAObject ob = new LAObject(); // 2-Byte tiles
                ob.y  = (byte)(b >> 4);
                ob.x  = (byte)(b & 0xF);
                ob.id = gb.ReadByte();
                if (ob.id >= 0xEC && ob.id <= 0xFD)// Door tiles
                {
                    int bufferloc = gb.BufferLocation;
                    ob.gb             = gb;
                    ob                = ob.dungeonDoors(ob);
                    gb.BufferLocation = bufferloc;
                }
                objects.Add(ob);
            }
        }