From 43e005905d24250ae2314f63dfd39cdd9cdd3695 Mon Sep 17 00:00:00 2001 From: 987123879113 <63495610+987123879113@users.noreply.github.com> Date: Sun, 21 Jan 2024 00:28:48 +0900 Subject: [PATCH] misc/sttechno.cpp: Implemented tile X/Y flip flags. (#11954) Also corrected reversed names of loop variables tile_x and tile_y. --- src/mame/misc/sttechno.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mame/misc/sttechno.cpp b/src/mame/misc/sttechno.cpp index c540dd36132..87ee840a839 100644 --- a/src/mame/misc/sttechno.cpp +++ b/src/mame/misc/sttechno.cpp @@ -279,18 +279,22 @@ uint32_t sttechno_state::screen_update(screen_device &screen, bitmap_ind16 &bitm break; } - for (int tile_x = 0; tile_x < tiles_h; tile_x++) { - for (int tile_y = 0; tile_y < tiles_w; tile_y++) { + for (int tile_y = 0; tile_y < tiles_h; tile_y++) { + for (int tile_x = 0; tile_x < tiles_w; tile_x++) { for (int pix_y = 0; pix_y < 16; pix_y++) { for (int pix_x = 0; pix_x < 16; pix_x++) { - const int ty = (y + tile_x * 16 + pix_y) % 512; // 512x512 framebuffer size, must be wrapped - const int tx = (x + (tile_y * 16) + pix_x) % 512; + const int tx = xflip + ? ((x + ((tiles_w - tile_x - 1) * 16) + (15 - pix_x)) % 512) // 512x512 framebuffer size, must be wrapped + : ((x + (tile_x * 16) + pix_x) % 512); + const int ty = yflip + ? ((y + (tiles_h - tile_y - 1) * 16 + (15 - pix_y)) % 512) + : ((y + tile_y * 16 + pix_y) % 512); if (!cliprect.contains(tx, ty)) continue; uint16_t *const pix = &bitmap.pix(ty, tx); - const uint32_t char_offset = char_offset_base + (tile_x * (0x100 * tiles_w)) + (tile_y * 0x100) + (pix_y * 16) + pix_x; + const uint32_t char_offset = char_offset_base + (tile_y * (0x100 * tiles_w)) + (tile_x * 0x100) + (pix_y * 16) + pix_x; const uint16_t char_data = m_video_flash->read_raw(char_offset / 2); const int colidx = BIT(char_data, 8 * (1 - (char_offset & 1)), 8); uint16_t color = m_sttga1_ram_pal[palidx * 0x100 + colidx];