GBA Video: Fix highlighting for sprites with mid-frame palette changes

This commit is contained in:
Vicki Pfau 2022-05-29 18:46:34 -07:00
parent 81289cdb62
commit 511a12c507
2 changed files with 9 additions and 0 deletions

View File

@ -61,6 +61,7 @@ Misc:
- GBA Cheats: Implement "never" type codes (closes mgba.io/i/915) - GBA Cheats: Implement "never" type codes (closes mgba.io/i/915)
- GBA DMA: Enhanced logging (closes mgba.io/i/2454) - GBA DMA: Enhanced logging (closes mgba.io/i/2454)
- GBA Video: Implement layer placement for OpenGL renderer (fixes mgba.io/i/1962) - GBA Video: Implement layer placement for OpenGL renderer (fixes mgba.io/i/1962)
- GBA Video: Fix highlighting for sprites with mid-frame palette changes
- mGUI: Add margin to right-aligned menu text (fixes mgba.io/i/871) - mGUI: Add margin to right-aligned menu text (fixes mgba.io/i/871)
- mGUI: Autosave less frequently when fast-forwarding - mGUI: Autosave less frequently when fast-forwarding
- Qt: Rearrange menus some - Qt: Rearrange menus some

View File

@ -437,6 +437,14 @@ static void GBAVideoSoftwareRendererWritePalette(struct GBAVideoRenderer* render
} else if (softwareRenderer->blendEffect == BLEND_DARKEN) { } else if (softwareRenderer->blendEffect == BLEND_DARKEN) {
softwareRenderer->variantPalette[address >> 1] = _darken(color, softwareRenderer->bldy); softwareRenderer->variantPalette[address >> 1] = _darken(color, softwareRenderer->bldy);
} }
int highlightAmount = renderer->highlightAmount >> 4;
if (highlightAmount) {
softwareRenderer->highlightPalette[address >> 1] = mColorMix5Bit(0x10 - highlightAmount, softwareRenderer->normalPalette[address >> 1], highlightAmount, renderer->highlightColor);
softwareRenderer->highlightVariantPalette[address >> 1] = mColorMix5Bit(0x10 - highlightAmount, softwareRenderer->variantPalette[address >> 1], highlightAmount, renderer->highlightColor);
} else {
softwareRenderer->highlightPalette[address >> 1] = softwareRenderer->normalPalette[address >> 1];
softwareRenderer->highlightVariantPalette[address >> 1] = softwareRenderer->variantPalette[address >> 1];
}
if (renderer->cache) { if (renderer->cache) {
mCacheSetWritePalette(renderer->cache, address >> 1, color); mCacheSetWritePalette(renderer->cache, address >> 1, color);
} }