all repos — mgba @ a33e9d375ca1f3e2a918ab2c27962b37de530a8d

mGBA Game Boy Advance Emulator

GBA Video: Fix sprite priority regression (fixes #1419)
Vicki Pfau vi@endrift.com
Fri, 24 May 2019 20:48:36 -0700
commit

a33e9d375ca1f3e2a918ab2c27962b37de530a8d

parent

d1d33393cd5b854f66e2fff3714acdb4a9c737c6

M src/gba/renderers/software-obj.csrc/gba/renderers/software-obj.c

@@ -80,7 +80,7 @@ #define SPRITE_DRAW_PIXEL_16_NORMAL(localX) \

LOAD_16(tileData, ((yBase + charBase + xBase) & 0x7FFE), vramBase); \ tileData = (tileData >> ((localX & 3) << 2)) & 0xF; \ current = renderer->spriteLayer[outX]; \ - if ((current & FLAG_UNWRITTEN) == FLAG_UNWRITTEN && tileData) { \ + if ((current & FLAG_ORDER_MASK) > flags && tileData) { \ renderer->spriteLayer[outX] = palette[tileData] | flags; \ }

@@ -88,7 +88,7 @@ #define SPRITE_DRAW_PIXEL_16_NORMAL_OBJWIN(localX) \

LOAD_16(tileData, ((yBase + charBase + xBase) & 0x7FFE), vramBase); \ tileData = (tileData >> ((localX & 3) << 2)) & 0xF; \ current = renderer->spriteLayer[outX]; \ - if ((current & FLAG_UNWRITTEN) == FLAG_UNWRITTEN && tileData) { \ + if ((current & FLAG_ORDER_MASK) > flags && tileData) { \ unsigned color = (renderer->row[outX] & FLAG_OBJWIN) ? objwinPalette[tileData] : palette[tileData]; \ renderer->spriteLayer[outX] = color | flags; \ }

@@ -107,7 +107,7 @@ #define SPRITE_DRAW_PIXEL_256_NORMAL(localX) \

LOAD_16(tileData, ((yBase + charBase + xBase) & 0x7FFE), vramBase); \ tileData = (tileData >> ((localX & 1) << 3)) & 0xFF; \ current = renderer->spriteLayer[outX]; \ - if ((current & FLAG_UNWRITTEN) == FLAG_UNWRITTEN && tileData) { \ + if ((current & FLAG_ORDER_MASK) > flags && tileData) { \ renderer->spriteLayer[outX] = palette[tileData] | flags; \ }

@@ -115,7 +115,7 @@ #define SPRITE_DRAW_PIXEL_256_NORMAL_OBJWIN(localX) \

LOAD_16(tileData, ((yBase + charBase + xBase) & 0x7FFE), vramBase); \ tileData = (tileData >> ((localX & 1) << 3)) & 0xFF; \ current = renderer->spriteLayer[outX]; \ - if ((current & FLAG_UNWRITTEN) == FLAG_UNWRITTEN && tileData) { \ + if ((current & FLAG_ORDER_MASK) > flags && tileData) { \ unsigned color = (renderer->row[outX] & FLAG_OBJWIN) ? objwinPalette[tileData] : palette[tileData]; \ renderer->spriteLayer[outX] = color | flags; \ }