O2Hawk: sprite fix

This commit is contained in:
alyosha-tas 2020-02-16 16:42:31 -05:00
parent bfe7eee43f
commit 25d19cdb81
1 changed files with 92 additions and 50 deletions

View File

@ -436,7 +436,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
else
{
// special shifted cases
// since we are drawing one pixel at a time, we need to be careful that the next background / grid/ char pixel
// since we are drawing two pixels at a time, we need to be careful that the next background / grid / char pixel
// doesn't overwrite the shifted pixel on the next pass
if (((cycle - HBL_CNT) >= x_base) && ((cycle - HBL_CNT) < (x_base + 1 + 8 * (double_size / 2))))
{
@ -460,7 +460,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
if ((right_shift + right_shift_even) == 2)
{
Core._vidbuffer[LY * 372 + current_pixel_offset + 1 + right_shift + right_shift_even] = (int)Color_Palette_SPR[(Sprites[i * 4 + 2] >> 3) & 0x7];
Core._vidbuffer[LY * 372 + current_pixel_offset + 1] = (int)Color_Palette_SPR[(Sprites[i * 4 + 2] >> 3) & 0x7];
}
}
@ -538,6 +538,8 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
else
{
if ((((cycle - HBL_CNT) - x_base) >> 1) == 8)
{
if ((((cycle - HBL_CNT) - x_base) % 2) == 0)
{
offset_x = 7;
@ -548,17 +550,36 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
if (Core._settings.Show_Sprites)
{
Core._vidbuffer[LY * 372 + current_pixel_offset] = (int)Color_Palette_SPR[(Sprites[i * 4 + 2] >> 3) & 0x7];
if ((right_shift + right_shift_even) == 2)
{
Core._vidbuffer[LY * 372 + current_pixel_offset + 1 + right_shift + right_shift_even] = (int)Color_Palette_SPR[(Sprites[i * 4 + 2] >> 3) & 0x7];
Core._vidbuffer[LY * 372 + current_pixel_offset + 1] = (int)Color_Palette_SPR[(Sprites[i * 4 + 2] >> 3) & 0x7];
}
}
Pixel_Stat |= (byte)(1 << i);
}
}
}
else if ((((cycle - HBL_CNT) - x_base) >> 1) == 0)
{
if ((((cycle - HBL_CNT) - x_base) % 2) == 1)
{
offset_x = 0;
int pixel_pick = (Sprite_Shapes[i * 8 + offset_y] >> offset_x) & 1;
if (pixel_pick == 1)
{
if (Core._settings.Show_Sprites)
{
Core._vidbuffer[LY * 372 + current_pixel_offset] = (int)Color_Palette_SPR[(Sprites[i * 4 + 2] >> 3) & 0x7];
Core._vidbuffer[LY * 372 + current_pixel_offset + 1] = (int)Color_Palette_SPR[(Sprites[i * 4 + 2] >> 3) & 0x7];
}
Pixel_Stat |= (byte)(1 << i);
}
}
else
{
if ((right_shift + right_shift_even) < 2)
{
@ -577,6 +598,26 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
}
}
}
}
else
{
if ((((cycle - HBL_CNT) - x_base) % 2) == 1)
{
offset_x = (cycle - HBL_CNT - x_base) >> 1;
int pixel_pick = (Sprite_Shapes[i * 8 + offset_y] >> offset_x) & 1;
if (pixel_pick == 1)
{
if (Core._settings.Show_Sprites)
{
Core._vidbuffer[LY * 372 + current_pixel_offset] = (int)Color_Palette_SPR[(Sprites[i * 4 + 2] >> 3) & 0x7];
Core._vidbuffer[LY * 372 + current_pixel_offset + 1] = (int)Color_Palette_SPR[(Sprites[i * 4 + 2] >> 3) & 0x7];
}
Pixel_Stat |= (byte)(1 << i);
}
}
else
{
offset_x = (cycle - HBL_CNT - x_base) >> 1;
@ -630,6 +671,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
}
}
}
}
if (Pixel_Stat != 0)
{