private static void DrawInBitmap1DMapping(this OAMEntry oam, Bitmap bm, GraphicsBank graphics, int xOffset, int yOffset) { for (uint tileY = 0; tileY < oam.TilesY; ++tileY) { for (uint tileX = 0; tileX < oam.TilesX; ++tileX) { uint tileIndex = oam.TileIndex; tileIndex += tileX + oam.TilesX * tileY; var tile = graphics.Tiles[tileIndex]; oam.DrawInBitmap(bm, tile, tileX, tileY, xOffset, yOffset); } } }
public static void DrawInBitmap2DMapping(this OAMEntry oam, Bitmap bm, GraphicsBank graphics, int xOffset, int yOffset) { uint baseX = oam.TileIndex % graphics.TilesX; uint baseY = oam.TileIndex / graphics.TilesX; uint subTileWidth = (graphics.TilesX == 0xFFFF) ? oam.TilesX : graphics.TilesX; for (uint tileY = 0; tileY < oam.TilesY; ++tileY) { for (uint tileX = 0; tileX < oam.TilesX; ++tileX) { uint subTileYIndex = baseY + tileY; uint subTileXIndex = baseX + tileX; uint tileIndex = subTileXIndex + subTileYIndex * subTileWidth; var tile = graphics.Tiles[tileIndex]; oam.DrawInBitmap(bm, tile, tileX, tileY, xOffset, yOffset); } } }