Пример #1
0
        public static void LoadTile16(Rom rom)
        {
            int tpos = RomConstants.map16Tiles;

            //TODO: Change that magic number
            for (int i = 0; i < 4096; i += 1)
            {
                var t0 = GetTile8(rom.readShort(tpos));
                var t1 = GetTile8(rom.readShort(tpos + 2));
                var t2 = GetTile8(rom.readShort(tpos + 4));
                var t3 = GetTile8(rom.readShort(tpos + 6));
                tpos += 8;
                tiles16.Add(new Tile16(new Tile8Data[4] {
                    t0, t1, t2, t3
                }));
            }
        }
Пример #2
0
        public static Tile16[] LoadTile16(Rom rom)
        {
            int           tpos    = RomConstants.map16Tiles;
            List <Tile16> tiles16 = new List <Tile16>();

            for (int i = 0; i < 4096; i += 1)
            {
                var t0 = GetTile8(rom.readShort(tpos));
                var t1 = GetTile8(rom.readShort(tpos + 2));
                var t2 = GetTile8(rom.readShort(tpos + 4));
                var t3 = GetTile8(rom.readShort(tpos + 6));
                tpos += 8;
                tiles16.Add(new Tile16(new Tile8Data[4] {
                    t0, t1, t2, t3
                }));
            }
            return(tiles16.ToArray());
        }
Пример #3
0
        public void LoadMapTiles(Rom rom)
        {
            //locat functions

            int p1 =
                (rom.romData[(RomConstants.compressedAllMap32PointersHigh) + 2 + (int)(3 * mapId)] << 16) +
                (rom.romData[(RomConstants.compressedAllMap32PointersHigh) + 1 + (int)(3 * mapId)] << 8) +
                (rom.romData[(RomConstants.compressedAllMap32PointersHigh + (int)(3 * mapId))]);

            p1 = Utils.SnesToPc(p1);

            int p2 =
                (rom.romData[(RomConstants.compressedAllMap32PointersLow) + 2 + (int)(3 * mapId)] << 16) +
                (rom.romData[(RomConstants.compressedAllMap32PointersLow) + 1 + (int)(3 * mapId)] << 8) +
                (rom.romData[(RomConstants.compressedAllMap32PointersLow + (int)(3 * mapId))]);

            p2 = Utils.SnesToPc(p2);


            int ttpos = 0, compressedSize1 = 0, compressedSize2 = 0;

            byte[] bytes  = ZCompressLibrary.Decompress.ALTTPDecompressOverworld(rom.romData, p2, 1000, ref compressedSize1);
            byte[] bytes2 = ZCompressLibrary.Decompress.ALTTPDecompressOverworld(rom.romData, p1, 1000, ref compressedSize2);

            for (int y = 0; y < 16; y++)
            {
                for (int x = 0; x < 16; x++)
                {
                    ushort tidD = (ushort)((bytes2[ttpos] << 8) + bytes[ttpos]);

                    int tpos = tidD;
                    if (tpos < TilesLoader.tiles32.Count)
                    {
                        tiles[(x * 2) + ((y * 2) * 32)]           = TilesLoader.tiles32[tpos].tile16data[0];
                        tiles[(x * 2) + 1 + ((y * 2) * 32)]       = TilesLoader.tiles32[tpos].tile16data[1];
                        tiles[(x * 2) + (((y * 2) + 1) * 32)]     = TilesLoader.tiles32[tpos].tile16data[2];
                        tiles[(x * 2) + 1 + (((y * 2) + 1) * 32)] = TilesLoader.tiles32[tpos].tile16data[3];
                    }
                    ttpos += 1;
                }
            }
        }
Пример #4
0
 static ushort generate(int i, int k, int dimension, Rom rom)
 {
     return((ushort)(rom.romData[map32address[dimension] + k + (i)]
                     + (((rom.romData[map32address[dimension] + (i) + (k <= 1 ? 4 : 5)] >> (k % 2 == 0 ? 4 : 0)) & 0x0F) * 256)));
 }
Пример #5
0
 public TilesViewer(Rom rom)
 {
     InitializeComponent();
     this.rom = rom;
 }
Пример #6
0
 public OverworldMap(Rom rom, int mapId)
 {
     this.rom   = rom;
     this.mapId = mapId;
     LoadMapData();
 }