private void TestGetColorIndexAt(byte[] gfx, byte[] palData) { Palette palette = new Palette(null, 0, palData); TrackObjectTile tile = new TrackObjectTile(gfx); tile.Palette = palette; TileTests.TestGetColorIndexAt(tile, palette, true); }
private void TestGetColorIndexAt(byte[] gfx, Palette palette, RoadTile tile) { TileTests.TestGetColorIndexAt(tile, palette, false); byte[] gfxCopy = new byte[gfx.Length]; for (int y = 0; y < Tile.Size; y++) { for (int x = 0; x < Tile.Size; x++) { int colorIndex = tile.GetColorIndexAt(x, y); int index = y * Tile.Size + x; if (index % 2 == 1) { colorIndex <<= 4; } gfxCopy[index / 2] |= (byte)colorIndex; } } Assert.AreEqual(gfx, gfxCopy); }