Core/burn/drv/cave/cave_sprite.cpp
// Power Instinct 2 sprite format (no zooming)
Power Instinct 2 sprite format (no zooming)
Power Instinct 2 sprite format ( no zooming )
static INT32 CaveSpriteBuffer_PowerInstinct()
{
	UINT16* pSprite = (UINT16*)(CaveSpriteRAM + (nCaveSpriteBank << 14));
	CaveSprite* pBuffer = pSpriteList;
	INT32 nPriority;
	nFirstSprite[0] = 0x00010000;
	nFirstSprite[1] = 0x00010000;
	nFirstSprite[2] = 0x00010000;
	nFirstSprite[3] = 0x00010000;
	nLastSprite[0] = -1;
	nLastSprite[1] = -1;
	nLastSprite[2] = -1;
	nLastSprite[3] = -1;
	INT16 word;
	INT32 x, y, xs, ys;
	for (INT32 i = 0, z = 0; i < 0x0400; i++, pSprite += 8) {
		word = BURN_ENDIAN_SWAP_INT16(pSprite[4]);
		xs = (word >> 4) & 0x01F0;
		ys = (word << 4) & 0x01F0;
		if (ys == 0 || xs == 0) {
			continue;
		}
		x = (BURN_ENDIAN_SWAP_INT16(pSprite[2]) + nCaveExtraXOffset) & 0x03FF;
		if (x >= 320) {
			if (x + xs <= 0x0400) {
				continue;
			}
		}
		y = (BURN_ENDIAN_SWAP_INT16(pSprite[3]) + nCaveExtraYOffset) & 0x03FF;
		if (y >= 240) {
			if (y + ys <= 0x0400) {
				continue;
			}
		}
		word = BURN_ENDIAN_SWAP_INT16(pSprite[0]);
		nPriority = ((word >> 4) & 0x01) | 2;
		if (nLastSprite[nPriority] == -1) {
			nFirstSprite[nPriority] = z;
		}
		nLastSprite[nPriority] = z;
		pBuffer->priority = 8 >> nPriority;
		pBuffer->flip = (word >> 2) & 0x03;
		pBuffer->palette = ((word >> 4) & 0x03F0) + ((word << 5) & 0xC00);
		pBuffer->address = BURN_ENDIAN_SWAP_INT16(pSprite[1]) | ((word & 3) << 16);
		pBuffer->x = x;
		pBuffer->y = y;
		pBuffer->xsize = xs;
		pBuffer->ysize = ys;
		pBuffer++;
		z++;
	}
	return 0;
}
static INT32 CaveSpriteBuffer_PowerInstinct ( ) { UINT16 * pSprite = ( UINT16 * ) ( CaveSpriteRAM + ( nCaveSpriteBank << 14 ) ) ; CaveSprite * pBuffer = pSpriteList ; INT32 nPriority ; nFirstSprite [ 0 ] = 0x00010000 ; nFirstSprite [ 1 ] = 0x00010000 ; nFirstSprite [ 2 ] = 0x00010000 ; nFirstSprite [ 3 ] = 0x00010000 ; nLastSprite [ 0 ] = -1 ; nLastSprite [ 1 ] = -1 ; nLastSprite [ 2 ] = -1 ; nLastSprite [ 3 ] = -1 ; INT16 word ; INT32 x , y , xs , ys ; for ( INT32 i = 0 , z = 0 ; i < 0x0400 ; i ++ , pSprite += 8 ) { word = BURN_ENDIAN_SWAP_INT16 ( pSprite [ 4 ] ) ; xs = ( word >> 4 ) & 0x01F0 ; ys = ( word << 4 ) & 0x01F0 ; if ( ys == 0 || xs == 0 ) { continue ; } x = ( BURN_ENDIAN_SWAP_INT16 ( pSprite [ 2 ] ) + nCaveExtraXOffset ) & 0x03FF ; if ( x >= 320 ) { if ( x + xs <= 0x0400 ) { continue ; } } y = ( BURN_ENDIAN_SWAP_INT16 ( pSprite [ 3 ] ) + nCaveExtraYOffset ) & 0x03FF ; if ( y >= 240 ) { if ( y + ys <= 0x0400 ) { continue ; } } word = BURN_ENDIAN_SWAP_INT16 ( pSprite [ 0 ] ) ; nPriority = ( ( word >> 4 ) & 0x01 ) | 2 ; if ( nLastSprite [ nPriority ] == -1 ) { nFirstSprite [ nPriority ] = z ; } nLastSprite [ nPriority ] = z ; pBuffer -> priority = 8 >> nPriority ; pBuffer -> flip = ( word >> 2 ) & 0x03 ; pBuffer -> palette = ( ( word >> 4 ) & 0x03F0 ) + ( ( word << 5 ) & 0xC00 ) ; pBuffer -> address = BURN_ENDIAN_SWAP_INT16 ( pSprite [ 1 ] ) | ( ( word & 3 ) << 16 ) ; pBuffer -> x = x ; pBuffer -> y = y ; pBuffer -> xsize = xs ; pBuffer -> ysize = ys ; pBuffer ++ ; z ++ ; } return 0 ; }
Power Instinct 2 sprite format (no zooming)
Power Instinct 2 sprite format ( no zooming )
// Sprite is both active and onscreen, so add it to the buffer