summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/sega/segas32_v.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/sega/segas32_v.cpp')
-rw-r--r--src/mame/sega/segas32_v.cpp44
1 files changed, 19 insertions, 25 deletions
diff --git a/src/mame/sega/segas32_v.cpp b/src/mame/sega/segas32_v.cpp
index a7d613a503c..9ddb77d1172 100644
--- a/src/mame/sega/segas32_v.cpp
+++ b/src/mame/sega/segas32_v.cpp
@@ -20,11 +20,8 @@
- Verify that X/Y center has 10 bits of resolution when zooming and
9 when not.
- - In svf (the field) and radr (on the field), they use tilemap-specific
- flip in conjunction with rowscroll AND rowselect. According to Charles,
- in this case, the rowselect lookups should be done in reverse order,
- but this results in an incorrect display. For now, we assume there is
- a bug in the procedure and implement it so that it looks correct.
+ - Sonic while globally flipped via the service menu, fails to flip
+ the "SEGA" and "SEGASONIC" sprite based logos on the title screen.
- titlef NBG0 and NBG2 layers are currently hidden during gameplay.
It sets $31ff02 with either $7be0 and $2960 (and $31ff8e is $c00).
@@ -61,8 +58,8 @@
$31FF00 : w--- ---- ---- ---- : Screen width (0= 320, 1= 412)
---- f--- ---- ---- : Bitmap format (1= 8bpp, 0= 4bpp)
---- -t-- ---- ---- : Tile banking related
- ---- --f- ---- ---- : 1= Global X/Y flip? (most games?)
- ---- ---f ---- ---- : 1= prohbit Y flip? (Air Rescue 2nd screen title, also gets set on one of the intro sequence screens)
+ ---- --f- ---- ---- : 1= Global X/Y flip (enabled via service menu)
+ ---- ---f ---- ---- : 1= Prohibit layer Y flip (NBG0 - NBG3)
---- ---- ---- 4--- : 1= X+Y flip for NBG3
---- ---- ---- -2-- : 1= X+Y flip for NBG2
---- ---- ---- --1- : 1= X+Y flip for NBG1
@@ -544,7 +541,7 @@ TILE_GET_INFO_MEMBER(segas32_state::get_tile_info)
int segas32_state::compute_clipping_extents(screen_device &screen, int enable, int clipout, int clipmask, const rectangle &cliprect, extents_list *list)
{
- int flip = (m_videoram[0x1ff00/2] >> 9) & 1;
+ int flip = BIT(m_videoram[0x1ff00 / 2], 9);
rectangle tempclip;
rectangle clips[5];
int sorted[5];
@@ -646,20 +643,14 @@ int segas32_state::compute_clipping_extents(screen_device &screen, int enable, i
void segas32_state::compute_tilemap_flips(int bgnum, int &flipx, int &flipy)
{
- /* determine if we're flipped */
- int global_flip = (m_videoram[0x1ff00 / 2] >> 9)&1;
-
- flipx = global_flip;
- flipy = global_flip;
-
- int layer_flip = (m_videoram[0x1ff00 / 2] >> bgnum) & 1;
+ // determine flip bits
+ int global_flip = BIT(m_videoram[0x1ff00 / 2], 9);
+ int layer_flip = BIT(m_videoram[0x1ff00 / 2], bgnum);
+ int prohibit_flipy = BIT(m_videoram[0x1ff00 / 2], 8);
- flipy ^= layer_flip;
- flipx ^= layer_flip;
+ flipx = (layer_flip) ? !global_flip : global_flip;
- // this bit is set on Air Rescue (screen 2) title screen, during the Air Rescue introduction demo, and in f1en when you win a single player race
- // it seems to prohibit (at least) the per-tilemap y flipping (maybe global y can override it)
- if ((m_videoram[0x1ff00 / 2] >> 8) & 1) flipy = 0;
+ flipy = (layer_flip && !prohibit_flipy) ? !global_flip : global_flip;
}
/*************************************
@@ -705,7 +696,7 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la
//if (screen.machine().input().code_pressed(KEYCODE_X) && bgnum == 1) opaque = 1;
int flipx, flipy;
- // todo determine flipping
+ // determine flipping
compute_tilemap_flips(bgnum, flipx, flipy);
/* determine the clipping */
@@ -863,7 +854,7 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat
int flipx, flipy;
- // todo determine flipping
+ // determine flipping
compute_tilemap_flips(bgnum, flipx, flipy);
@@ -914,21 +905,24 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat
}
int srcy;
+ int ylookup;
if (!flipy)
{
srcy = yscroll + y;
+ ylookup = y;
}
else
{
const rectangle &visarea = screen.visible_area();
srcy = yscroll + visarea.max_y - y;
+ ylookup = visarea.max_y - y;
}
/* apply row scroll/select */
if (rowscroll)
- srcx += table[0x000 + 0x100 * (bgnum - 2) + y] & 0x3ff;
+ srcx += table[0x000 + 0x100 * (bgnum - 2) + ylookup] & 0x3ff;
if (rowselect)
- srcy = (yscroll + table[0x200 + 0x100 * (bgnum - 2) + y]) & 0x1ff;
+ srcy = (yscroll + table[0x200 + 0x100 * (bgnum - 2) + ylookup]) & 0x1ff;
/* look up the pages and get their source pixmaps */
@@ -996,7 +990,7 @@ void segas32_state::update_tilemap_text(screen_device &screen, segas32_state::la
bitmap_ind16 &bitmap = layer.bitmap;
/* determine if we're flipped */
- int flip = (m_videoram[0x1ff00/2] >> 9) & 1;
+ int flip = BIT(m_videoram[0x1ff00 / 2], 9);
/* determine the base of the tilemap and graphics data */
uint16_t const *const tilebase = &m_videoram[((m_videoram[0x1ff5c/2] >> 4) & 0x1f) * 0x800];