all repos — mgba @ 6fb8e296d4f62bc2387bddacb3ee43e92d2361d8

mGBA Game Boy Advance Emulator

GB Video: Fix sprite palettes
Jeffrey Pfau jeffrey@endrift.com
Fri, 22 Jan 2016 00:18:27 -0800
commit

6fb8e296d4f62bc2387bddacb3ee43e92d2361d8

parent

ff2641cbcc3bd592f7e9c602579deac0fcc3c9a8

1 files changed, 2 insertions(+), 1 deletions(-)

jump to
M src/gb/renderers/software.csrc/gb/renderers/software.c

@@ -256,6 +256,7 @@ int x = obj->x - 8;

if (x < 0) { x = 0; } + int p = GBObjAttributesGetPalette(obj->attr); for (; x < end; ++x) { int bottomX; if (GBObjAttributesIsXFlip(obj->attr)) {

@@ -270,7 +271,7 @@ tileDataUpper >>= bottomX;

tileDataLower >>= bottomX; color_t current = renderer->row[x]; if (((tileDataUpper | tileDataLower) & 1) && (!GBObjAttributesIsPriority(obj->attr) || current == GB_PALETTE[0])) { - renderer->row[x] = renderer->bgPalette[((tileDataUpper & 1) << 1) | (tileDataLower & 1)]; + renderer->row[x] = renderer->objPalette[p][((tileDataUpper & 1) << 1) | (tileDataLower & 1)]; } } }