summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/sega/segaybd_v.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/sega/segaybd_v.cpp')
-rw-r--r--src/mame/sega/segaybd_v.cpp72
1 files changed, 38 insertions, 34 deletions
diff --git a/src/mame/sega/segaybd_v.cpp b/src/mame/sega/segaybd_v.cpp
index a3894ec1619..a3a65a54d7b 100644
--- a/src/mame/sega/segaybd_v.cpp
+++ b/src/mame/sega/segaybd_v.cpp
@@ -48,46 +48,50 @@ uint32_t segaybd_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
// mix in 16B sprites
bitmap_ind16 &sprites = m_bsprites->bitmap();
- for (const sparse_dirty_rect *rect = m_bsprites->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
- {
- uint16_t *dest = &bitmap.pix(y);
- uint16_t *src = &sprites.pix(y);
- uint8_t *pri = &screen.priority().pix(y);
-
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ m_bsprites->iterate_dirty_rects(
+ cliprect,
+ [this, &screen, &bitmap, &sprites] (rectangle const &rect)
{
- // only process written pixels
- uint16_t pix = src[x];
- if (pix != 0xffff)
+ for (int y = rect.min_y; y <= rect.max_y; y++)
{
- // the 16b priority bits are stored like this
- // int colpri = ((data[4] & 0xff) << 4) | (((data[1] >> 9) & 0xf) << 12);
- // so PPPPppppppppcccc (P = priority p = palette c = colour data)
- // for Y board the (((data[1] >> 9) & 0xf) << 12) bit is the part we care about
+ uint16_t *const dest = &bitmap.pix(y);
+ uint16_t const *const src = &sprites.pix(y);
+ uint8_t const *const pri = &screen.priority().pix(y);
- // the format of the screen.priority() buffer (populated in rotate_draw) is
-
- // ccc----- Sprite color
- // ---rrrr- Sprite priority
- // -------1 'was Indirected color data' before rotate_draw, forced to 1 when filling pri buffer
-
- // compare sprite priority against tilemap priority
- int priority = (pix >> 11) & 0x1e;
-
- if (priority < (pri[x] & 0x1f))
+ for (int x = rect.min_x; x <= rect.max_x; x++)
{
- // if the color is set to maximum, shadow pixels underneath us
- if ((pix & 0xf) == 0xe)
- dest[x] += m_palette_entries;
-
- // otherwise, just add in sprite palette base
- else
- dest[x] = 0x800 | (pix & 0x7ff);
+ // only process written pixels
+ uint16_t const pix = src[x];
+ if (pix != 0xffff)
+ {
+ // the 16b priority bits are stored like this
+ // int colpri = ((data[4] & 0xff) << 4) | (((data[1] >> 9) & 0xf) << 12);
+ // so PPPPppppppppcccc (P = priority p = palette c = colour data)
+ // for Y board the (((data[1] >> 9) & 0xf) << 12) bit is the part we care about
+
+ // the format of the screen.priority() buffer (populated in rotate_draw) is
+
+ // ccc----- Sprite color
+ // ---rrrr- Sprite priority
+ // -------1 'was Indirected color data' before rotate_draw, forced to 1 when filling pri buffer
+
+ // compare sprite priority against tilemap priority
+ int const priority = (pix >> 11) & 0x1e;
+
+ if (priority < (pri[x] & 0x1f))
+ {
+ // if the color is set to maximum, shadow pixels underneath us
+ if ((pix & 0xf) == 0xe)
+ dest[x] += m_palette_entries;
+
+ // otherwise, just add in sprite palette base
+ else
+ dest[x] = 0x800 | (pix & 0x7ff);
+ }
+ }
}
}
- }
- }
+ });
return 0;