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.cpp58
1 files changed, 30 insertions, 28 deletions
diff --git a/src/mame/sega/segas32_v.cpp b/src/mame/sega/segas32_v.cpp
index e6a9145de92..a5c79a9b6c0 100644
--- a/src/mame/sega/segas32_v.cpp
+++ b/src/mame/sega/segas32_v.cpp
@@ -535,28 +535,27 @@ int segas32_state::compute_clipping_extents(screen_device &screen, int enable, i
{
int flip = BIT(m_videoram[0x1ff00 / 2], 9);
rectangle tempclip;
- rectangle clips[5];
- int sorted[5];
- int i, j, y;
- /* expand our cliprect to exclude the bottom-right */
+ // expand our cliprect to exclude the bottom-right
tempclip = cliprect;
tempclip.max_x++;
tempclip.max_y++;
- /* create the 0th entry */
+ // create the 0th entry
list->extent[0][0] = tempclip.min_x;
list->extent[0][1] = tempclip.max_x;
- /* simple case if not enabled */
+ // simple case if not enabled
if (!enable)
{
memset(&list->scan_extent[tempclip.min_y], 0, sizeof(list->scan_extent[0]) * (tempclip.max_y - tempclip.min_y));
return 1;
}
- /* extract the from videoram into locals, and apply the cliprect */
- for (i = 0; i < 5; i++)
+ // extract the from videoram into locals, and apply the cliprect
+ rectangle clips[5];
+ int sorted[5];
+ for (int i = 0; i < 5; i++)
{
if (!flip)
{
@@ -578,52 +577,55 @@ int segas32_state::compute_clipping_extents(screen_device &screen, int enable, i
sorted[i] = i;
}
- /* bubble sort them by min_x */
- for (i = 0; i < 5; i++)
- for (j = i + 1; j < 5; j++)
+ // bubble sort them by min_x
+ for (int i = 0; i < 5; i++)
+ for (int j = i + 1; j < 5; j++)
if (clips[sorted[i]].min_x > clips[sorted[j]].min_x) { int temp = sorted[i]; sorted[i] = sorted[j]; sorted[j] = temp; }
- /* create all valid extent combinations */
- for (i = 1; i < 32; i++)
+ // create all valid extent combinations
+ for (int i = 1; i < 32; i++)
+ {
if (i & clipmask)
{
uint16_t *extent = &list->extent[i][0];
- /* start off with an entry at tempclip.min_x */
+ // start off with an entry at tempclip.min_x
*extent++ = tempclip.min_x;
- /* loop in sorted order over extents */
- for (j = 0; j < 5; j++)
+ // loop in sorted order over extents
+ for (int j = 0; j < 5; j++)
+ {
if (i & (1 << sorted[j]))
{
const rectangle &cur = clips[sorted[j]];
- /* see if this intersects our last extent */
+ // see if this intersects our last extent
if (extent != &list->extent[i][1] && cur.min_x <= extent[-1])
{
if (cur.max_x > extent[-1])
extent[-1] = cur.max_x;
}
-
- /* otherwise, just append to the list */
else
{
+ // otherwise, just append to the list
*extent++ = cur.min_x;
*extent++ = cur.max_x;
}
}
+ }
- /* append an ending entry */
+ // append an ending entry
*extent++ = tempclip.max_x;
}
+ }
- /* loop over scanlines and build extents */
- for (y = tempclip.min_y; y < tempclip.max_y; y++)
+ // loop over scanlines and build extents
+ for (int y = tempclip.min_y; y < tempclip.max_y; y++)
{
int sect = 0;
- /* figure out all the clips that intersect this scanline */
- for (i = 0; i < 5; i++)
+ // figure out all the clips that intersect this scanline
+ for (int i = 0; i < 5; i++)
if ((clipmask & (1 << i)) && y >= clips[i].min_y && y < clips[i].max_y)
sect |= 1 << i;
list->scan_extent[y] = sect;
@@ -636,11 +638,11 @@ 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 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);
+ const int global_flip = BIT(m_videoram[0x1ff00 / 2], 9);
+ const int layer_flip = BIT(m_videoram[0x1ff00 / 2], bgnum);
+ const int prohibit_flipy = BIT(m_videoram[0x1ff00 / 2], 8);
- flipx = (layer_flip) ? !global_flip : global_flip;
+ flipx = layer_flip ? !global_flip : global_flip;
flipy = (layer_flip && !prohibit_flipy) ? !global_flip : global_flip;
}