Пример #1
0
 public static int LongRead_LoHiBank(int loAddress, int hiAddress, int bankAddress)
 {
     return(AddressLoROM.SnesToPc(
                ROM.DATA[loAddress],
                ROM.DATA[hiAddress],
                ROM.DATA[bankAddress]));
 }
Пример #2
0
 public static byte[] GeneratePointer2(int address)
 {
     return(new byte[]
     {
         (byte)AddressLoROM.PcToSnes_Lo(address),
         (byte)AddressLoROM.PcToSnes_Hi(address),
     });
 }
Пример #3
0
 public static int ShortRead_LoHi(int address)
 {
     return(AddressLoROM.SnesToPc
            (
                ROM.DATA[address],
                ROM.DATA[address + 1],
                AddressLoROM.PcToSnes_Bank(address)
            ));
 }
Пример #4
0
        public void isdamagePit()
        {
            int pitCount   = (ROM.DATA[ConstantsReader.GetAddress("pit_count")] / 2);
            int pitPointer = AddressLoROM.SnesToPc(ConstantsReader.GetAddress("pit_pointer"));

            pitPointer = Addresses.snestopc(pitPointer);
            for (int i = 0; i < pitCount; i++)
            {
                if (((ROM.DATA[pitPointer + 1 + (i * 2)] << 8) + (ROM.DATA[pitPointer + (i * 2)])) == index)
                {
                    damagepit = true;
                    return;
                }
            }
        }
Пример #5
0
        public void loadHeader()
        {
            //address of the room header

            int headerPointer = AddressLoROM.SnesToPc(ConstantsReader.GetAddress("room_header_pointer"));

            headerPointer = Addresses.snestopc(headerPointer);
            int address = (ROM.DATA[ConstantsReader.GetAddress("room_header_pointers_bank")] << 16) +
                          (ROM.DATA[(headerPointer + 1) + (index * 2)] << 8) +
                          ROM.DATA[(headerPointer) + (index * 2)];

            header_location = Addresses.snestopc(address);

            bg2       = (byte)((ROM.DATA[header_location] >> 5) & 0x07);
            collision = (byte)((ROM.DATA[header_location] >> 2) & 0x07);
            light     = (((ROM.DATA[header_location]) & 0x01) == 1 ? true : false);

            if (light)
            {
                bg2 = 00;
            }

            palette   = (byte)((ROM.DATA[header_location + 1] & 0x3F));
            blockset  = (byte)((ROM.DATA[header_location + 2]));
            spriteset = (byte)((ROM.DATA[header_location + 3]));
            effect    = (byte)((ROM.DATA[header_location + 4]));
            tag1      = (byte)((ROM.DATA[header_location + 5]));
            tag2      = (byte)((ROM.DATA[header_location + 6]));

            holewarp_plane     = (byte)((ROM.DATA[header_location + 7]) & 0x03);
            staircase_plane[0] = (byte)((ROM.DATA[header_location + 7] >> 2) & 0x03);
            staircase_plane[1] = (byte)((ROM.DATA[header_location + 7] >> 4) & 0x03);
            staircase_plane[2] = (byte)((ROM.DATA[header_location + 7] >> 6) & 0x03);
            staircase_plane[3] = (byte)((ROM.DATA[header_location + 8]) & 0x03);

            holewarp           = (byte)((ROM.DATA[header_location + 9]));
            staircase_rooms[0] = (byte)((ROM.DATA[header_location + 10]));
            staircase_rooms[1] = (byte)((ROM.DATA[header_location + 11]));
            staircase_rooms[2] = (byte)((ROM.DATA[header_location + 12]));
            staircase_rooms[3] = (byte)((ROM.DATA[header_location + 13]));
        }
