From 42021db743e898b2fe73ffe193446775e88ef121 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Tue, 25 May 2021 21:55:24 -0400 Subject: [LEAK-INFORMED] literal dumbest fakematch ever --- src/pokemon_animation.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c index 14a17437c..e63862cd9 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -2604,9 +2604,9 @@ static void RotateUpSlamDown_0(struct Sprite *sprite) { TryFlipX(sprite); sprite->data[7]--; - sprite->pos2.x = Cos(sprite->data[7], sprite->data[6]) + sprite->data[6]; + sprite->pos2.x = sprite->data[6] + Cos(sprite->data[7], sprite->data[6]); - sprite->pos2.y = -(Sin(sprite->data[7], sprite->data[6] += 0)); // dummy += 0 is needed to match + sprite->pos2.y = -(Sin(sprite->data[7], sprite->data[6])); HandleSetAffineData(sprite, 256, 256, (sprite->data[7] - 128) << 8); if (sprite->data[7] <= 120) @@ -2634,9 +2634,9 @@ static void RotateUpSlamDown_2(struct Sprite *sprite) { TryFlipX(sprite); sprite->data[7] += 2; - sprite->pos2.x = Cos(sprite->data[7], sprite->data[6]) + sprite->data[6]; + sprite->pos2.x = sprite->data[6] + Cos(sprite->data[7], sprite->data[6]); - sprite->pos2.y = -(Sin(sprite->data[7], sprite->data[6] += 0)); // dummy += 0 is needed to match + sprite->pos2.y = -(Sin(sprite->data[7], sprite->data[6])); HandleSetAffineData(sprite, 256, 256, (sprite->data[7] - 128) << 8); if (sprite->data[7] >= 128) -- cgit v1.2.3 From 2705f2e5f44980f368d30845215e28ae5ea5c595 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Tue, 25 May 2021 22:13:31 -0400 Subject: [LEAK-INFORMED] also pretty dumb --- src/pokemon_animation.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c index e63862cd9..500916b0e 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -4066,16 +4066,15 @@ static void VerticalShakeLowTwice(struct Sprite *sprite) u8 var8 = sprite->data[2]; u8 var9 = sprite->data[6]; u8 var5 = sVerticalShakeData[sprite->data[5]][0]; - u8 var2 = var5; if (var5 != (u8)-1) var5 = sprite->data[7]; - else - var5 = (u8)-1; // needed to match var6 = sVerticalShakeData[sprite->data[5]][1]; var7 = 0; - if (var2 != (u8)-2) + if (sVerticalShakeData[sprite->data[5]][0] != (u8)-2) var7 = (var6 - var9) * var5 / var6; + else + var7 = 0; if (var5 == (u8)-1) { -- cgit v1.2.3 From 2bbaf71998337cba3c912143302f816b4116e851 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Mon, 31 May 2021 00:19:26 -0400 Subject: [LEAK-INFORMED] fix CreateShedinja fakematch info: the header change is required. accesses to the struct need to be treated as non-const, even though the array must be const. thanks to jiang for figuring this out. --- src/daycare.c | 2 ++ src/evolution_scene.c | 12 ++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/daycare.c b/src/daycare.c index 34b864981..14053217d 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -23,6 +23,8 @@ #include "constants/moves.h" #include "constants/region_map_sections.h" +extern struct Evolution gEvolutionTable[][EVOS_PER_MON]; + // this file's functions static void ClearDaycareMonMail(struct DaycareMail *mail); static void SetInitialEggData(struct Pokemon *mon, u16 species, struct DayCare *daycare); diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 39e917161..08f816f4f 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -34,6 +34,8 @@ #include "constants/rgb.h" #include "constants/items.h" +extern struct Evolution gEvolutionTable[][EVOS_PER_MON]; + struct EvoInfo { u8 preEvoSpriteId; @@ -550,8 +552,6 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) { s32 i; struct Pokemon* shedinja = &gPlayerParty[gPlayerPartyCount]; - const struct Evolution *evos; - const struct Evolution *evos2; CopyMon(&gPlayerParty[gPlayerPartyCount], mon, sizeof(struct Pokemon)); SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, &gEvolutionTable[preEvoSpecies][1].targetSpecies); @@ -572,12 +572,8 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) CalculateMonStats(&gPlayerParty[gPlayerPartyCount]); CalculatePlayerPartyCount(); - // can't match it otherwise, ehh - evos2 = gEvolutionTable[0]; - evos = evos2 + EVOS_PER_MON * preEvoSpecies; - - GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos[1].targetSpecies), FLAG_SET_SEEN); - GetSetPokedexFlag(SpeciesToNationalPokedexNum(evos[1].targetSpecies), FLAG_SET_CAUGHT); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gEvolutionTable[preEvoSpecies][1].targetSpecies), FLAG_SET_SEEN); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gEvolutionTable[preEvoSpecies][1].targetSpecies), FLAG_SET_CAUGHT); if (GetMonData(shedinja, MON_DATA_SPECIES) == SPECIES_SHEDINJA && GetMonData(shedinja, MON_DATA_LANGUAGE) == LANGUAGE_JAPANESE -- cgit v1.2.3 From 9f5bf65fb336cf7a3ba68d32267bf993f0f6a494 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Mon, 31 May 2021 19:01:20 -0400 Subject: [PROBABLY LEAK-INFORMED] fix battle_transition fakematch, make consistent use of SOME_VRAM_STORE --- src/battle_transition.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/battle_transition.c b/src/battle_transition.c index 479700e53..461c45e7d 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -1323,6 +1323,12 @@ static bool8 Phase2_BigPokeball_Func1(struct Task *task) return FALSE; } +#define SOME_VRAM_STORE(ptr, posY, posX, toStore) \ +{ \ + u32 index = (posY) * 32 + posX; \ + ptr[index] = toStore; \ +} + static bool8 Phase2_BigPokeball_Func2(struct Task *task) { s16 i, j; @@ -1335,7 +1341,7 @@ static bool8 Phase2_BigPokeball_Func2(struct Task *task) { for (j = 0; j < 30; j++, BigPokeballMap++) { - tilemap[i * 32 + j] = *BigPokeballMap | 0xF000; + SOME_VRAM_STORE(tilemap, i, j, *BigPokeballMap | 0xF000); } } sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); @@ -1675,12 +1681,6 @@ bool8 FldEff_Pokeball(void) return FALSE; } -#define SOME_VRAM_STORE(ptr, posY, posX, toStore) \ -{ \ - u32 index = (posY) * 32 + posX; \ - ptr[index] = toStore; \ -} - static void sub_814713C(struct Sprite *sprite) { s16 arr0[ARRAY_COUNT(sUnknown_085C8B96)]; @@ -2142,7 +2142,7 @@ static bool8 Phase2_Mugshot_Func2(struct Task *task) { for (j = 0; j < 32; j++, mugshotsMap++) { - tilemap[i * 32 + j] = *mugshotsMap | 0xF000; + SOME_VRAM_STORE(tilemap, i, j, *mugshotsMap | 0xF000); } } @@ -2960,17 +2960,15 @@ static bool8 Phase2_RectangularSpiral_Func2(struct Task *task) if (sub_8149048(gUnknown_085C8D38[j / 2], &sRectangularSpiralTransition[j])) { - u32 one; done = FALSE; var = sRectangularSpiralTransition[j].field_2; - one = 1; - if ((j & 1) == one) + if ((j % 2) == 1) var = 0x27D - var; var2 = var % 32; - var3 = var / 32 * 32; + var3 = var / 32; - tilemap[var3 + var2] = 0xF002; + SOME_VRAM_STORE(tilemap, var3, var2, 0xF002); } } } -- cgit v1.2.3 From 5c6b8ea8d67fb34b7f80b8856ee2d12caabff68f Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Tue, 1 Jun 2021 17:14:45 -0400 Subject: re-add const to gEvolutionTable in daycare.c --- src/daycare.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/daycare.c b/src/daycare.c index 14053217d..4199bfda6 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -23,7 +23,7 @@ #include "constants/moves.h" #include "constants/region_map_sections.h" -extern struct Evolution gEvolutionTable[][EVOS_PER_MON]; +extern const struct Evolution gEvolutionTable[][EVOS_PER_MON]; // this file's functions static void ClearDaycareMonMail(struct DaycareMail *mail); -- cgit v1.2.3 From 2fe7184d10ba183880fe6a6d09926f6286a96ace Mon Sep 17 00:00:00 2001 From: AJ Fontaine <36677462+Fontbane@users.noreply.github.com> Date: Fri, 4 Jun 2021 22:32:33 -0400 Subject: Rename sText_WildPkmnAppeared2 to reflect its use sText_WildPkmnAppeared2 is used for Legendary battles, so sText_LegendaryPkmnAppeared would be more informative. --- src/battle_message.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/battle_message.c b/src/battle_message.c index a30866410..7ef5fe321 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -383,7 +383,7 @@ static const u8 sText_ThrewPokeblockAtPkmn[] = _("{B_PLAYER_NAME} threw a {POKEB static const u8 sText_OutOfSafariBalls[] = _("{PLAY_SE SE_DING_DONG}ANNOUNCER: You're out of\nSAFARI BALLS! Game over!\p"); static const u8 sText_OpponentMon1Appeared[] = _("{B_OPPONENT_MON1_NAME} appeared!\p"); static const u8 sText_WildPkmnAppeared[] = _("Wild {B_OPPONENT_MON1_NAME} appeared!\p"); -static const u8 sText_WildPkmnAppeared2[] = _("Wild {B_OPPONENT_MON1_NAME} appeared!\p"); +static const u8 sText_LegendaryPkmnAppeared[] = _("Wild {B_OPPONENT_MON1_NAME} appeared!\p"); static const u8 sText_WildPkmnAppearedPause[] = _("Wild {B_OPPONENT_MON1_NAME} appeared!{PAUSE 127}"); static const u8 sText_TwoWildPkmnAppeared[] = _("Wild {B_OPPONENT_MON1_NAME} and\n{B_OPPONENT_MON2_NAME} appeared!\p"); static const u8 sText_Trainer1WantsToBattle[] = _("{B_TRAINER1_CLASS} {B_TRAINER1_NAME}\nwould like to battle!\p"); @@ -2125,7 +2125,7 @@ void BufferStringBattle(u16 stringID) else { if (gBattleTypeFlags & BATTLE_TYPE_LEGENDARY) - stringPtr = sText_WildPkmnAppeared2; + stringPtr = sText_LegendaryPkmnAppeared; else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) // interesting, looks like they had something planned for wild double battles stringPtr = sText_TwoWildPkmnAppeared; else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL) -- cgit v1.2.3 From 3ed06c2cc269c70c2d9a76bd4a063740de6688cd Mon Sep 17 00:00:00 2001 From: ExpoSeed <> Date: Thu, 10 Jun 2021 11:36:10 -0500 Subject: Remove remaining grey and replace with gray --- src/battle_anim_dark.c | 10 +++++----- src/battle_anim_effects_2.c | 16 ++++++++-------- src/battle_anim_mons.c | 2 +- src/battle_interface.c | 4 ++-- src/contest.c | 2 +- src/contest_util.c | 2 +- src/strings.c | 6 +++--- src/union_room_chat.c | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/battle_anim_dark.c b/src/battle_anim_dark.c index c2bfe269b..8000a648c 100644 --- a/src/battle_anim_dark.c +++ b/src/battle_anim_dark.c @@ -870,7 +870,7 @@ void AnimTask_MetallicShine(u8 taskId) paletteNum = 16 + gSprites[spriteId].oam.paletteNum; if (gBattleAnimArgs[1] == 0) - SetGreyscaleOrOriginalPalette(paletteNum, FALSE); + SetGrayscaleOrOriginalPalette(paletteNum, FALSE); else BlendPalette(paletteNum * 16, 16, 11, gBattleAnimArgs[2]); @@ -900,7 +900,7 @@ static void AnimTask_MetallicShine_Step(u8 taskId) spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER); paletteNum = 16 + gSprites[spriteId].oam.paletteNum; if (gTasks[taskId].data[1] == 0) - SetGreyscaleOrOriginalPalette(paletteNum, TRUE); + SetGrayscaleOrOriginalPalette(paletteNum, TRUE); DestroySprite(&gSprites[gTasks[taskId].data[0]]); GetBattleAnimBg1Data(&animBg); @@ -925,10 +925,10 @@ static void AnimTask_MetallicShine_Step(u8 taskId) } } -// Changes battler's palette to either greyscale or original. +// Changes battler's palette to either grayscale or original. // arg0: which battler // arg1: FALSE grayscale, TRUE original -void AnimTask_SetGreyscaleOrOriginalPal(u8 taskId) +void AnimTask_SetGrayscaleOrOriginalPal(u8 taskId) { u8 spriteId; u8 battler; @@ -974,7 +974,7 @@ void AnimTask_SetGreyscaleOrOriginalPal(u8 taskId) } if (spriteId != SPRITE_NONE) - SetGreyscaleOrOriginalPalette(gSprites[spriteId].oam.paletteNum + 16, gBattleAnimArgs[1]); + SetGrayscaleOrOriginalPalette(gSprites[spriteId].oam.paletteNum + 16, gBattleAnimArgs[1]); DestroyAnimVisualTask(taskId); } diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index 5dd584386..0ac5d384b 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -89,7 +89,7 @@ static void AnimPerishSongMusicNote_Step1(struct Sprite *); static void AnimPerishSongMusicNote_Step2(struct Sprite *); static void AnimGuardRing(struct Sprite *); static void AnimTask_Withdraw_Step(u8); -static void AnimTask_GrowAndGreyscale_Step(u8); +static void AnimTask_GrowAndGrayscale_Step(u8); static void AnimTask_Minimize_Step(u8); static void CreateMinimizeSprite(struct Task *, u8); static void ClonedMinizeSprite_Step(struct Sprite *); @@ -1996,26 +1996,26 @@ static void AnimGuillotinePincer_Step3(struct Sprite *sprite) DestroyAnimSprite(sprite); } -// Scales up the target mon sprite, and sets the palette to greyscale. +// Scales up the target mon sprite, and sets the palette to grayscale. // Used in MOVE_DISABLE. // No args. -void AnimTask_GrowAndGreyscale(u8 taskId) +void AnimTask_GrowAndGrayscale(u8 taskId) { u8 spriteId = GetAnimBattlerSpriteId(ANIM_TARGET); PrepareBattlerSpriteForRotScale(spriteId, ST_OAM_OBJ_BLEND); SetSpriteRotScale(spriteId, 0xD0, 0xD0, 0); - SetGreyscaleOrOriginalPalette(gSprites[spriteId].oam.paletteNum + 16, FALSE); + SetGrayscaleOrOriginalPalette(gSprites[spriteId].oam.paletteNum + 16, FALSE); gTasks[taskId].data[0] = 80; - gTasks[taskId].func = AnimTask_GrowAndGreyscale_Step; + gTasks[taskId].func = AnimTask_GrowAndGrayscale_Step; } -static void AnimTask_GrowAndGreyscale_Step(u8 taskId) +static void AnimTask_GrowAndGrayscale_Step(u8 taskId) { if (--gTasks[taskId].data[0] == -1) { u8 spriteId = GetAnimBattlerSpriteId(ANIM_TARGET); ResetSpriteRotScale(spriteId); - SetGreyscaleOrOriginalPalette(gSprites[spriteId].oam.paletteNum + 16, TRUE); + SetGrayscaleOrOriginalPalette(gSprites[spriteId].oam.paletteNum + 16, TRUE); DestroyAnimVisualTask(taskId); } } @@ -3710,7 +3710,7 @@ static void AnimPerishSongMusicNote2(struct Sprite *sprite) } if (++sprite->data[0] == sprite->data[1]) - SetGreyscaleOrOriginalPalette(sprite->oam.paletteNum + 16, 0); + SetGrayscaleOrOriginalPalette(sprite->oam.paletteNum + 16, 0); if (sprite->data[0] == sprite->data[1] + 80) DestroyAnimSprite(sprite); diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index 2082512ff..cf5ae6eb2 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -1310,7 +1310,7 @@ u16 ArcTan2Neg(s16 a, s16 b) return -var; } -void SetGreyscaleOrOriginalPalette(u16 paletteNum, bool8 restoreOriginalColor) +void SetGrayscaleOrOriginalPalette(u16 paletteNum, bool8 restoreOriginalColor) { int i; struct PlttData *originalColor; diff --git a/src/battle_interface.c b/src/battle_interface.c index ff376f6f1..50eb5373a 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -159,7 +159,7 @@ enum // strings extern const u8 gText_Slash[]; -extern const u8 gText_HighlightDarkGrey[]; +extern const u8 gText_HighlightDarkGray[]; extern const u8 gText_DynColor2[]; extern const u8 gText_DynColor2Male[]; extern const u8 gText_DynColor1Female[]; @@ -1895,7 +1895,7 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon) u16 species; u8 gender; - StringCopy(gDisplayedStringBattle, gText_HighlightDarkGrey); + StringCopy(gDisplayedStringBattle, gText_HighlightDarkGray); GetMonData(mon, MON_DATA_NICKNAME, nickname); StringGetEnd10(nickname); ptr = StringAppend(gDisplayedStringBattle, nickname); diff --git a/src/contest.c b/src/contest.c index dbbd6ef63..720bea180 100644 --- a/src/contest.c +++ b/src/contest.c @@ -1526,7 +1526,7 @@ static void Task_ShowMoveSelectScreen(u8 taskId) && eContestantStatus[gContestPlayerMonIndex].hasJudgesAttention) { // Highlight the text because it's a combo move - moveNameBuffer = StringCopy(moveName, gText_ColorLightShadowDarkGrey); + moveNameBuffer = StringCopy(moveName, gText_ColorLightShadowDarkGray); } else if (move != MOVE_NONE && eContestantStatus[gContestPlayerMonIndex].prevMove == move diff --git a/src/contest_util.c b/src/contest_util.c index decbded2c..88ab4a7d2 100644 --- a/src/contest_util.c +++ b/src/contest_util.c @@ -497,7 +497,7 @@ static void LoadContestMonName(u8 monIndex) struct ContestPokemon *mon = &gContestMons[monIndex]; u8 *str = gDisplayedStringBattle; if (monIndex == gContestPlayerMonIndex) - str = StringCopy(gDisplayedStringBattle, gText_ColorDarkGrey); + str = StringCopy(gDisplayedStringBattle, gText_ColorDarkGray); StringCopy(str, mon->nickname); AddContestTextPrinter(monIndex, gDisplayedStringBattle, 0); diff --git a/src/strings.c b/src/strings.c index 18cf31fb7..4987e32d2 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1229,7 +1229,7 @@ ALIGNED(4) const u8 gText_Facility[] = _("{STR_VAR_1}"); const u8 gText_Give[] = _("Give"); const u8 gText_NoNeed[] = _("No need"); -const u8 gText_ColorLightShadowDarkGrey[] = _("{COLOR LIGHT_GRAY}{SHADOW DARK_GRAY}"); +const u8 gText_ColorLightShadowDarkGray[] = _("{COLOR LIGHT_GRAY}{SHADOW DARK_GRAY}"); const u8 gText_ColorBlue[] = _("{COLOR BLUE}"); const u8 gText_ColorTransparent[] = _("{HIGHLIGHT TRANSPARENT}{COLOR TRANSPARENT}"); const u8 gText_CDot[] = _("C."); @@ -1239,9 +1239,9 @@ const u8 gText_PreliminaryResults[] = _("The preliminary results!"); const u8 gText_Round2Results[] = _("Round 2 results!"); const u8 gText_ContestantsMonWon[] = _("{STR_VAR_1}'s {STR_VAR_2} won!"); const u8 gText_CommunicationStandby[] = _("Communication standby…"); -const u8 gText_ColorDarkGrey[] = _("{COLOR DARK_GRAY}"); +const u8 gText_ColorDarkGray[] = _("{COLOR DARK_GRAY}"); const u8 gText_ColorDynamic6WhiteDynamic5[] = _("{COLOR_HIGHLIGHT_SHADOW DYNAMIC_COLOR6 WHITE DYNAMIC_COLOR5}"); // Unused -const u8 gText_HighlightDarkGrey[] = _("{HIGHLIGHT DARK_GRAY}"); +const u8 gText_HighlightDarkGray[] = _("{HIGHLIGHT DARK_GRAY}"); const u8 gText_EmptySpace2[] = _(" "); // Unused const u8 gText_DynColor2Male[] = _("{COLOR DYNAMIC_COLOR2}♂"); const u8 gText_DynColor1Female[] = _("{COLOR DYNAMIC_COLOR1}♀"); diff --git a/src/union_room_chat.c b/src/union_room_chat.c index fb875bbb4..8e9f78280 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -2984,7 +2984,7 @@ static void HideKeyboardSwapMenu(void) static void PrintChatMessage(u16 row, u8 *str, u8 colorIdx) { - // colorIdx: 0 = grey, 1 = red, 2 = green, 3 = blue + // colorIdx: 0 = gray, 1 = red, 2 = green, 3 = blue u8 color[3]; color[0] = TEXT_COLOR_WHITE; color[1] = colorIdx * 2 + 2; -- cgit v1.2.3 From b6b0062bd60eb57d66b6c79fc48bdbb55d8a5bf5 Mon Sep 17 00:00:00 2001 From: ExpoSeed <43502820+ExpoSeed@users.noreply.github.com> Date: Sun, 13 Jun 2021 16:32:00 -0500 Subject: Change map header flags to use a bitfield --- src/bike.c | 2 +- src/item_use.c | 2 +- src/overworld.c | 6 +++--- src/region_map.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/bike.c b/src/bike.c index 62ce3cd44..e97a5e04e 100644 --- a/src/bike.c +++ b/src/bike.c @@ -1053,7 +1053,7 @@ void Bike_HandleBumpySlopeJump(void) bool32 IsRunningDisallowed(u8 metatile) { - if (!(gMapHeader.flags & MAP_ALLOW_RUNNING) || IsRunningDisallowedByMetatile(metatile) == TRUE) + if (!gMapHeader.allowRunning || IsRunningDisallowedByMetatile(metatile) == TRUE) return TRUE; else return FALSE; diff --git a/src/item_use.c b/src/item_use.c index 19f50549e..c9087e929 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -910,7 +910,7 @@ static void ItemUseOnFieldCB_EscapeRope(u8 taskId) bool8 CanUseDigOrEscapeRopeOnCurMap(void) { - if (gMapHeader.flags & MAP_ALLOW_ESCAPING) + if (gMapHeader.allowEscaping) return TRUE; else return FALSE; diff --git a/src/overworld.c b/src/overworld.c index 600333a47..979ebb74c 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -962,7 +962,7 @@ static u16 GetCenterScreenMetatileBehavior(void) bool32 Overworld_IsBikingAllowed(void) { - if (!(gMapHeader.flags & MAP_ALLOW_CYCLING)) + if (!gMapHeader.allowCycling) return FALSE; else return TRUE; @@ -1687,7 +1687,7 @@ void CB2_ReturnToFieldFadeFromBlack(void) static void FieldCB_FadeTryShowMapPopup(void) { - if (SHOW_MAP_NAME_ENABLED && SecretBaseMapPopupEnabled() == TRUE) + if (gMapHeader.showMapName == TRUE && SecretBaseMapPopupEnabled() == TRUE) ShowMapNamePopup(); FieldCB_WarpExitFadeFromBlack(); } @@ -1933,7 +1933,7 @@ static bool32 LoadMapInStepsLocal(u8 *state, bool32 a2) (*state)++; break; case 11: - if (SHOW_MAP_NAME_ENABLED && SecretBaseMapPopupEnabled() == TRUE) + if (gMapHeader.showMapName == TRUE && SecretBaseMapPopupEnabled() == TRUE) ShowMapNamePopup(); (*state)++; break; diff --git a/src/region_map.c b/src/region_map.c index bec51ebf0..27e035199 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -1007,7 +1007,7 @@ static void InitMapBasedOnPlayerLocation(void) break; case MAP_TYPE_UNDERGROUND: case MAP_TYPE_UNKNOWN: - if (gMapHeader.flags & MAP_ALLOW_ESCAPING) + if (gMapHeader.allowEscaping) { mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->escapeWarp.mapGroup, gSaveBlock1Ptr->escapeWarp.mapNum); gRegionMap->mapSecId = mapHeader->regionMapSectionId; -- cgit v1.2.3 From d02be421bcc22bb3aea82c23a687120359a0b357 Mon Sep 17 00:00:00 2001 From: Sewef Date: Thu, 17 Jun 2021 14:06:40 +0200 Subject: Fix sATypeMove_Table definition --- src/battle_message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/battle_message.c b/src/battle_message.c index 7ef5fe321..ca87ced09 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1328,7 +1328,7 @@ static const u8 sText_SpaceIs[] = _(" is"); static const u8 sText_ApostropheS[] = _("'s"); // For displaying names of invalid moves -static const u8 sATypeMove_Table[][NUMBER_OF_MON_TYPES - 1] = +static const u8 sATypeMove_Table[NUMBER_OF_MON_TYPES][17 = { [TYPE_NORMAL] = _("a NORMAL move"), [TYPE_FIGHTING] = _("a FIGHTING move"), -- cgit v1.2.3 From fd55a0d0154242f155afd2981d64f3156d92d53d Mon Sep 17 00:00:00 2001 From: Sewef Date: Thu, 17 Jun 2021 14:12:06 +0200 Subject: Update src/battle_message.c Nothing happened. Co-authored-by: LOuroboros --- src/battle_message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/battle_message.c b/src/battle_message.c index ca87ced09..ae30a2a62 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1328,7 +1328,7 @@ static const u8 sText_SpaceIs[] = _(" is"); static const u8 sText_ApostropheS[] = _("'s"); // For displaying names of invalid moves -static const u8 sATypeMove_Table[NUMBER_OF_MON_TYPES][17 = +static const u8 sATypeMove_Table[NUMBER_OF_MON_TYPES][17] = { [TYPE_NORMAL] = _("a NORMAL move"), [TYPE_FIGHTING] = _("a FIGHTING move"), -- cgit v1.2.3 From 9407a1ac76c03a09a91e204b3d8d40843f43be3b Mon Sep 17 00:00:00 2001 From: ultima-soul <33333039+ultima-soul@users.noreply.github.com> Date: Fri, 18 Jun 2021 19:20:05 -0700 Subject: Replace hardcoded number in MakeCaptureStars. --- src/battle_anim_throw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c index 83768b476..4064e250c 100755 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -1420,7 +1420,7 @@ static void MakeCaptureStars(struct Sprite *sprite) LoadBallParticleGfx(BALL_MASTER); for (i = 0; i < ARRAY_COUNT(sCaptureStars); i++) { - u8 spriteId = CreateSprite(&sBallParticleSpriteTemplates[4], sprite->pos1.x, sprite->pos1.y, subpriority); + u8 spriteId = CreateSprite(&sBallParticleSpriteTemplates[BALL_MASTER], sprite->pos1.x, sprite->pos1.y, subpriority); if (spriteId != MAX_SPRITES) { gSprites[spriteId].sDuration = 24; -- cgit v1.2.3 From 810b51f96c9f2043a726b782a4884a06430192f2 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 21 Jun 2021 13:48:03 -0400 Subject: Clarify contest heart tiles --- src/contest.c | 27 +++++++++++++++------------ src/pokemon_summary_screen.c | 20 +++++++++++++------- 2 files changed, 28 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/contest.c b/src/contest.c index dbbd6ef63..920c3bdd7 100644 --- a/src/contest.c +++ b/src/contest.c @@ -258,6 +258,11 @@ enum { #define TAG_BLINK_EFFECT_CONTESTANT2 0x80EA #define TAG_BLINK_EFFECT_CONTESTANT3 0x80EB +#define TILE_FILLED_APPEAL_HEART 0x5012 +#define TILE_FILLED_JAM_HEART 0x5014 +#define TILE_EMPTY_APPEAL_HEART 0x5035 +#define TILE_EMPTY_JAM_HEART 0x5036 + enum { SLIDER_HEART_ANIM_NORMAL, SLIDER_HEART_ANIM_DISAPPEAR, @@ -3203,27 +3208,25 @@ static void PrintContestMoveDescription(u16 a) ContestBG_FillBoxWithIncrementingTile(0, categoryTile, 0x0b, 0x1f, 0x05, 0x01, 0x11, 0x01); ContestBG_FillBoxWithIncrementingTile(0, categoryTile + 0x10, 0x0b, 0x20, 0x05, 0x01, 0x11, 0x01); + // Appeal hearts if (gContestEffects[gContestMoves[a].effect].appeal == 0xFF) numHearts = 0; else numHearts = gContestEffects[gContestMoves[a].effect].appeal / 10; - if (numHearts > 8) - numHearts = 8; - // Filled-in hearts - ContestBG_FillBoxWithTile(0, 0x5035, 0x15, 0x1f, 0x08, 0x01, 0x11); - // Empty hearts - ContestBG_FillBoxWithTile(0, 0x5012, 0x15, 0x1f, numHearts, 0x01, 0x11); + if (numHearts > MAX_CONTEST_MOVE_HEARTS) + numHearts = MAX_CONTEST_MOVE_HEARTS; + ContestBG_FillBoxWithTile(0, TILE_EMPTY_APPEAL_HEART, 0x15, 0x1f, MAX_CONTEST_MOVE_HEARTS, 0x01, 0x11); + ContestBG_FillBoxWithTile(0, TILE_FILLED_APPEAL_HEART, 0x15, 0x1f, numHearts, 0x01, 0x11); + // Jam hearts if (gContestEffects[gContestMoves[a].effect].jam == 0xFF) numHearts = 0; else numHearts = gContestEffects[gContestMoves[a].effect].jam / 10; - if (numHearts > 8) - numHearts = 8; - // Filled-in hearts - ContestBG_FillBoxWithTile(0, 0x5036, 0x15, 0x20, 0x08, 0x01, 0x11); - // Empty hearts - ContestBG_FillBoxWithTile(0, 0x5014, 0x15, 0x20, numHearts, 0x01, 0x11); + if (numHearts > MAX_CONTEST_MOVE_HEARTS) + numHearts = MAX_CONTEST_MOVE_HEARTS; + ContestBG_FillBoxWithTile(0, TILE_EMPTY_JAM_HEART, 0x15, 0x20, MAX_CONTEST_MOVE_HEARTS, 0x01, 0x11); + ContestBG_FillBoxWithTile(0, TILE_FILLED_JAM_HEART, 0x15, 0x20, numHearts, 0x01, 0x11); FillWindowPixelBuffer(WIN_MOVE_DESCRIPTION, PIXEL_FILL(0)); Contest_PrintTextToBg0WindowStd(WIN_MOVE_DESCRIPTION, gContestEffectDescriptionPointers[gContestMoves[a].effect]); diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 8f16321b2..31505b7c9 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -119,6 +119,11 @@ enum SPRITE_ARR_ID_COUNT = SPRITE_ARR_ID_MOVE_SELECTOR2 + MOVE_SELECTOR_SPRITES_COUNT }; +#define TILE_EMPTY_APPEAL_HEART 0x1039 +#define TILE_FILLED_APPEAL_HEART 0x103A +#define TILE_FILLED_JAM_HEART 0x103C +#define TILE_EMPTY_JAM_HEART 0x103D + static EWRAM_DATA struct PokemonSummaryScreenData { /*0x00*/ union { @@ -2645,29 +2650,30 @@ static void DrawContestMoveHearts(u16 move) if (move != MOVE_NONE) { + // Draw appeal hearts u8 effectValue = gContestEffects[gContestMoves[move].effect].appeal; if (effectValue != 0xFF) effectValue /= 10; - for (i = 0; i < 8; i++) + for (i = 0; i < MAX_CONTEST_MOVE_HEARTS; i++) { if (effectValue != 0xFF && i < effectValue) - tilemap[(i / 4 * 32) + (i & 3) + 0x1E6] = 0x103A; + tilemap[(i / 4 * 32) + (i & 3) + 0x1E6] = TILE_FILLED_APPEAL_HEART; else - tilemap[(i / 4 * 32) + (i & 3) + 0x1E6] = 0x1039; + tilemap[(i / 4 * 32) + (i & 3) + 0x1E6] = TILE_EMPTY_APPEAL_HEART; } + // Draw jam hearts effectValue = gContestEffects[gContestMoves[move].effect].jam; - if (effectValue != 0xFF) effectValue /= 10; - for (i = 0; i < 8; i++) + for (i = 0; i < MAX_CONTEST_MOVE_HEARTS; i++) { if (effectValue != 0xFF && i < effectValue) - tilemap[(i / 4 * 32) + (i & 3) + 0x226] = 0x103C; + tilemap[(i / 4 * 32) + (i & 3) + 0x226] = TILE_FILLED_JAM_HEART; else - tilemap[(i / 4 * 32) + (i & 3) + 0x226] = 0x103D; + tilemap[(i / 4 * 32) + (i & 3) + 0x226] = TILE_EMPTY_JAM_HEART; } } } -- cgit v1.2.3 From 6d92b466e75164fb025909bdd74d5071d5bf646b Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 25 Jun 2021 11:50:09 -0400 Subject: Add missing use of F_TRAINER_FEMALE --- src/battle_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/battle_main.c b/src/battle_main.c index 001e2ec17..977bcbd9c 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -1961,10 +1961,10 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum, bool8 fir if (gTrainers[trainerNum].doubleBattle == TRUE) personalityValue = 0x80; - else if (gTrainers[trainerNum].encounterMusic_gender & 0x80) - personalityValue = 0x78; + else if (gTrainers[trainerNum].encounterMusic_gender & F_TRAINER_FEMALE) + personalityValue = 0x78; // Use personality more likely to result in a female Pokémon else - personalityValue = 0x88; + personalityValue = 0x88; // Use personality more likely to result in a male Pokémon for (j = 0; gTrainers[trainerNum].trainerName[j] != EOS; j++) nameHash += gTrainers[trainerNum].trainerName[j]; -- cgit v1.2.3 From d391c136d81630c1e8a914c3251b528568633eb0 Mon Sep 17 00:00:00 2001 From: garakmon Date: Sun, 27 Jun 2021 21:14:21 -0400 Subject: fix encounter slot logic to accomodate changes --- src/wild_encounter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 767fbe4e7..8bcb17605 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -162,7 +162,7 @@ static u8 ChooseWildMonIndex_Land(void) return 8; else if (rand >= ENCOUNTER_CHANCE_LAND_MONS_SLOT_8 && rand < ENCOUNTER_CHANCE_LAND_MONS_SLOT_9) return 9; - else if (rand == ENCOUNTER_CHANCE_LAND_MONS_SLOT_9) + else if (rand >= ENCOUNTER_CHANCE_LAND_MONS_SLOT_9 && rand < ENCOUNTER_CHANCE_LAND_MONS_SLOT_10) return 10; else return 11; @@ -215,7 +215,7 @@ static u8 ChooseWildMonIndex_Fishing(u8 rod) wildMonIndex = 7; if (rand >= ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_7 && rand < ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_8) wildMonIndex = 8; - if (rand == ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_8) + if (rand >= ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_8 && rand < ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_9) wildMonIndex = 9; break; } -- cgit v1.2.3 From 93188ef0a8aac4855903543c3b059285baccebc2 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 1 Jul 2021 00:18:52 -0400 Subject: Fix divide by 0 in Cmd_getexp --- src/battle_script_commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 15e44dd75..d927ffb76 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3269,7 +3269,7 @@ static void Cmd_getexp(void) if (viaExpShare) // at least one mon is getting exp via exp share { - *exp = calculatedExp / 2 / viaSentIn; + *exp = SAFE_DIV(calculatedExp / 2, viaSentIn); if (*exp == 0) *exp = 1; @@ -3279,7 +3279,7 @@ static void Cmd_getexp(void) } else { - *exp = calculatedExp / viaSentIn; + *exp = SAFE_DIV(calculatedExp, viaSentIn); if (*exp == 0) *exp = 1; gExpShareExp = 0; -- cgit v1.2.3