fix tokyowar sprite problems

This commit is contained in:
Michaël Banaan Ananas 2011-10-01 21:46:20 +00:00
parent 8ba53b9808
commit 4f3fbef885
2 changed files with 72 additions and 67 deletions

View File

@ -4981,7 +4981,7 @@ static INPUT_PORTS_START( tokyowar )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_SERVICE( 0x08, IP_ACTIVE_LOW ) PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("View Change") PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) // also view-change function
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Right Trigger") PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Right Trigger")
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Left Trigger") PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Left Trigger")
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
@ -5746,7 +5746,7 @@ GAME( 1995, timecris, 0, namcos22s, timecris, timecris, ROT0, "Namco", "
GAME( 1995, timecrisa,timecris, namcos22s, timecris, timecris, ROT0, "Namco", "Time Crisis (Rev. TS2 Ver.A)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 96/01/08 18:56:09 GAME( 1995, timecrisa,timecris, namcos22s, timecris, timecris, ROT0, "Namco", "Time Crisis (Rev. TS2 Ver.A)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 96/01/08 18:56:09
GAME( 1996, propcycl, 0, namcos22s, propcycl, propcycl, ROT0, "Namco", "Prop Cycle (Rev. PR2 Ver.A)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 96/06/18 21:22:13 GAME( 1996, propcycl, 0, namcos22s, propcycl, propcycl, ROT0, "Namco", "Prop Cycle (Rev. PR2 Ver.A)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 96/06/18 21:22:13
GAME( 1996, alpinesa, 0, namcos22s, alpiner, alpinesa, ROT0, "Namco", "Alpine Surfer (Rev. AF2 Ver.A)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS|GAME_NOT_WORKING ) // 96/07/01 15:19:23. major gfx problems, slave dsp? GAME( 1996, alpinesa, 0, namcos22s, alpiner, alpinesa, ROT0, "Namco", "Alpine Surfer (Rev. AF2 Ver.A)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS|GAME_NOT_WORKING ) // 96/07/01 15:19:23. major gfx problems, slave dsp?
GAME( 1996, tokyowar, 0, namcos22s, tokyowar, tokyowar, ROT0, "Namco", "Tokyo Wars (Rev. TW2 Ver.A)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS|GAME_NOT_WORKING ) // 96/09/03 14:08:47. boots but missing sprite clear DMA? GAME( 1996, tokyowar, 0, namcos22s, tokyowar, tokyowar, ROT0, "Namco", "Tokyo Wars (Rev. TW2 Ver.A)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS|GAME_NOT_WORKING ) // 96/09/03 14:08:47. near-invincible tanks, maybe related to timecris helicopter bug?
GAME( 1996, aquajet, 0, namcos22s, aquajet, aquajet, ROT0, "Namco", "Aqua Jet (Rev. AJ2 Ver.B)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 96/09/20 14:28:30 GAME( 1996, aquajet, 0, namcos22s, aquajet, aquajet, ROT0, "Namco", "Aqua Jet (Rev. AJ2 Ver.B)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 96/09/20 14:28:30
GAME( 1996, alpinr2b, 0, namcos22s, alpiner, alpiner2, ROT0, "Namco", "Alpine Racer 2 (Rev. ARS2 Ver.B)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 97/01/10 17:10:59 GAME( 1996, alpinr2b, 0, namcos22s, alpiner, alpiner2, ROT0, "Namco", "Alpine Racer 2 (Rev. ARS2 Ver.B)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 97/01/10 17:10:59
GAME( 1996, alpinr2a, alpinr2b, namcos22s, alpiner, alpiner2, ROT0, "Namco", "Alpine Racer 2 (Rev. ARS2 Ver.A)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 96/12/06 13:45:05 GAME( 1996, alpinr2a, alpinr2b, namcos22s, alpiner, alpiner2, ROT0, "Namco", "Alpine Racer 2 (Rev. ARS2 Ver.A)" , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 96/12/06 13:45:05

View File

@ -12,7 +12,8 @@
* - spritelayer: * - spritelayer:
* + xy offset * + xy offset
* + clipping to window * + clipping to window
* + eliminate garbage (airco22b, tokyowar) * + priority above textlayer (used in at least timecris)
* + eliminate garbage (airco22b)
* *
* - lots of smaller issues * - lots of smaller issues
* *
@ -1260,10 +1261,11 @@ DrawSpritesHelper(
for( i=num_sprites; i>=0; i-- ) for( i=num_sprites; i>=0; i-- )
{ {
/* /* attrs:
----.-x--.----.----.----.----.----.---- hidden? ----.-x--.----.----.----.----.----.---- hidden?
----.--xx.----.----.----.----.----.---- ? ----.--xx.----.----.----.----.----.---- ?
----.----.xxxx.xxxx.xxxx.----.----.---- always 0xff0? ----.----.xxxx.xxxx.----.----.----.---- linktype?
----.----.----.----.xxxx.xx--.----.---- always 0?
----.----.----.----.----.--x-.----.---- right justify ----.----.----.----.----.--x-.----.---- right justify
----.----.----.----.----.---x.----.---- bottom justify ----.----.----.----.----.---x.----.---- bottom justify
----.----.----.----.----.----.x---.---- flipx ----.----.----.----.----.----.x---.---- flipx
@ -1287,7 +1289,7 @@ DrawSpritesHelper(
int zoomx = (1<<16)*sizex/0x20; int zoomx = (1<<16)*sizex/0x20;
int zoomy = (1<<16)*sizey/0x20; int zoomy = (1<<16)*sizey/0x20;
int flipy = attrs&0x8; int flipy = attrs&0x8;
int numrows = attrs&0x7; /* 0000 0001 1111 1111 0000 0000 fccc frrr */ int numrows = attrs&0x7;
int linkType = (attrs&0x00ff0000)>>16; int linkType = (attrs&0x00ff0000)>>16;
int flipx = (attrs>>4)&0x8; int flipx = (attrs>>4)&0x8;
int numcols = (attrs>>4)&0x7; int numcols = (attrs>>4)&0x7;
@ -1325,10 +1327,7 @@ DrawSpritesHelper(
//printf("[%02d]: tile %x pri %x color %x flipX %d flipY %d cols %d rows %d link %d X %d Y %d sX %d sY %d trans %d cz %d\n", //printf("[%02d]: tile %x pri %x color %x flipX %d flipY %d cols %d rows %d link %d X %d Y %d sX %d sY %d trans %d cz %d\n",
//i, tile, cz&0x80, color&0x7f, flipx, flipy, numcols, numrows, linkType, xpos, ypos, sizex, sizey, translucency, cz); //i, tile, cz&0x80, color&0x7f, flipx, flipy, numcols, numrows, linkType, xpos, ypos, sizex, sizey, translucency, cz);
if (color == 0) color = 0x67; // extreme hack for Tokyo Wars
node->data.sprite.tile = tile; node->data.sprite.tile = tile;
node->data.sprite.color = color;
node->data.sprite.flipx = flipx; node->data.sprite.flipx = flipx;
node->data.sprite.flipy = flipy; node->data.sprite.flipy = flipy;
node->data.sprite.numcols = numcols; node->data.sprite.numcols = numcols;
@ -1339,8 +1338,9 @@ DrawSpritesHelper(
node->data.sprite.sizex = sizex; node->data.sprite.sizex = sizex;
node->data.sprite.sizey = sizey; node->data.sprite.sizey = sizey;
node->data.sprite.translucency = translucency; node->data.sprite.translucency = translucency;
node->data.sprite.pri = 0; // ? (not cz&0x80, not color&0x80) node->data.sprite.color = color;
node->data.sprite.cz = cz; node->data.sprite.cz = cz;
node->data.sprite.pri = 0; // ? priority over textlayer (not cz&0x80 or color&0x80 or in attrs)
} }
} /* visible sprite */ } /* visible sprite */
pSource -= 4; pSource -= 4;
@ -1421,12 +1421,12 @@ DrawSprites( running_machine &machine, bitmap_t *bitmap, const rectangle *clipre
... ...
*/ */
UINT32 *spriteram32 = state->m_spriteram; UINT32 *spriteram32 = state->m_spriteram;
int num_sprites = ((spriteram32[0x04/4]>>16)&0x3ff)+1; int num_sprites;
const UINT32 *pSource = &spriteram32[0x4000/4]; const UINT32 *pSource;
const UINT32 *pPal = &spriteram32[0x20000/4]; const UINT32 *pPal;
int deltax = spriteram32[0x14/4]>>16; int deltax = spriteram32[0x14/4]>>16;
int deltay = spriteram32[0x18/4]>>16; int deltay = spriteram32[0x18/4]>>16;
int enable = spriteram32[0]>>16;
#if 1 #if 1
/* HACK for Tokyo Wars */ /* HACK for Tokyo Wars */
@ -1444,13 +1444,18 @@ DrawSprites( running_machine &machine, bitmap_t *bitmap, const rectangle *clipre
} }
#endif #endif
if( enable==6 ) int enable = spriteram32[0]>>16;
num_sprites = spriteram32[0x04/4]>>16 & 0x3ff;
num_sprites++; // alpinerd, propcycl, .. but garbage in airco22b
if( num_sprites > 0 && enable == 6 )
{ {
pSource = &spriteram32[0x04000/4];
pPal = &spriteram32[0x20000/4];
DrawSpritesHelper( machine, bitmap, cliprect, pSource, pPal, num_sprites, deltax, deltay ); DrawSpritesHelper( machine, bitmap, cliprect, pSource, pPal, num_sprites, deltax, deltay );
} }
/* VICS RAM provides two additional banks */ /* VICS RAM provides two additional banks */
/* /* (still many unknowns here)
0x940000 -x------ sprite chip busy 0x940000 -x------ sprite chip busy
0x940018 xxxx---- clr.w $940018.l 0x940018 xxxx---- clr.w $940018.l
@ -1463,21 +1468,21 @@ DrawSprites( running_machine &machine, bitmap_t *bitmap, const rectangle *clipre
0x940060..0x94007c set#2 0x940060..0x94007c set#2
*/ */
num_sprites = (state->m_vics_control[0x40/4]&0xffff)/0x10; num_sprites = state->m_vics_control[0x60/4] >> 4 & 0x1ff;
if( num_sprites>=1 ) if( num_sprites > 0 )
{
pSource = &state->m_vics_data[(state->m_vics_control[0x48/4]&0xffff)/4];
pPal = &state->m_vics_data[(state->m_vics_control[0x58/4]&0xffff)/4];
DrawSpritesHelper( machine, bitmap, cliprect, pSource, pPal, num_sprites, deltax, deltay );
}
num_sprites = (state->m_vics_control[0x60/4]&0xffff)/0x10;
if( num_sprites>=1 )
{ {
pSource = &state->m_vics_data[(state->m_vics_control[0x68/4]&0xffff)/4]; pSource = &state->m_vics_data[(state->m_vics_control[0x68/4]&0xffff)/4];
pPal = &state->m_vics_data[(state->m_vics_control[0x78/4]&0xffff)/4]; pPal = &state->m_vics_data[(state->m_vics_control[0x78/4]&0xffff)/4];
DrawSpritesHelper( machine, bitmap, cliprect, pSource, pPal, num_sprites, deltax, deltay ); DrawSpritesHelper( machine, bitmap, cliprect, pSource, pPal, num_sprites, deltax, deltay );
} }
num_sprites = state->m_vics_control[0x40/4] >> 4 & 0x1ff;
if( num_sprites > 0 )
{
pSource = &state->m_vics_data[(state->m_vics_control[0x48/4]&0xffff)/4];
pPal = &state->m_vics_data[(state->m_vics_control[0x58/4]&0xffff)/4];
DrawSpritesHelper( machine, bitmap, cliprect, pSource, pPal, num_sprites, deltax, deltay );
}
} /* DrawSprites */ } /* DrawSprites */
static void UpdatePalette(running_machine &machine) static void UpdatePalette(running_machine &machine)
@ -1602,9 +1607,8 @@ static void namcos22s_mix_textlayer( running_machine &machine, bitmap_t *bitmap,
for (x=0;x<640;x++) for (x=0;x<640;x++)
{ {
// skip if transparent or under poly/sprite // skip if transparent or under poly/sprite
if (!pri[x] || pri[x]&1) if (pri[x] == 2)
continue; {
rgbint rgb; rgbint rgb;
rgb_to_rgbint(&rgb, pens[src[x]]); rgb_to_rgbint(&rgb, pens[src[x]]);
@ -1627,6 +1631,7 @@ static void namcos22s_mix_textlayer( running_machine &machine, bitmap_t *bitmap,
} }
} }
} }
}
static void namcos22_mix_textlayer( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect ) static void namcos22_mix_textlayer( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect )
{ {
@ -1656,9 +1661,8 @@ static void namcos22_mix_textlayer( running_machine &machine, bitmap_t *bitmap,
for (x=0;x<640;x++) for (x=0;x<640;x++)
{ {
// skip if transparent or under poly/sprite // skip if transparent or under poly/sprite
if (!pri[x] || pri[x]&1) if (pri[x] == 2)
continue; {
// apply shadow // apply shadow
rgbint rgb; rgbint rgb;
switch (src[x] & 0xff) switch (src[x] & 0xff)
@ -1685,6 +1689,7 @@ static void namcos22_mix_textlayer( running_machine &machine, bitmap_t *bitmap,
} }
} }
} }
}
static void DrawCharacterLayer(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect ) static void DrawCharacterLayer(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect )
{ {