summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author R. Belmont <rb6502@users.noreply.github.com>2020-02-04 13:03:23 -0500
committer GitHub <noreply@github.com>2020-02-04 13:03:23 -0500
commite2cc495dd78745e860aa0d52c6d63c70740d6b48 (patch)
treea723a89df9914d92962cbfef75ddb599e105809d
parentab02b018ada1f5b0b39f4879991e14db2a874552 (diff)
parent2749fa1a8aaf57519d5766db0fa0e595184cab8f (diff)
Merge pull request #6255 from cam900/twin16_clip
twin16.cpp : Restrict sprite drawing routine into screen cliprect
-rw-r--r--src/mame/includes/twin16.h2
-rw-r--r--src/mame/video/twin16.cpp12
2 files changed, 7 insertions, 7 deletions
diff --git a/src/mame/includes/twin16.h b/src/mame/includes/twin16.h
index 2ebc77ae155..11e30772a8e 100644
--- a/src/mame/includes/twin16.h
+++ b/src/mame/includes/twin16.h
@@ -106,7 +106,7 @@ protected:
int set_sprite_timer();
void spriteram_process();
- void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap );
+ void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
int spriteram_process_enable();
void twin16_postload();
};
diff --git a/src/mame/video/twin16.cpp b/src/mame/video/twin16.cpp
index 0d3fd3b20f7..a5bf2e24fa7 100644
--- a/src/mame/video/twin16.cpp
+++ b/src/mame/video/twin16.cpp
@@ -260,7 +260,7 @@ void twin16_state::spriteram_process( )
m_need_process_spriteram = 0;
}
-void twin16_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap )
+void twin16_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
const uint16_t *source = 0x1800+m_spriteram->buffer() + 0x800 - 4;
const uint16_t *finish = 0x1800+m_spriteram->buffer();
@@ -331,14 +331,14 @@ void twin16_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap )
xpos = 320-xpos-width;
flipx = !flipx;
}
- if( xpos>=320 ) xpos -= 65536;
- if( ypos>=256 ) ypos -= 65536;
+ if( xpos>cliprect.max_x ) xpos -= 65536;
+ if( ypos>cliprect.max_y ) ypos -= 65536;
/* slow slow slow, but it's ok for now */
for( y=0; y<height; y++, pen_data += width/4 )
{
int sy = (flipy)?(ypos+height-1-y):(ypos+y);
- if( sy>=16 && sy<256-16 )
+ if( sy>=cliprect.min_y && sy<=cliprect.max_y )
{
uint16_t *dest = &bitmap.pix16(sy);
uint8_t *pdest = &screen.priority().pix8(sy);
@@ -346,7 +346,7 @@ void twin16_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap )
for( x=0; x<width; x++ )
{
int sx = (flipx)?(xpos+width-1-x):(xpos+x);
- if( sx>=0 && sx<320 )
+ if( sx>=cliprect.min_x && sx<=cliprect.max_x )
{
uint16_t pen = pen_data[x>>2]>>((~x&3)<<2)&0xf;
@@ -538,7 +538,7 @@ uint32_t twin16_state::screen_update_twin16(screen_device &screen, bitmap_ind16
break;
}
- draw_sprites( screen, bitmap );
+ draw_sprites( screen, bitmap, cliprect );
m_fixed_tmap->draw(screen, bitmap, cliprect, 0);
return 0;