mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2025-01-27 18:35:29 +01:00
[Core/VDP] improved Mode 5 sprite parsing accuracy (verified on real hardware)
This commit is contained in:
parent
331ec8b7cb
commit
8c91bdc05e
@ -3812,44 +3812,50 @@ void parse_satb_m5(int line)
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* Read Y position & size from internal SAT */
|
/* Read Y position from internal SAT cache */
|
||||||
ypos = (q[link] >> im2_flag) & 0x1FF;
|
ypos = (q[link] >> im2_flag) & 0x1FF;
|
||||||
size = q[link + 1] >> 8;
|
|
||||||
|
|
||||||
/* Sprite height */
|
/* Check if sprite Y position has been reached */
|
||||||
height = 8 + ((size & 3) << 3);
|
if (line >= ypos)
|
||||||
|
|
||||||
/* Y range */
|
|
||||||
ypos = line - ypos;
|
|
||||||
|
|
||||||
/* Sprite is visble on this line ? */
|
|
||||||
if ((ypos >= 0) && (ypos < height))
|
|
||||||
{
|
{
|
||||||
/* Sprite overflow */
|
/* Read sprite size from internal SAT cache */
|
||||||
if (count == max)
|
size = q[link + 1] >> 8;
|
||||||
|
|
||||||
|
/* Sprite height */
|
||||||
|
height = 8 + ((size & 3) << 3);
|
||||||
|
|
||||||
|
/* Y range */
|
||||||
|
ypos = line - ypos;
|
||||||
|
|
||||||
|
/* Check if sprite is visible on current line */
|
||||||
|
if (ypos < height)
|
||||||
{
|
{
|
||||||
status |= 0x40;
|
/* Sprite overflow */
|
||||||
break;
|
if (count == max)
|
||||||
|
{
|
||||||
|
status |= 0x40;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update sprite list (only name, attribute & xpos are parsed from VRAM) */
|
||||||
|
object_info->attr = p[link + 2];
|
||||||
|
object_info->xpos = p[link + 3] & 0x1ff;
|
||||||
|
object_info->ypos = ypos;
|
||||||
|
object_info->size = size & 0x0f;
|
||||||
|
|
||||||
|
/* Increment Sprite count */
|
||||||
|
++count;
|
||||||
|
|
||||||
|
/* Next sprite entry */
|
||||||
|
object_info++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update sprite list (only name, attribute & xpos are parsed from VRAM) */
|
|
||||||
object_info->attr = p[link + 2];
|
|
||||||
object_info->xpos = p[link + 3] & 0x1ff;
|
|
||||||
object_info->ypos = ypos;
|
|
||||||
object_info->size = size & 0x0f;
|
|
||||||
|
|
||||||
/* Increment Sprite count */
|
|
||||||
++count;
|
|
||||||
|
|
||||||
/* Next sprite entry */
|
|
||||||
object_info++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read link data from internal SAT */
|
/* Read link data from internal SAT cache */
|
||||||
link = (q[link + 1] & 0x7F) << 2;
|
link = (q[link + 1] & 0x7F) << 2;
|
||||||
|
|
||||||
/* Last sprite */
|
/* Stop parsing if link data points to first entry (#0) or after the last entry (#64 in H32 mode, #80 in H40 mode) */
|
||||||
if (link == 0) break;
|
if ((link == 0) || (link >= bitmap.viewport.w)) break;
|
||||||
}
|
}
|
||||||
while (--total);
|
while (--total);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user