From 3a2a2b6ba98d8805df2dde059f07026dcd972326 Mon Sep 17 00:00:00 2001 From: PokeCodec <67983839+PokeCodec@users.noreply.github.com> Date: Wed, 2 Sep 2020 17:43:21 -0400 Subject: [PATCH] Fix issues according to feedback --- include/constants/rgb.h | 6 +++--- src/frontier_util.c | 2 +- src/pokedex.c | 22 +++++++++++----------- src/pokenav_main_menu.c | 13 ++++++------- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/include/constants/rgb.h b/include/constants/rgb.h index 737ea76785..1896250d20 100644 --- a/include/constants/rgb.h +++ b/include/constants/rgb.h @@ -1,9 +1,9 @@ #ifndef GUARD_RGB_H #define GUARD_RGB_H -#define R(color) ((color) & 0x1F) -#define G(color) (((color) >> 5) & 0x1F) -#define B(color) (((color) >> 10) & 0x1F) +#define GET_R(color) ((color) & 0x1F) +#define GET_G(color) (((color) >> 5) & 0x1F) +#define GET_B(color) (((color) >> 10) & 0x1F) #define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10)) #define RGB2(r, g, b) (((b) << 10) | ((g) << 5) | (r)) diff --git a/src/frontier_util.c b/src/frontier_util.c index 38eaa37131..a36e2ec9f4 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -2513,7 +2513,7 @@ void CreateFrontierBrainPokemon(void) do { j = Random32(); //Should be one while loop, but that doesn't match - } while (IsShinyOtIdPersonality(FRONTIER_BRAIN_OTID, j)); //See above comment + } while (IsShinyOtIdPersonality(FRONTIER_BRAIN_OTID, j)); } while (sFrontierBrainsMons[facility][symbol][i].nature != GetNatureFromPersonality(j)); CreateMon(&gEnemyParty[monPartyId], sFrontierBrainsMons[facility][symbol][i].species, diff --git a/src/pokedex.c b/src/pokedex.c index 6146bcc056..c9fa2f6915 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -5238,20 +5238,20 @@ static void Task_ExitSearchWaitForFade(u8 taskId) void SetSearchRectHighlight(u8 flags, u8 x, u8 y, u8 width) { - u16 i, temp; //This would have been better as a pointer but here we are - u32 ptr = (u32)GetBgTilemapBuffer(3); //this should be a pointer, but this only matches as a u32. + u16 i, temp; //This would have been better as a pointer but here we are + u32 ptr = (u32)GetBgTilemapBuffer(3); //This should be a pointer, but this only matches as a u32. for (i = 0; i < width; i++) { - temp = *(u16 *)(ptr + (y+0)*64 + (x+i)*2); - temp &= 0x0fff; - temp |= (flags << 12); - *(u16 *)(ptr + (y+0)*64 + (x+i)*2) = temp; - - temp = *(u16 *)(ptr + (y+1)*64 + (x+i)*2); - temp &= 0x0fff; - temp |= (flags << 12); - *(u16 *)(ptr + (y+1)*64 + (x+i)*2) = temp; + temp = *(u16 *)(ptr + (y + 0) * 64 + (x + i) * 2); + temp &= 0x0fff; + temp |= (flags << 12); + *(u16 *)(ptr + (y + 0) * 64 + (x + i) * 2) = temp; + + temp = *(u16 *)(ptr + (y + 1) * 64 + (x + i) * 2); + temp &= 0x0fff; + temp |= (flags << 12); + *(u16 *)(ptr + (y + 1) * 64 + (x + i) * 2) = temp; } } diff --git a/src/pokenav_main_menu.c b/src/pokenav_main_menu.c index a2adebc27b..cdaa0b3d68 100644 --- a/src/pokenav_main_menu.c +++ b/src/pokenav_main_menu.c @@ -486,14 +486,13 @@ void sub_81C79BC(const u16 *a0, const u16 *a1, int a2, int a3, int a4, u16 *pale int r1, g1, b1; while (a2--) { + r = GET_R(*a0); + g = GET_G(*a0); + b = GET_B(*a0); - r = R(*a0); - g = G(*a0); - b = B(*a0); - - r1 = ((((R(*a1) << 8) - (r << 8)) / a3) * a4) >> 8; - g1 = ((((G(*a1) << 8) - (g << 8)) / a3) * a4) >> 8; - b1 = ((((B(*a1) << 8) - (b << 8)) / a3) * a4) >> 8; + r1 = ((((GET_R(*a1) << 8) - (r << 8)) / a3) * a4) >> 8; + g1 = ((((GET_G(*a1) << 8) - (g << 8)) / a3) * a4) >> 8; + b1 = ((((GET_B(*a1) << 8) - (b << 8)) / a3) * a4) >> 8; r = (r + r1) & 0x1F; //_RGB(r + r1, g + g1, b + b1); doesn't match; I have to assign the value of (r + r1 & 0x1F) g = (g + g1) & 0x1F; //See above