spinlbrk: fix for bug 02092

This commit is contained in:
Roberto Zandona 2008-11-21 06:18:15 +00:00
parent c522d198ac
commit d9301d2c2d

View File

@ -448,6 +448,81 @@ static void turbofrc_draw_sprites(running_machine *machine, bitmap_t *bitmap,con
}
}
static void spinlbrk_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int chip,int chip_disabled_pri)
{
int attr_start,base,first;
base = chip * 0x0200;
first = 4 * aerofgt_spriteram3[0x1fe + base];
for (attr_start = base + 0x0200-8;attr_start >= first + base;attr_start -= 4)
{
int map_start;
int ox,oy,x,y,xsize,ysize,zoomx,zoomy,flipx,flipy,color,pri;
// some other drivers still use this wrong table, they have to be upgraded
// int zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
if (!(aerofgt_spriteram3[attr_start + 2] & 0x0080)) continue;
pri = aerofgt_spriteram3[attr_start + 2] & 0x0010;
if ( chip_disabled_pri & !pri) continue;
if (!chip_disabled_pri & (pri>>4)) continue;
ox = aerofgt_spriteram3[attr_start + 1] & 0x01ff;
xsize = (aerofgt_spriteram3[attr_start + 2] & 0x0700) >> 8;
zoomx = (aerofgt_spriteram3[attr_start + 1] & 0xf000) >> 12;
oy = aerofgt_spriteram3[attr_start + 0] & 0x01ff;
ysize = (aerofgt_spriteram3[attr_start + 2] & 0x7000) >> 12;
zoomy = (aerofgt_spriteram3[attr_start + 0] & 0xf000) >> 12;
flipx = aerofgt_spriteram3[attr_start + 2] & 0x0800;
flipy = aerofgt_spriteram3[attr_start + 2] & 0x8000;
color = (aerofgt_spriteram3[attr_start + 2] & 0x000f) + 16 * spritepalettebank;
map_start = aerofgt_spriteram3[attr_start + 3];
// aerofgt has this adjustment, but doing it here would break turbo force title screen
// ox += (xsize*zoomx+2)/4;
// oy += (ysize*zoomy+2)/4;
zoomx = 32 - zoomx;
zoomy = 32 - zoomy;
for (y = 0;y <= ysize;y++)
{
int sx,sy;
if (flipy) sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16;
else sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16;
for (x = 0;x <= xsize;x++)
{
int code;
if (flipx) sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16;
else sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16;
if (chip == 0)
code = aerofgt_spriteram1[map_start % (aerofgt_spriteram1_size/2)];
else
code = aerofgt_spriteram2[map_start % (aerofgt_spriteram2_size/2)];
pdrawgfxzoom(bitmap,machine->gfx[sprite_gfx + chip],
code,
color,
flipx,flipy,
sx,sy,
cliprect,TRANSPARENCY_PEN,15,
zoomx << 11, zoomy << 11,
pri ? 2 : 0);
map_start++;
}
if (xsize == 2) map_start += 1;
if (xsize == 4) map_start += 3;
if (xsize == 5) map_start += 2;
if (xsize == 6) map_start += 1;
}
}
}
static void aerfboo2_draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int chip,int chip_disabled_pri)
{
int attr_start,base,first;
@ -639,7 +714,7 @@ static void aerfboot_draw_sprites(running_machine *machine, bitmap_t *bitmap,con
sx,sy,
cliprect,TRANSPARENCY_PEN,15,
zoomx << 11,zoomy << 11,
pri ? 0 : 0x2);
pri ? 0 : 2);
}
@ -677,7 +752,7 @@ static void aerfboot_draw_sprites(running_machine *machine, bitmap_t *bitmap,con
sx,sy,
cliprect,TRANSPARENCY_PEN,15,
zoomx << 11,zoomy << 11,
pri ? 0 : 0x2);
pri ? 0 : 2);
}
}
@ -811,13 +886,13 @@ VIDEO_UPDATE( spinlbrk )
fillbitmap(priority_bitmap,0,cliprect);
tilemap_draw(bitmap,cliprect,bg1_tilemap,0,0);
tilemap_draw(bitmap,cliprect,bg2_tilemap,0,0);
tilemap_draw(bitmap,cliprect,bg2_tilemap,0,1);
/* we use the priority buffer so sprites are drawn front to back */
turbofrc_draw_sprites(screen->machine,bitmap,cliprect,0,-1);
turbofrc_draw_sprites(screen->machine,bitmap,cliprect,0, 0);
turbofrc_draw_sprites(screen->machine,bitmap,cliprect,1, 0);
turbofrc_draw_sprites(screen->machine,bitmap,cliprect,1,-1);
spinlbrk_draw_sprites(screen->machine,bitmap,cliprect,0, 0);
spinlbrk_draw_sprites(screen->machine,bitmap,cliprect,0,-1);
spinlbrk_draw_sprites(screen->machine,bitmap,cliprect,1, 0);
spinlbrk_draw_sprites(screen->machine,bitmap,cliprect,1,-1);
return 0;
}