mirror of https://github.com/pret/pokeemerald.git
Name color return values more accurately
This commit is contained in:
parent
8de76ed533
commit
2dfaba9472
|
@ -10,7 +10,7 @@
|
|||
#define _RGB(r, g, b) ((((b) & 0x1F) << 10) + (((g) & 0x1F) << 5) + ((r) & 0x1F))
|
||||
|
||||
#define RGB_ALPHA (1 << 15)
|
||||
#define IS_ALPHA(color) (color & RGB_ALPHA)
|
||||
#define IS_ALPHA(color) ((color) & RGB_ALPHA)
|
||||
|
||||
#define RGB_BLACK RGB(0, 0, 0)
|
||||
#define RGB_WHITE RGB(31, 31, 31)
|
||||
|
|
|
@ -935,42 +935,42 @@ void FreeResourcesAndDestroySprite(struct Sprite *sprite, u8 spriteId)
|
|||
void MultiplyInvertedPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b)
|
||||
{
|
||||
int curRed, curGreen, curBlue;
|
||||
u16 palette = gPlttBufferUnfaded[i];
|
||||
u16 color = gPlttBufferUnfaded[i];
|
||||
|
||||
curRed = (palette & RGB_RED);
|
||||
curGreen = (palette & RGB_GREEN) >> 5;
|
||||
curBlue = (palette & RGB_BLUE) >> 10;
|
||||
curRed = (color & RGB_RED);
|
||||
curGreen = (color & RGB_GREEN) >> 5;
|
||||
curBlue = (color & RGB_BLUE) >> 10;
|
||||
|
||||
curRed += (((0x1F - curRed) * r) >> 4);
|
||||
curGreen += (((0x1F - curGreen) * g) >> 4);
|
||||
curBlue += (((0x1F - curBlue) * b) >> 4);
|
||||
|
||||
palette = curRed;
|
||||
palette |= (curGreen << 5);
|
||||
palette |= (curBlue << 10);
|
||||
color = curRed;
|
||||
color |= (curGreen << 5);
|
||||
color |= (curBlue << 10);
|
||||
|
||||
gPlttBufferFaded[i] = palette;
|
||||
gPlttBufferFaded[i] = color;
|
||||
}
|
||||
|
||||
// r, g, b are between 0 and 16
|
||||
void MultiplyPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b)
|
||||
{
|
||||
int curRed, curGreen, curBlue;
|
||||
u16 palette = gPlttBufferUnfaded[i];
|
||||
u16 color = gPlttBufferUnfaded[i];
|
||||
|
||||
curRed = (palette & RGB_RED);
|
||||
curGreen = (palette & RGB_GREEN) >> 5;
|
||||
curBlue = (palette & RGB_BLUE) >> 10;
|
||||
curRed = (color & RGB_RED);
|
||||
curGreen = (color & RGB_GREEN) >> 5;
|
||||
curBlue = (color & RGB_BLUE) >> 10;
|
||||
|
||||
curRed -= ((curRed * r) >> 4);
|
||||
curGreen -= ((curGreen * g) >> 4);
|
||||
curBlue -= ((curBlue * b) >> 4);
|
||||
|
||||
palette = curRed;
|
||||
palette |= curGreen << 5;
|
||||
palette |= curBlue << 10;
|
||||
color = curRed;
|
||||
color |= curGreen << 5;
|
||||
color |= curBlue << 10;
|
||||
|
||||
gPlttBufferFaded[i] = palette;
|
||||
gPlttBufferFaded[i] = color;
|
||||
}
|
||||
|
||||
// Task data for Task_PokecenterHeal and Task_HallOfFameRecord
|
||||
|
|
Loading…
Reference in New Issue