Esempio n. 1
0
        public void loadObjects(bool overworld, byte dungeon, byte map)
        {
            spriteList = new List <Object>();
            if (overworld)
            {
                gb.BufferLocation = 0x58000;
            }
            else
            {
                gb.BufferLocation = 0x58200;
                if (dungeon >= 6 && dungeon < 0x1A)
                {
                    gb.BufferLocation = 0x58400;
                }
                else if (dungeon == 0xFF)
                {
                    gb.BufferLocation = 0x58600;
                }
            }
            gb.BufferLocation = gb.Get3BytePointerAddress((byte)(gb.BufferLocation / 0x4000), gb.BufferLocation + (map * 2)).Address;
            objectAddress     = gb.BufferLocation;
            byte b;

            while ((b = gb.ReadByte()) != 0xFF) //0xFE = End of room
            {
                Object ob = new Object();       // 2-Byte tiles
                ob.y  = (byte)(b >> 4);
                ob.x  = (byte)(b & 0xF);
                ob.id = gb.ReadByte();
                spriteList.Add(ob);
            }
            spriteData = new byte[80];
            foreach (Object obj in spriteList)
            {
                if (obj.y < 0 || obj.y > 7)
                {
                    continue;
                }
                if (obj.x < 0 || obj.x > 9)
                {
                    continue;
                }
                spriteData[obj.x + (obj.y * 10)] = (byte)obj.id;
            }
        }
Esempio n. 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);
            }
        }
Esempio n. 3
0
        public void saveAreaInfo(bool overWorld, byte map, byte dungeon, byte animations, byte SOG, byte music, bool special, bool magGlass)
        {
            if (overWorld)
            {
                //0x9000-0x9200
                int i = -1;
                int secondhalf;
                int map2 = map;
                if (map == 0x7)
                {
                    map++;
                }
                byte b  = (byte)((map >> 2) & 0xF8);
                byte b1 = (byte)(((map >> 1) & 0x07) | b);
                gb.BufferLocation = 0x82E7B + b1;
                gb.WriteByte(SOG);

                if (special)
                {
                    switch (map2)
                    {
                    case 0x06: i = 0x31F4; break;

                    case 0x0E: i = 0x31C4; break;

                    case 0x1B: i = 0x3204; break;

                    case 0x2B: i = 0x3214; break;

                    case 0x79: i = 0x31E4; break;

                    case 0x8C: i = 0x31D4; break;
                    }
                }
                if (i > 0)
                {
                    secondhalf = gb.Get2BytePointerAddress(i).Address;
                    if (map2 > 0x7F)
                    {
                        secondhalf += 0x68000;
                    }
                    else
                    {
                        secondhalf += 0x24000;
                    }
                    gb.BufferLocation = secondhalf;
                }
                else
                {
                    gb.BufferLocation = 0x24000 + (map2 * 2);
                    gb.BufferLocation = gb.Get2BytePointerAddress(gb.BufferLocation).Address;
                    if (map2 > 0x7F)
                    {
                        gb.BufferLocation = 0x68000 + (gb.BufferLocation - 0x24000);
                    }
                }
                gb.WriteByte(animations);

                gb.BufferLocation = 0x8000 + map2;
                gb.WriteByte(music);
            }
            else
            {
                //0x9000-0x9100
                if (dungeon >= 6 && dungeon < 0x1A)
                {
                    gb.BufferLocation = 0x82FBB + map;
                }
                else if (dungeon == 0xFF)
                {
                    gb.BufferLocation = 0x830BB + map;
                }
                else
                {
                    gb.BufferLocation = 0x82EBB + map;
                }
                gb.WriteByte(SOG);

                if (magGlass && dungeon >= 0x1A && map == 0xF5)
                {
                    gb.BufferLocation  = gb.Get2BytePointerAddress(0x3198).Address;
                    gb.BufferLocation += 0x28000;
                }
                else
                {
                    gb.BufferLocation = 0x28000;
                    if (dungeon >= 0x06 && 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;
                }
                gb.WriteByte(animations);

                gb.BufferLocation = 0x8100 + dungeon;
                if (dungeon == 0xFF)
                {
                    gb.BufferLocation = 0x8109;
                }
                if (map == 0xB5 && dungeon < 0x1A && dungeon >= 6)
                {
                    gb.BufferLocation = 0x810F;
                }
                gb.WriteByte(music);
            }
        }
Esempio n. 4
0
        public void getAnimations(byte map, byte dungeon, bool overworld, bool special)
        {
            if (overworld)
            {
                int i = -1;
                int secondhalf;
                if (special)
                {
                    switch (map)
                    {
                    case 0x06: i = 0x31F4; break;

                    case 0x0E: i = 0x31C4; break;

                    case 0x1B: i = 0x3204; break;

                    case 0x2B: i = 0x3214; break;

                    case 0x79: i = 0x31E4; break;

                    case 0x8C: i = 0x31D4; break;
                    }
                }
                if (i > 0)
                {
                    secondhalf = gb.Get2BytePointerAddress(i).Address;
                    if (map > 0x7F)
                    {
                        secondhalf += 0x68000;
                    }
                    else
                    {
                        secondhalf += 0x24000;
                    }
                    gb.BufferLocation = secondhalf;
                }
                else
                {
                    gb.BufferLocation = 0x24000 + (map * 2);
                    gb.BufferLocation = gb.Get2BytePointerAddress(gb.BufferLocation).Address;
                    if (map > 0x7F)
                    {
                        gb.BufferLocation = 0x68000 + (gb.BufferLocation - 0x24000);
                    }
                }
                byte b = gb.ReadByte();
                Animations = b;
            }
            else
            {
                gb.BufferLocation = 0x28000;
                if (dungeon >= 0x06 && 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;
                byte b = gb.ReadByte();
                Animations = b;
            }
        }