102 const uint8_t* tiledata,
int indexoffset) {
105 constexpr int kGfxBufferSize = 0x10000;
106 constexpr int kMaxTileRow = 63;
109 int tile_col_idx = tile.
id_ % 16;
110 int tile_row_idx = tile.
id_ / 16;
113 if (tile_row_idx > kMaxTileRow) {
117 int tile_base_x = tile_col_idx * 8;
118 int tile_base_y = tile_row_idx * 1024;
130 uint8_t palette_offset;
131 if (pal >= 2 && pal <= 7) {
133 palette_offset = (pal - 2) * 15;
143 uint8_t priority = tile.
over_ ? 1 : 0;
146 for (
int py = 0; py < 8; py++) {
149 for (
int px = 0; px < 8; px++) {
154 int src_index = (src_row * 128) + src_col + tile_base_x + tile_base_y;
157 if (src_index < 0 || src_index >= kGfxBufferSize)
continue;
159 uint8_t pixel = tiledata[src_index];
164 uint8_t final_color = (pixel - 1) + palette_offset;
165 int dest_index = indexoffset + (py *
width_) + px;
168 if (dest_index >= 0 && dest_index < max_dest) {
169 canvas[dest_index] = final_color;
249 int tile_address,
int tile_address_floor,
250 uint8_t floor_graphics) {
254 LOG_DEBUG(
"[DrawFloor]",
"Creating bitmap: %dx%d, active=%d, width=%d",
258 LOG_DEBUG(
"[DrawFloor]",
"After Create: active=%d, width=%d, height=%d",
262 "Bitmap already exists: active=%d, width=%d, height=%d",
266 auto floor_offset =
static_cast<uint8_t
>(floor_graphics << 4);
269 gfx::TileInfo floorTile1(rom_data[tile_address + floor_offset],
270 rom_data[tile_address + floor_offset + 1]);
271 gfx::TileInfo floorTile2(rom_data[tile_address + floor_offset + 2],
272 rom_data[tile_address + floor_offset + 3]);
273 gfx::TileInfo floorTile3(rom_data[tile_address + floor_offset + 4],
274 rom_data[tile_address + floor_offset + 5]);
275 gfx::TileInfo floorTile4(rom_data[tile_address + floor_offset + 6],
276 rom_data[tile_address + floor_offset + 7]);
278 gfx::TileInfo floorTile5(rom_data[tile_address_floor + floor_offset],
279 rom_data[tile_address_floor + floor_offset + 1]);
280 gfx::TileInfo floorTile6(rom_data[tile_address_floor + floor_offset + 2],
281 rom_data[tile_address_floor + floor_offset + 3]);
282 gfx::TileInfo floorTile7(rom_data[tile_address_floor + floor_offset + 4],
283 rom_data[tile_address_floor + floor_offset + 5]);
284 gfx::TileInfo floorTile8(rom_data[tile_address_floor + floor_offset + 6],
285 rom_data[tile_address_floor + floor_offset + 7]);
300 for (
int xx = 0; xx < 16; xx++) {
301 for (
int yy = 0; yy < 32; yy++) {
303 SetTileAt((xx * 4) + 1, (yy * 2), word2);
304 SetTileAt((xx * 4) + 2, (yy * 2), word3);
305 SetTileAt((xx * 4) + 3, (yy * 2), word4);
307 SetTileAt((xx * 4), (yy * 2) + 1, word5);
308 SetTileAt((xx * 4) + 1, (yy * 2) + 1, word6);
309 SetTileAt((xx * 4) + 2, (yy * 2) + 1, word7);
310 SetTileAt((xx * 4) + 3, (yy * 2) + 1, word8);
void Create(int width, int height, int depth, std::span< uint8_t > data)
Create a bitmap with the given dimensions and data.