From 2dfaba9472c933f5a659a38fa2581ecf3d3f0ef7 Mon Sep 17 00:00:00 2001 From: SphericalIce Date: Tue, 19 Jan 2021 17:59:36 +0000 Subject: [PATCH] Name color return values more accurately --- include/constants/rgb.h | 2 +- src/field_effect.c | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/constants/rgb.h b/include/constants/rgb.h index 6af947f603..be3049d3c7 100644 --- a/include/constants/rgb.h +++ b/include/constants/rgb.h @@ -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) diff --git a/src/field_effect.c b/src/field_effect.c index c74bb23be4..b1837c5141 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -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