mirror of
https://github.com/holub/mame
synced 2025-04-26 18:23:08 +03:00
Out Run: simpler sprite logic (#10420)
This commit is contained in:
parent
cab27c66bf
commit
d188072d81
@ -1154,56 +1154,47 @@ void sega_outrun_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &clip
|
|||||||
int xacc = 0;
|
int xacc = 0;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
// non-flipped case
|
data[7] = addr;
|
||||||
if (!flip)
|
for (x = xpos; (xdelta > 0 && x <= cliprect.max_x) || (xdelta < 0 && x >= cliprect.min_x);)
|
||||||
{
|
{
|
||||||
// start at the word before because we preincrement below
|
uint32_t pixels = spritedata[data[7]];
|
||||||
data[7] = addr - 1;
|
if (flip)
|
||||||
for (x = xpos; (xdelta > 0 && x <= cliprect.max_x) || (xdelta < 0 && x >= cliprect.min_x); )
|
|
||||||
{
|
{
|
||||||
uint32_t pixels = spritedata[++data[7]];
|
data[7]--;
|
||||||
|
|
||||||
// draw four pixels
|
|
||||||
int pix;
|
|
||||||
pix = (pixels >> 28) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
|
||||||
pix = (pixels >> 24) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
|
||||||
pix = (pixels >> 20) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
|
||||||
pix = (pixels >> 16) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
|
||||||
pix = (pixels >> 12) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
|
||||||
pix = (pixels >> 8) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
|
||||||
pix = (pixels >> 4) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
|
||||||
pix = (pixels >> 0) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
|
||||||
|
|
||||||
// stop if the second-to-last pixel in the group was 0xf
|
|
||||||
if ((pixels & 0x000000f0) == 0x000000f0)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
|
||||||
// flipped case
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// start at the word after because we predecrement below
|
|
||||||
data[7] = addr + 1;
|
|
||||||
for (x = xpos; (xdelta > 0 && x <= cliprect.max_x) || (xdelta < 0 && x >= cliprect.min_x); )
|
|
||||||
{
|
{
|
||||||
uint32_t pixels = spritedata[--data[7]];
|
data[7]++;
|
||||||
|
pixels =
|
||||||
// draw four pixels
|
(( pixels << 28) & 0xf0000000) |
|
||||||
int pix;
|
(( pixels << 20) & 0x0f000000) |
|
||||||
pix = (pixels >> 0) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
(( pixels << 12) & 0x00f00000) |
|
||||||
pix = (pixels >> 4) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
(( pixels << 4) & 0x000f0000) |
|
||||||
pix = (pixels >> 8) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
(( pixels >> 4) & 0x0000f000) |
|
||||||
pix = (pixels >> 12) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
(( pixels >> 12) & 0x00000f00) |
|
||||||
pix = (pixels >> 16) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
(( pixels >> 20) & 0x000000f0) |
|
||||||
pix = (pixels >> 20) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
(( pixels >> 28) & 0x0000000f);
|
||||||
pix = (pixels >> 24) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
|
||||||
pix = (pixels >> 28) & 0xf; while (xacc < 0x200) { if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15) dest[x] = colpri | pix; x += xdelta; xacc += hzoom; } xacc -= 0x200;
|
|
||||||
|
|
||||||
// stop if the second-to-last pixel in the group was 0xf
|
|
||||||
if ((pixels & 0x0f000000) == 0x0f000000)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
bool last_data = (pixels & 0x0f00'0000) == 0x0f00'0000;
|
||||||
|
|
||||||
|
// draw eight pixels
|
||||||
|
for (int k=0; k<8; k++)
|
||||||
|
{
|
||||||
|
int pix = pixels & 0xf;
|
||||||
|
while (xacc < 0x200)
|
||||||
|
{
|
||||||
|
if (x >= cliprect.min_x && x <= cliprect.max_x && pix != 0 && pix != 15)
|
||||||
|
dest[x] = colpri | pix;
|
||||||
|
x += xdelta;
|
||||||
|
xacc += hzoom;
|
||||||
|
}
|
||||||
|
xacc -= 0x200;
|
||||||
|
pixels>>=4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// stop if the second-to-last pixel in the group was 0xf
|
||||||
|
if (last_data)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update bounds
|
// update bounds
|
||||||
|
Loading…
Reference in New Issue
Block a user