Пример #6
0
        /* public void addSprites()
         * {
         *   int spritePointer = (04 << 16) + (ROM.DATA[ConstantsReader.GetAddress("rooms_sprite_pointer") + 1] << 8) + (ROM.DATA[ConstantsReader.GetAddress("rooms_sprite_pointer")]);
         *   //09 bank ? Need to check if HM change that
         *   int sprite_address_snes = (09 << 16) +
         *   (ROM.DATA[spritePointer + (index * 2) + 1] << 8) +
         *   ROM.DATA[spritePointer + (index * 2)];
         *   int sprite_address = Addresses.snestopc(sprite_address_snes);
         *   sortSprites = ROM.DATA[sprite_address] == 1 ? true : false;
         *   sprite_address += 1;
         *   while (true)
         *   {
         *       byte
         *           b1 = ROM.DATA[sprite_address],
         *           b2 = ROM.DATA[sprite_address + 1],
         *           b3 = ROM.DATA[sprite_address + 2];
         *
         *       if (b1 == 0xFF) { break; }
         *       Room_Sprite s = new Room_Sprite(b3, (byte)(b2 & 0x1F), (byte)(b1 & 0x1F), Sprites_Names.name[b3], (byte)((b2 & 0xE0) >> 5), (byte)((b1 & 0x60) >> 5), (byte)((b1 & 0x80) >> 7), 0);
         *       sprites.Add(s);
         *
         *       if (sprites.Count > 1)
         *       {
         *           Room_Sprite spr = sprites[sprites.Count - 1];
         *           Room_Sprite prevSprite = sprites[sprites.Count - 2];
         *           if (spr.id == 0xE4 && spr.x == 0x00 && spr.y == 0x1E && spr.layer == 1 && ((spr.subtype << 3) + spr.overlord) == 0x18)
         *           {
         *               if (prevSprite != null)
         *               {
         *                   prevSprite.keyDrop = 1;
         *                   sprites.RemoveAt(sprites.Count - 1);
         *               }
         *           }
         *           if (spr.id == 0xE4 && spr.x == 0x00 && spr.y == 0x1D && spr.layer == 1 && ((spr.subtype << 3) + spr.overlord) == 0x18)
         *           {
         *               if (prevSprite != null)
         *               {
         *                   prevSprite.keyDrop = 2;
         *                   sprites.RemoveAt(sprites.Count - 1);
         *               }
         *           }
         *       }
         *       sprite_address += 3;
         *   }
         * }*/


        public void addlistBlock(ref byte[] blocksdata, int maxCount)
        {
            int pos1 = AddressLoROM.SnesToPc(ConstantsReader.GetAddress("blocks_pointer1")),
                pos2 = AddressLoROM.SnesToPc(ConstantsReader.GetAddress("blocks_pointer2")),
                pos3 = AddressLoROM.SnesToPc(ConstantsReader.GetAddress("blocks_pointer3")),
                pos4 = AddressLoROM.SnesToPc(ConstantsReader.GetAddress("blocks_pointer4"));

            for (int i = 0; i < 0x80; i += 1)
            {
                blocksdata[i]        = (ROM.DATA[i + pos1]);
                blocksdata[i + 0x80] = (ROM.DATA[i + pos2]);
                if (i + 0x100 < maxCount)
                {
                    blocksdata[i + 0x100] = (ROM.DATA[i + pos3]);
                }
                if (i + 0x180 < maxCount)
                {
                    blocksdata[i + 0x180] = (ROM.DATA[i + pos4]);
                }
            }
        }
Пример #7
0
        public void loadChests(ref List <ChestData> chests_in_room)
        {
            int cpos = AddressLoROM.SnesToPc(ConstantsReader.GetAddress("chests_data_pointer1"));

            cpos = Addresses.snestopc(cpos);
            int clength = (ROM.DATA[ConstantsReader.GetAddress("chests_length_pointer") + 1] << 8) + (ROM.DATA[ConstantsReader.GetAddress("chests_length_pointer")]);

            for (int i = 0; i < (clength); i++)
            {
                if ((((ROM.DATA[cpos + (i * 3) + 1] << 8) + (ROM.DATA[cpos + (i * 3)])) & 0x7FFF) == index)
                {
                    //there's a chest in that room !
                    bool big = false;
                    if ((((ROM.DATA[cpos + (i * 3) + 1] << 8) + (ROM.DATA[cpos + (i * 3)])) & 0x8000) == 0x8000) //?????
                    {
                        big = true;
                    }
                    chests_in_room.Add(new ChestData(ROM.DATA[cpos + (i * 3) + 2], big));
                    //
                }
            }
        }