Exemplo n.º 1
0
        public TrackObjectGraphics(byte[] romBuffer, Offsets offsets)
        {
            int typeCount = Enum.GetValues(typeof(TrackObjectType)).Length;
            int count     = typeCount + 2; // + 2 to account for moving Match Race object and items

            this.tiles = new TrackObjectTile[count][];
            int offsetLocation = offsets[Offset.TrackObjectGraphics];

            byte[] tilesetGfx;
            int[]  tileIndexes;

            for (int i = 0; i < typeCount; i++)
            {
                TrackObjectType type   = (TrackObjectType)i;
                int             offset = TrackObjectGraphics.GetGraphicsOffset(type, romBuffer, offsetLocation);
                tilesetGfx    = Codec.Decompress(romBuffer, offset);
                tileIndexes   = TrackObjectGraphics.GetTileIndexes(type);
                this.tiles[i] = TrackObjectGraphics.GetTiles(tilesetGfx, tileIndexes);
            }

            tileIndexes = TrackObjectGraphics.GetMatchRaceTileIndexes();

            tilesetGfx = Codec.Decompress(romBuffer, offsets[Offset.MatchRaceObjectGraphics]);
            this.tiles[this.tiles.Length - 2] = TrackObjectGraphics.GetTiles(tilesetGfx, tileIndexes);

            tilesetGfx = Codec.Decompress(romBuffer, offsets[Offset.ItemGraphics]);
            this.tiles[this.tiles.Length - 1] = TrackObjectGraphics.GetTiles(tilesetGfx, tileIndexes);
        }
Exemplo n.º 2
0
        private static int[] GetTileIndexes(TrackObjectType type)
        {
            if (type == TrackObjectType.Plant || type == TrackObjectType.Fish)
            {
                return(new[] { 4 * 32, 5 * 32, 20 * 32, 21 * 32 });
            }

            return(new[] { 32 * 32, 33 * 32, 48 * 32, 49 * 32 });
        }
Exemplo n.º 3
0
 private Tile[] GetTiles(TrackObjectType tileset)
 {
     return(this.tiles[(int)tileset]);
 }