summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2021-05-26 14:27:46 -0500
committer cracyc <cracyc@users.noreply.github.com>2021-05-26 14:27:46 -0500
commit330cda9259740495e823650f3c1f8f21266722e5 (patch)
treec1de7c69d47da8bbd4c5b0417beb7d7cf4964ba0
parentc7d7b25caa8e87841d8b5c9a30baab89cec7145e (diff)
fmtowns: clamp the sprites to the sprite coordinate space rather than the layer size
-rw-r--r--src/mame/video/fmtowns.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/mame/video/fmtowns.cpp b/src/mame/video/fmtowns.cpp
index 2235e03897c..d4471d2777a 100644
--- a/src/mame/video/fmtowns.cpp
+++ b/src/mame/video/fmtowns.cpp
@@ -761,14 +761,11 @@ void towns_state::render_sprite_4(uint32_t poffset, uint32_t coffset, uint16_t x
uint16_t xstart,xend,ystart,yend;
int linesize = m_video.towns_crtc_reg[24] * 4;
int xdir,ydir;
- int width = (m_video.towns_crtc_reg[12] - m_video.towns_crtc_reg[11]) / (((m_video.towns_crtc_reg[27] & 0x0f00) >> 8)+1);
- int height = (m_video.towns_crtc_reg[16] - m_video.towns_crtc_reg[15]) / (((m_video.towns_crtc_reg[27] & 0xf000) >> 12)+2);
if (rotation)
{
std::swap (x,y);
std::swap (xflip,yflip);
- std::swap (width,height);
}
if(xflip)
@@ -841,7 +838,7 @@ void towns_state::render_sprite_4(uint32_t poffset, uint32_t coffset, uint16_t x
voffset += linesize * (ypos & 0x1ff); // scanline size in bytes * y pos
voffset += (xpos & 0x1ff) * 2;
}
- if(voffset < 0x20000 && xpos < width && ypos < height && pixel != 0 && voffset > linesize)
+ if(voffset < 0x20000 && xpos < 256 && ypos < 256 && pixel != 0 && voffset > linesize)
{
m_towns_gfxvram[0x40000+voffset+vbase+1] = (col & 0xff00) >> 8;
m_towns_gfxvram[0x40000+voffset+vbase] = col & 0x00ff;
@@ -862,7 +859,7 @@ void towns_state::render_sprite_4(uint32_t poffset, uint32_t coffset, uint16_t x
pixel = m_towns_txtvram[poffset] & 0x0f;
col = (m_towns_txtvram[coffset+(pixel*2)] | (m_towns_txtvram[coffset+(pixel*2)+1] << 8)) & 0x7fff;
- if(voffset < 0x20000 && xpos < width && ypos < height && pixel != 0 && voffset > linesize)
+ if(voffset < 0x20000 && xpos < 256 && ypos < 256 && pixel != 0 && voffset > linesize)
{
m_towns_gfxvram[0x40000+voffset+vbase+1] = (col & 0xff00) >> 8;
m_towns_gfxvram[0x40000+voffset+vbase] = col & 0x00ff;
@@ -887,14 +884,11 @@ void towns_state::render_sprite_16(uint32_t poffset, uint16_t x, uint16_t y, boo
uint16_t xstart,ystart,xend,yend;
int linesize = m_video.towns_crtc_reg[24] * 4;
int xdir,ydir;
- int width = (m_video.towns_crtc_reg[12] - m_video.towns_crtc_reg[11]) / (((m_video.towns_crtc_reg[27] & 0x0f00) >> 8)+1);
- int height = (m_video.towns_crtc_reg[16] - m_video.towns_crtc_reg[15]) / (((m_video.towns_crtc_reg[27] & 0xf000) >> 12)+2);
if (rotation)
{
std::swap (x,y);
std::swap (xflip,yflip);
- std::swap (width,height);
}
if(xflip)
@@ -955,7 +949,7 @@ void towns_state::render_sprite_16(uint32_t poffset, uint16_t x, uint16_t y, boo
voffset += linesize * (ypos & 0x1ff); // scanline size in bytes * y pos
voffset += (xpos & 0x1ff) * 2;
}
- if(voffset < 0x20000 && xpos < width && ypos < height && col< 0x8000 && voffset > linesize)
+ if(voffset < 0x20000 && xpos < 256 && ypos < 256 && col< 0x8000 && voffset > linesize)
{
m_towns_gfxvram[0x40000+vbase+voffset+1] = (col & 0xff00) >> 8;
m_towns_gfxvram[0x40000+vbase+voffset] = col & 0x00ff;