static void DrvRenderSprites() { UINT8 *Source = DrvSpriteRam; UINT8 *Finish = Source + 96 * 4; while (Source < Finish) { int sy = 240 - Source[0]; if (sy >= 16) { int Attr = Source[1]; int sx = Source[3]; int Code = Source[2]; int SpriteBank = Attr & 0xf; int Colour = (Attr >> 4) & 0x3; int xFlip = Attr & 0x40; if (sx > 248) sx -= 256; sx -= 8; if (Attr & 0x80) { Code &= ~1; if (sx > 16 && sx < 224 && (sy + 16) > 0 && (sy + 16) < 224) { if (xFlip) { Render16x16Tile_Mask_FlipX(pTransDraw, Code + 1, sx, sy + 16, Colour, 3, 0, 128, DrvSprites + (SpriteBank * 0x100 * 16 * 16)); } else { Render16x16Tile_Mask(pTransDraw, Code + 1, sx, sy + 16, Colour, 3, 0, 128, DrvSprites + (SpriteBank * 0x100 * 16 * 16)); } } else { if (xFlip) { Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code + 1, sx, sy + 16, Colour, 3, 0, 128, DrvSprites + (SpriteBank * 0x100 * 16 * 16)); } else { Render16x16Tile_Mask_Clip(pTransDraw, Code + 1, sx, sy + 16, Colour, 3, 0, 128, DrvSprites + (SpriteBank * 0x100 * 16 * 16)); } } } else { sy += 16; } if (sx > 16 && sx < 224 && sy > 0 && sy < 224) { if (xFlip) { Render16x16Tile_Mask_FlipX(pTransDraw, Code, sx, sy, Colour, 3, 0, 128, DrvSprites + (SpriteBank * 0x100 * 16 * 16)); } else { Render16x16Tile_Mask(pTransDraw, Code, sx, sy, Colour, 3, 0, 128, DrvSprites + (SpriteBank * 0x100 * 16 * 16)); } } else { if (xFlip) { Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, sx, sy, Colour, 3, 0, 128, DrvSprites + (SpriteBank * 0x100 * 16 * 16)); } else { Render16x16Tile_Mask_Clip(pTransDraw, Code, sx, sy, Colour, 3, 0, 128, DrvSprites + (SpriteBank * 0x100 * 16 * 16)); } } } Source += 4; }
void PC090OJDrawSprites(unsigned char *pSrc) { UINT16 *VideoRam = (UINT16*)PC090OJRam; int PC090OJCtrl = VideoRam[0xdff]; int Offset; int SpriteColBank = (PC090OJSpriteCtrl & 0x0f) << 4; for (Offset = 0x400 - 4; Offset >= 0; Offset -= 4) { int xFlip, yFlip; int x, y; int Data, Code, Colour; Data = VideoRam[Offset + 0]; yFlip = (Data & 0x8000) >> 15; xFlip = (Data & 0x4000) >> 14; Colour = (Data & 0x000f) | SpriteColBank | PC090OJPaletteOffset; Code = VideoRam[Offset + 2] & 0x1fff; if (Code >= PC090OJNumTiles) { Code %= PC090OJNumTiles; // ok? Mod seems to work fine for bonze. } x = VideoRam[Offset + 3] & 0x1ff; y = VideoRam[Offset + 1] & 0x1ff; if (x > 0x140) x -= 0x200; if (y > 0x140) y -= 0x200; if (!(PC090OJCtrl & 1)) { x = 320 - x - 16; y = 256 - y - 16; xFlip = !xFlip; yFlip = !yFlip; } x -= PC090OJXOffset; y -= PC090OJYOffset; if (x > 16 && x < (nScreenWidth - 16) && y > 16 && y < (nScreenHeight - 16)) { if (xFlip) { if (yFlip) { Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc); } else { Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc); } } else { if (yFlip) { Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc); } else { Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc); } } } else { if (xFlip) { if (yFlip) { Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc); } else { Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc); } } else { if (yFlip) { Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc); } else { Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, pSrc); } } } } }