summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-10-26 01:20:52 -0400
committer AJR <ajrhacker@users.noreply.github.com>2019-10-26 01:23:03 -0400
commitcc1d52e6fd7a95a49640c4f2a981ff3d90cd8ce8 (patch)
tree75df508459411a625c8fff6871d1f7f706dd3838
parent4798bcda894af27e45a228612ff86f6699bc1bd3 (diff)
tilemap.cpp: Relax assert and do some sanity checks (fixes mtrain and strain with DEBUG=1)
Note that opengolf is still broken, with a segmentation fault occurring at some point.
-rw-r--r--src/emu/tilemap.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/emu/tilemap.cpp b/src/emu/tilemap.cpp
index 44360a2a486..0957d25c4f0 100644
--- a/src/emu/tilemap.cpp
+++ b/src/emu/tilemap.cpp
@@ -999,10 +999,10 @@ void tilemap_t::draw_common(screen_device &screen, _BitmapClass &dest, const rec
g_profiler.start(PROFILER_TILEMAP_DRAW);
// configure the blit parameters based on the input parameters
- assert(dest.cliprect().contains(cliprect));
- assert(screen.cliprect().contains(cliprect));
blit_parameters blit;
configure_blit_parameters(blit, screen.priority(), cliprect, flags, priority, priority_mask);
+ assert(dest.cliprect().contains(cliprect));
+ assert(screen.cliprect().contains(cliprect) || blit.tilemap_priority_code == 0xff00);
// flush the dirty state to all tiles as appropriate
realize_all_dirty_tiles();
@@ -1136,10 +1136,10 @@ void tilemap_t::draw_roz_common(screen_device &screen, _BitmapClass &dest, const
g_profiler.start(PROFILER_TILEMAP_DRAW_ROZ);
// configure the blit parameters
- assert(dest.cliprect().contains(cliprect));
- assert(screen.cliprect().contains(cliprect));
blit_parameters blit;
configure_blit_parameters(blit, screen.priority(), cliprect, flags, priority, priority_mask);
+ assert(dest.cliprect().contains(cliprect));
+ assert(screen.cliprect().contains(cliprect) || blit.tilemap_priority_code == 0xff00);
// get the full pixmap for the tilemap
pixmap();
@@ -1355,7 +1355,7 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c
const int ymask = m_pixmap.height() - 1;
const int widthshifted = m_pixmap.width() << 16;
const int heightshifted = m_pixmap.height() << 16;
- u32 priority = blit.tilemap_priority_code;
+ const u32 priority = blit.tilemap_priority_code;
u8 mask = blit.mask;
u8 value = blit.value;
u8 alpha = blit.alpha;
@@ -1396,7 +1396,7 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c
u32 cy = starty >> 16;
// get source and priority pointers
- u8 *pri = &priority_bitmap.pix8(sy, sx);
+ u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix8(sy, sx) : nullptr;
const u16 *src = &m_pixmap.pix16(cy);
const u8 *maskptr = &m_flagsmap.pix8(cy);
typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx);
@@ -1408,14 +1408,16 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c
if ((maskptr[cx >> 16] & mask) == value)
{
ROZ_PLOT_PIXEL(src[cx >> 16]);
- *pri = (*pri & (priority >> 8)) | priority;
+ if (priority != 0xff00)
+ *pri = (*pri & (priority >> 8)) | priority;
}
// advance in X
cx += incxx;
x++;
++dest;
- pri++;
+ if (priority != 0xff00)
+ pri++;
}
}
@@ -1438,7 +1440,7 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c
// get dest and priority pointers
typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx);
- u8 *pri = &priority_bitmap.pix8(sy, sx);
+ u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix8(sy, sx) : nullptr;
// loop over columns
while (x <= ex)
@@ -1447,7 +1449,8 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c
if ((m_flagsmap.pix8((cy >> 16) & ymask, (cx >> 16) & xmask) & mask) == value)
{
ROZ_PLOT_PIXEL(m_pixmap.pix16((cy >> 16) & ymask, (cx >> 16) & xmask));
- *pri = (*pri & (priority >> 8)) | priority;
+ if (priority != 0xff00)
+ *pri = (*pri & (priority >> 8)) | priority;
}
// advance in X
@@ -1455,7 +1458,8 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c
cy += incxy;
x++;
++dest;
- pri++;
+ if (priority != 0xff00)
+ pri++;
}
// advance in Y
@@ -1478,7 +1482,7 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c
// get dest and priority pointers
typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx);
- u8 *pri = &priority_bitmap.pix8(sy, sx);
+ u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix8(sy, sx) : nullptr;
// loop over columns
while (x <= ex)
@@ -1488,7 +1492,8 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c
if ((m_flagsmap.pix8(cy >> 16, cx >> 16) & mask) == value)
{
ROZ_PLOT_PIXEL(m_pixmap.pix16(cy >> 16, cx >> 16));
- *pri = (*pri & (priority >> 8)) | priority;
+ if (priority != 0xff00)
+ *pri = (*pri & (priority >> 8)) | priority;
}
// advance in X
@@ -1496,7 +1501,8 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c
cy += incxy;
x++;
++dest;
- pri++;
+ if (priority != 0xff00)
+ pri++;
}
// advance in Y