Use variant palette on sprites when target 1

This commit is contained in:
Jeffrey Pfau 2013-04-25 00:28:39 -07:00
parent e1932f2411
commit c8b2d2753e
1 changed files with 9 additions and 1 deletions

View File

@ -422,7 +422,11 @@ static void _drawSprite(struct GBAVideoSoftwareRenderer* renderer, struct GBAObj
uint16_t tileData = renderer->d.vram[(yBase + charBase + xBase) >> 1];
tileData = (tileData >> ((inX & 3) << 2)) & 0xF;
if (tileData) {
renderer->row[outX] = renderer->d.palette[0x100 | tileData | (sprite->palette << 4)];
if (!renderer->target1Obj) {
renderer->row[outX] = renderer->d.palette[0x100 | tileData | (sprite->palette << 4)];
} else {
renderer->row[outX] = renderer->variantPalette[0x100 | tileData | (sprite->palette << 4)];
}
renderer->flags[outX] = flags;
}
}
@ -437,6 +441,10 @@ static void _updatePalettes(struct GBAVideoSoftwareRenderer* renderer) {
for (int i = 0; i < 512; ++i) {
renderer->variantPalette[i] = _darken(renderer->d.palette[i], renderer->bldy);
}
} else {
for (int i = 0; i < 512; ++i) {
renderer->variantPalette[i] = renderer->d.palette[i];
}
}
}