mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
Merge pull request #6255 from cam900/twin16_clip
twin16.cpp : Restrict sprite drawing routine into screen cliprect
This commit is contained in:
commit
e2cc495dd7
@ -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();
|
||||
};
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user