From 3ca05f596d14fba033f33fc4ec1dbb28d8617070 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Wed, 10 Jun 2015 21:12:35 +0100 Subject: [PATCH] system32 - allow individual x/y flipping on tilemaps, 2nd screen on arescue needs this --- src/mame/video/segas32.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/mame/video/segas32.c b/src/mame/video/segas32.c index 9a12ed7b445..8031a948b40 100644 --- a/src/mame/video/segas32.c +++ b/src/mame/video/segas32.c @@ -41,8 +41,9 @@ $31FF00 : w--- ---- ---- ---- : Screen width (0= 320, 1= 412) ---- f--- ---- ---- : Bitmap format (1= 8bpp, 0= 4bpp) ---- -t-- ---- ---- : Tile banking related - ---- --f- ---- ---- : 1= All layers X+Y flip - ---- ---- ---- 4--- : 1= X+Y flip for NBG3 + ---- --f- ---- ---- : 1= Global X/Y flip? (most games?) + ---- ---f ---- ---- : 1= All layers Y flip (or one layer?) (Air Rescue 2nd screen) + ---- ---- ---- 4--- : 1= X+Y flip for NBG3 ---- ---- ---- -2-- : 1= X+Y flip for NBG2 ---- ---- ---- --1- : 1= X+Y flip for NBG1 ---- ---- ---- ---0 : 1= X+Y flip for NBG0 @@ -866,7 +867,7 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, struct segas32_st UINT32 srcx, srcx_start, srcy; UINT32 srcxstep, srcystep; int dstxstep, dstystep; - int flip, opaque; + int opaque; int x, y; /* get the tilemaps */ @@ -879,7 +880,15 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, struct segas32_st //if (screen.machine().input().code_pressed(KEYCODE_X) && bgnum == 1) opaque = 1; /* determine if we're flipped */ - flip = ((m_system32_videoram[0x1ff00/2] >> 9) ^ (m_system32_videoram[0x1ff00/2] >> bgnum)) & 1; + int global_flip = (m_system32_videoram[0x1ff00 / 2] >> 9)&1; + + int flipx = global_flip; + int flipy = global_flip ^ ((m_system32_videoram[0x1ff00 / 2] >> 8)&1); + + int layer_flip = (m_system32_videoram[0x1ff00 / 2] >> bgnum) & 1; + + flipy ^= layer_flip; + flipx ^= layer_flip; /* determine the clipping */ clipenable = (m_system32_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; @@ -919,14 +928,20 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, struct segas32_st srcy += cliprect.min_y * srcystep; /* if we're flipped, simply adjust the start/step parameters */ - if (flip) + if (flipy) + { + const rectangle &visarea = screen.visible_area(); + + srcy += (visarea.max_y - 2 * cliprect.min_y) * srcystep; + srcystep = -srcystep; + } + + if (flipx) { const rectangle &visarea = screen.visible_area(); srcx_start += (visarea.max_x - 2 * cliprect.min_x) * srcxstep; - srcy += (visarea.max_y - 2 * cliprect.min_y) * srcystep; srcxstep = -srcxstep; - srcystep = -srcystep; } /* loop over the target rows */