Merge pull request #1332 from sphericalice/use-rgb

Use RGB macros
This commit is contained in:
GriffinR 2021-02-14 17:45:14 -05:00 committed by GitHub
commit 17cfa9dc80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 9 deletions

View File

@ -967,8 +967,8 @@ void MultiplyPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b)
curBlue -= ((curBlue * b) >> 4);
color = curRed;
color |= curGreen << 5;
color |= curBlue << 10;
color |= (curGreen << 5);
color |= (curBlue << 10);
gPlttBufferFaded[i] = color;
}

View File

@ -494,7 +494,7 @@ static void ApplyGammaShift(u8 startPalIndex, u8 numPalettes, s8 gammaIndex)
r = gammaTable[baseColor.r];
g = gammaTable[baseColor.g];
b = gammaTable[baseColor.b];
gPlttBufferFaded[palOffset++] = (b << 10) | (g << 5) | r;
gPlttBufferFaded[palOffset++] = RGB2(r, g, b);
}
}
@ -579,7 +579,7 @@ static void ApplyGammaShiftWithBlend(u8 startPalIndex, u8 numPalettes, s8 gammaI
r += ((rBlend - r) * blendCoeff) >> 4;
g += ((gBlend - g) * blendCoeff) >> 4;
b += ((bBlend - b) * blendCoeff) >> 4;
gPlttBufferFaded[palOffset++] = (b << 10) | (g << 5) | r;
gPlttBufferFaded[palOffset++] = RGB2(r, g, b);
}
}
@ -636,7 +636,7 @@ static void ApplyDroughtGammaShiftWithBlend(s8 gammaIndex, u8 blendCoeff, u16 bl
g2 += ((gBlend - g2) * blendCoeff) >> 4;
b2 += ((bBlend - b2) * blendCoeff) >> 4;
gPlttBufferFaded[palOffset++] = (b2 << 10) | (g2 << 5) | r2;
gPlttBufferFaded[palOffset++] = RGB2(r2, g2, b2);
}
}
}
@ -678,7 +678,7 @@ static void ApplyFogBlend(u8 blendCoeff, u16 blendColor)
g += ((gBlend - g) * blendCoeff) >> 4;
b += ((bBlend - b) * blendCoeff) >> 4;
gPlttBufferFaded[palOffset] = (b << 10) | (g << 5) | r;
gPlttBufferFaded[palOffset] = RGB2(r, g, b);
palOffset++;
}
}

View File

@ -2,6 +2,7 @@
#include "util.h"
#include "sprite.h"
#include "palette.h"
#include "constants/rgb.h"
const u32 gBitTable[] =
{
@ -271,8 +272,8 @@ void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor)
s8 g = data1->g;
s8 b = data1->b;
struct PlttData *data2 = (struct PlttData *)&blendColor;
gPlttBufferFaded[index] = ((r + (((data2->r - r) * coeff) >> 4)) << 0)
| ((g + (((data2->g - g) * coeff) >> 4)) << 5)
| ((b + (((data2->b - b) * coeff) >> 4)) << 10);
gPlttBufferFaded[index] = RGB(r + (((data2->r - r) * coeff) >> 4),
g + (((data2->g - g) * coeff) >> 4),
b + (((data2->b - b) * coeff) >> 4));
}
}