Skip to content

Commit

Permalink
Merge pull request #431 from Twanvanb1/main
Browse files Browse the repository at this point in the history
Fixed `SetPaletteFade` not functioning properly
  • Loading branch information
LittlePlanetCD authored May 28, 2024
2 parents 8def752 + 3c694d7 commit 62f1071
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions RSDKv4/Palette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void SetLimitedFade(byte paletteID, byte R, byte G, byte B, ushort blendAmount,
return;

uint blendA = 0xFF - blendAmount;
for (int i = startIndex; i < endIndex; ++i) {
for (int i = startIndex; i <= endIndex; ++i) {
PACK_RGB888(activePalette[i], (byte)((ushort)(R * blendAmount + blendA * activePalette32[i].r) >> 8),
(byte)((ushort)(G * blendAmount + blendA * activePalette32[i].g) >> 8),
(byte)((ushort)(B * blendAmount + blendA * activePalette32[i].b) >> 8));
Expand All @@ -96,7 +96,7 @@ void SetPaletteFade(byte destPaletteID, byte srcPaletteA, byte srcPaletteB, usho
uint blendA = 0xFF - blendAmount;
ushort *dst = &fullPalette[destPaletteID][startIndex];
PaletteEntry *dst32 = &fullPalette32[destPaletteID][startIndex];
for (int l = startIndex; l < endIndex; ++l) {
for (int l = startIndex; l <= endIndex; ++l) {
*dst = PACK_RGB888((byte)((ushort)(fullPalette32[srcPaletteB][l].r * blendAmount + blendA * fullPalette32[srcPaletteA][l].r) >> 8),
(byte)((ushort)(fullPalette32[srcPaletteB][l].g * blendAmount + blendA * fullPalette32[srcPaletteA][l].g) >> 8),
(byte)((ushort)(fullPalette32[srcPaletteB][l].b * blendAmount + blendA * fullPalette32[srcPaletteA][l].b) >> 8));
Expand Down

0 comments on commit 62f1071

Please sign in to comment.