From 4803b8266110be147a29a15c48125bb4ad86e2bc Mon Sep 17 00:00:00 2001 From: arcadez2003 <51386955+arcadez2003@users.noreply.github.com> Date: Tue, 4 Aug 2020 22:38:35 +0100 Subject: [PATCH] Fix various graphical niggles for the video system games MAME WIP All games 0.98u3: Pierpaolo Prazzoli fixed wrap around issue with sprites in the Aerofgt driver. Karate Blazers 0.98u1: Pierpaolo Prazzoli fixed 2nd background priorities in Karate Blazers (see final 5th level). Spinal Breakers 0.128u4: Roberto Zandona fixed priority issues in Spinal Breakers. Turbo Force 0.109: Canim fixed some sprite priorities problems in Turbo Force (the problem is related with the final enemy in stage 3, which is moving along the level under the floor) --- src/vidhrdw/aerofgt_vidhrdw.c | 108 ++++++++++++++++++++++++++++++---- 1 file changed, 96 insertions(+), 12 deletions(-) diff --git a/src/vidhrdw/aerofgt_vidhrdw.c b/src/vidhrdw/aerofgt_vidhrdw.c index 13c328f2..641284fa 100644 --- a/src/vidhrdw/aerofgt_vidhrdw.c +++ b/src/vidhrdw/aerofgt_vidhrdw.c @@ -369,7 +369,7 @@ static void aerofgt_drawsprites(struct mame_bitmap *bitmap,const struct rectangl } } -static void turbofrc_drawsprites(struct mame_bitmap *bitmap,const struct rectangle *cliprect,int chip) +static void turbofrc_drawsprites(struct mame_bitmap *bitmap,const struct rectangle *cliprect,int chip, int chip_disabled_pri) { int attr_start,base,first; @@ -385,7 +385,9 @@ static void turbofrc_drawsprites(struct mame_bitmap *bitmap,const struct rectang /* 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; @@ -395,7 +397,7 @@ static void turbofrc_drawsprites(struct mame_bitmap *bitmap,const struct rectang flipx = aerofgt_spriteram3[attr_start + 2] & 0x0800; flipy = aerofgt_spriteram3[attr_start + 2] & 0x8000; color = (aerofgt_spriteram3[attr_start + 2] & 0x000f) + 16 * spritepalettebank; - pri = aerofgt_spriteram3[attr_start + 2] & 0x0010; + map_start = aerofgt_spriteram3[attr_start + 3]; /* aerofgt has this adjustment, but doing it here would break turbo force title screen*/ @@ -431,7 +433,7 @@ static void turbofrc_drawsprites(struct mame_bitmap *bitmap,const struct rectang sx,sy, cliprect,TRANSPARENCY_PEN,15, zoomx << 11,zoomy << 11, - pri ? 0 : 0x2); + pri ? 0 : 2); map_start++; } @@ -443,6 +445,81 @@ static void turbofrc_drawsprites(struct mame_bitmap *bitmap,const struct rectang } } +static void spinlbrk_draw_sprites(struct mame_bitmap *bitmap,const struct 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; + } + } +} VIDEO_UPDATE( pspikes ) { @@ -457,7 +534,8 @@ VIDEO_UPDATE( pspikes ) fillbitmap(priority_bitmap,0,cliprect); tilemap_draw(bitmap,cliprect,bg1_tilemap,0,0); - turbofrc_drawsprites(bitmap,cliprect,0); + turbofrc_drawsprites(bitmap,cliprect,0,-1); + turbofrc_drawsprites(bitmap,cliprect,0, 0); } VIDEO_UPDATE( karatblz ) @@ -473,8 +551,10 @@ VIDEO_UPDATE( karatblz ) tilemap_draw(bitmap,cliprect,bg2_tilemap,0,0); /* we use the priority buffer so sprites are drawn front to back */ - turbofrc_drawsprites(bitmap,cliprect,1); - turbofrc_drawsprites(bitmap,cliprect,0); + turbofrc_drawsprites(bitmap,cliprect,1,-1); + turbofrc_drawsprites(bitmap,cliprect,1, 0); + turbofrc_drawsprites(bitmap,cliprect,0,-1); + turbofrc_drawsprites(bitmap,cliprect,0, 0); } VIDEO_UPDATE( spinlbrk ) @@ -492,11 +572,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_drawsprites(bitmap,cliprect,0); - turbofrc_drawsprites(bitmap,cliprect,1); + spinlbrk_draw_sprites(bitmap,cliprect,0, 0); + spinlbrk_draw_sprites(bitmap,cliprect,0,-1); + spinlbrk_draw_sprites(bitmap,cliprect,1, 0); + spinlbrk_draw_sprites(bitmap,cliprect,1,-1); } VIDEO_UPDATE( turbofrc ) @@ -518,8 +600,10 @@ VIDEO_UPDATE( turbofrc ) tilemap_draw(bitmap,cliprect,bg2_tilemap,0,1); /* we use the priority buffer so sprites are drawn front to back */ - turbofrc_drawsprites(bitmap,cliprect,1); - turbofrc_drawsprites(bitmap,cliprect,0); + turbofrc_drawsprites(bitmap,cliprect,1,-1); /*ship*/ + turbofrc_drawsprites(bitmap,cliprect,1, 0); /*intro*/ + turbofrc_drawsprites(bitmap,cliprect,0,-1); /*enemy*/ + turbofrc_drawsprites(bitmap,cliprect,0, 0); /*enemy*/ } VIDEO_UPDATE( aerofgt )