mirror of
https://github.com/holub/mame
synced 2025-05-30 01:23:07 +03:00
sprite code cleanup, no emulation changes
This commit is contained in:
parent
cb63e55349
commit
05959788be
@ -319,8 +319,6 @@ VIDEO_START( ppan )
|
||||
tilemap_set_scrolldx(layer->wide_tmap, 2 * laynum - 256 + 11, -2 * laynum + 11 - 256);
|
||||
tilemap_set_scrolldy(layer->wide_tmap, -8, -8);
|
||||
}
|
||||
|
||||
machine.generic.buffered_spriteram.u16 = machine.generic.spriteram.u16; // sprite buffer control is never triggered
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -328,82 +326,71 @@ VIDEO_START( ppan )
|
||||
static void draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
{
|
||||
m92_state *state = machine.driver_data<m92_state>();
|
||||
UINT16 *buffered_spriteram16 = machine.generic.buffered_spriteram.u16;
|
||||
int offs,k;
|
||||
UINT16 *source = machine.generic.buffered_spriteram.u16;
|
||||
int offs, layer;
|
||||
|
||||
for (k=0; k<8; k++)
|
||||
for (layer = 0; layer < 8; layer++)
|
||||
{
|
||||
for (offs = 0; offs < state->m_sprite_list; )
|
||||
{
|
||||
int x,y,sprite,colour,fx,fy,x_multi,y_multi,i,j,s_ptr,pri_back,pri_sprite;
|
||||
int x = source[offs+3] & 0x1ff;
|
||||
int y = source[offs+0] & 0x1ff;
|
||||
int code = source[offs+1];
|
||||
int color = source[offs+2] & 0x007f;
|
||||
int pri = (~source[offs+2] >> 6) & 2;
|
||||
int curlayer = (source[offs+0] >> 13) & 7;
|
||||
int flipx = (source[offs+2] >> 8) & 1;
|
||||
int flipy = (source[offs+2] >> 9) & 1;
|
||||
int numcols = 1 << ((source[offs+0] >> 11) & 3);
|
||||
int numrows = 1 << ((source[offs+0] >> 9) & 3);
|
||||
int row, col, s_ptr;
|
||||
|
||||
y = buffered_spriteram16[offs+0] & 0x1ff;
|
||||
x = buffered_spriteram16[offs+3] & 0x1ff;
|
||||
offs += 4 * numcols;
|
||||
if (layer != curlayer) continue;
|
||||
|
||||
if (buffered_spriteram16[offs+2] & 0x0080) pri_back=0; else pri_back=2;
|
||||
|
||||
sprite= buffered_spriteram16[offs+1];
|
||||
colour = buffered_spriteram16[offs+2] & 0x007f;
|
||||
pri_sprite= (buffered_spriteram16[offs+0] & 0xe000) >> 13;
|
||||
|
||||
fx = (buffered_spriteram16[offs+2] >> 8) & 1;
|
||||
fy = (buffered_spriteram16[offs+2] >> 9) & 1;
|
||||
y_multi = (buffered_spriteram16[offs+0] >> 9) & 3;
|
||||
x_multi = (buffered_spriteram16[offs+0] >> 11) & 3;
|
||||
|
||||
y_multi = 1 << y_multi;
|
||||
x_multi = 1 << x_multi;
|
||||
|
||||
offs += 4 * x_multi;
|
||||
if (pri_sprite != k) continue;
|
||||
|
||||
x = x - 16;
|
||||
x = (x - 16) & 0x1ff;
|
||||
y = 384 - 16 - y;
|
||||
|
||||
if (fx) x+=16 * (x_multi - 1);
|
||||
if (flipx) x += 16 * (numcols - 1);
|
||||
|
||||
for (j=0; j<x_multi; j++)
|
||||
for (col = 0; col < numcols; col++)
|
||||
{
|
||||
s_ptr=8 * j;
|
||||
if (!fy) s_ptr+=y_multi-1;
|
||||
s_ptr = 8 * col;
|
||||
if (!flipy) s_ptr += numrows - 1;
|
||||
|
||||
x &= 0x1ff;
|
||||
for (i=0; i<y_multi; i++)
|
||||
for (row = 0; row < numrows; row++)
|
||||
{
|
||||
if (flip_screen_get(machine)) {
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
sprite + s_ptr,
|
||||
colour,
|
||||
!fx,!fy,
|
||||
464-x,240-(y-i*16),
|
||||
machine.priority_bitmap,pri_back,0);
|
||||
code + s_ptr, color, !flipx, !flipy,
|
||||
464 - x, 240 - (y - row * 16),
|
||||
machine.priority_bitmap, pri, 0);
|
||||
|
||||
// wrap around x
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
sprite + s_ptr,
|
||||
colour,
|
||||
!fx,!fy,
|
||||
464-x+512,240-(y-i*16),
|
||||
machine.priority_bitmap,pri_back,0);
|
||||
} else {
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
sprite + s_ptr,
|
||||
colour,
|
||||
fx,fy,
|
||||
x,y-i*16,
|
||||
machine.priority_bitmap,pri_back,0);
|
||||
|
||||
// wrap around x
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
sprite + s_ptr,
|
||||
colour,
|
||||
fx,fy,
|
||||
x-512,y-i*16,
|
||||
machine.priority_bitmap,pri_back,0);
|
||||
code + s_ptr, color, !flipx, !flipy,
|
||||
464 - x + 512, 240 - (y - row * 16),
|
||||
machine.priority_bitmap, pri, 0);
|
||||
}
|
||||
if (fy) s_ptr++; else s_ptr--;
|
||||
else
|
||||
{
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
code + s_ptr, color, flipx, flipy,
|
||||
x, y - row * 16,
|
||||
machine.priority_bitmap, pri, 0);
|
||||
|
||||
// wrap around x
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
code + s_ptr, color, flipx, flipy,
|
||||
x - 512, y - row * 16,
|
||||
machine.priority_bitmap, pri, 0);
|
||||
}
|
||||
if (flipy) s_ptr++;
|
||||
else s_ptr--;
|
||||
}
|
||||
if (fx) x-=16; else x+=16;
|
||||
if (flipx) x -= 16;
|
||||
else x += 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -413,85 +400,72 @@ static void draw_sprites(running_machine &machine, bitmap_t *bitmap, const recta
|
||||
static void ppan_draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
{
|
||||
m92_state *state = machine.driver_data<m92_state>();
|
||||
UINT16 *buffered_spriteram16 = machine.generic.buffered_spriteram.u16;
|
||||
int offs,k;
|
||||
UINT16 *source = machine.generic.spriteram.u16; // sprite buffer control is never triggered
|
||||
int offs, layer;
|
||||
|
||||
for (k=0; k<8; k++)
|
||||
for (layer = 0; layer < 8; layer++)
|
||||
{
|
||||
for (offs = 0; offs < state->m_sprite_list; )
|
||||
{
|
||||
int x,y,sprite,colour,fx,fy,x_multi,y_multi,i,j,s_ptr,pri_back,pri_sprite;
|
||||
int x = source[offs+3] & 0x1ff;
|
||||
int y = source[offs+0] & 0x1ff;
|
||||
int code = source[offs+1];
|
||||
int color = source[offs+2] & 0x007f;
|
||||
int pri = (~source[offs+2] >> 6) & 2;
|
||||
int curlayer = (source[offs+0] >> 13) & 7;
|
||||
int flipx = (source[offs+2] >> 8) & 1;
|
||||
int flipy = (source[offs+2] >> 9) & 1;
|
||||
int numcols = 1 << ((source[offs+0] >> 11) & 3);
|
||||
int numrows = 1 << ((source[offs+0] >> 9) & 3);
|
||||
int row, col, s_ptr;
|
||||
|
||||
y = buffered_spriteram16[offs+0] & 0x1ff;
|
||||
x = buffered_spriteram16[offs+3] & 0x1ff;
|
||||
offs += 4 * numcols;
|
||||
if (layer != curlayer) continue;
|
||||
|
||||
if (buffered_spriteram16[offs+2] & 0x0080) pri_back=0; else pri_back=2;
|
||||
|
||||
sprite= buffered_spriteram16[offs+1];
|
||||
colour = buffered_spriteram16[offs+2] & 0x007f;
|
||||
pri_sprite= (buffered_spriteram16[offs+0] & 0xe000) >> 13;
|
||||
|
||||
fx = (buffered_spriteram16[offs+2] >> 8) & 1;
|
||||
fy = (buffered_spriteram16[offs+2] >> 9) & 1;
|
||||
y_multi = (buffered_spriteram16[offs+0] >> 9) & 3;
|
||||
x_multi = (buffered_spriteram16[offs+0] >> 11) & 3;
|
||||
|
||||
y_multi = 1 << y_multi;
|
||||
x_multi = 1 << x_multi;
|
||||
|
||||
offs += 4 * x_multi;
|
||||
if (pri_sprite != k) continue;
|
||||
|
||||
x = x - 0;
|
||||
y = 384 - 16 - y - 7;
|
||||
|
||||
y -= 128;
|
||||
if (y < 0) y += 512;
|
||||
|
||||
if (fx) x+=16 * (x_multi - 1);
|
||||
if (flipx) x += 16 * (numcols - 1);
|
||||
|
||||
for (j=0; j<x_multi; j++)
|
||||
for (col = 0; col < numcols; col++)
|
||||
{
|
||||
s_ptr=8 * j;
|
||||
if (!fy) s_ptr+=y_multi-1;
|
||||
s_ptr = 8 * col;
|
||||
if (!flipy) s_ptr += numrows - 1;
|
||||
|
||||
x &= 0x1ff;
|
||||
for (i=0; i<y_multi; i++)
|
||||
for (row = 0; row < numrows; row++)
|
||||
{
|
||||
if (flip_screen_get(machine)) {
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
sprite + s_ptr,
|
||||
colour,
|
||||
!fx,!fy,
|
||||
464-x,240-(y-i*16),
|
||||
machine.priority_bitmap,pri_back,0);
|
||||
code + s_ptr, color, !flipx, !flipy,
|
||||
464 - x, 240 - (y - row * 16),
|
||||
machine.priority_bitmap, pri, 0);
|
||||
|
||||
// wrap around x
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
sprite + s_ptr,
|
||||
colour,
|
||||
!fx,!fy,
|
||||
464-x+512,240-(y-i*16),
|
||||
machine.priority_bitmap,pri_back,0);
|
||||
} else {
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
sprite + s_ptr,
|
||||
colour,
|
||||
fx,fy,
|
||||
x,y-i*16,
|
||||
machine.priority_bitmap,pri_back,0);
|
||||
|
||||
// wrap around x
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
sprite + s_ptr,
|
||||
colour,
|
||||
fx,fy,
|
||||
x-512,y-i*16,
|
||||
machine.priority_bitmap,pri_back,0);
|
||||
code + s_ptr, color, !flipx, !flipy,
|
||||
464 - x + 512, 240 - (y - row * 16),
|
||||
machine.priority_bitmap, pri, 0);
|
||||
}
|
||||
if (fy) s_ptr++; else s_ptr--;
|
||||
else
|
||||
{
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
code + s_ptr, color, flipx, flipy,
|
||||
x, y - row * 16,
|
||||
machine.priority_bitmap, pri, 0);
|
||||
|
||||
// wrap around x
|
||||
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
code + s_ptr, color, flipx, flipy,
|
||||
x - 512, y - row * 16,
|
||||
machine.priority_bitmap, pri, 0);
|
||||
}
|
||||
if (flipy) s_ptr++;
|
||||
else s_ptr--;
|
||||
}
|
||||
if (fx) x-=16; else x+=16;
|
||||
if (flipx) x -= 16;
|
||||
else x += 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user