From 18319e8da3a2fec83bd2ff5112bd8a924da86a3e Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 10 Aug 2023 01:21:38 -0400 Subject: [PATCH] Misc missing constant use --- include/constants/contest.h | 2 + src/battle_ai_script_commands.c | 16 +-- src/battle_ai_switch_items.c | 8 +- src/battle_script_commands.c | 9 ++ src/battle_util.c | 6 +- src/berry_tag_screen.c | 88 +++++++------ src/cable_club.c | 2 +- src/contest.c | 22 ++-- src/contest_ai.c | 10 +- src/contest_effect.c | 28 ++--- src/contest_util.c | 10 +- src/data/contest_opponents.h | 211 ++++++++++++++++---------------- src/decoration.c | 11 +- src/dewford_trend.c | 2 +- src/ereader_helpers.c | 4 +- src/field_specials.c | 19 ++- src/librfu_rfu.c | 10 +- src/link_rfu_2.c | 3 +- src/main_menu.c | 3 +- src/palette.c | 2 +- src/region_map.c | 2 +- src/secret_base.c | 4 +- 22 files changed, 254 insertions(+), 218 deletions(-) diff --git a/include/constants/contest.h b/include/constants/contest.h index 775dcbe62..905306203 100644 --- a/include/constants/contest.h +++ b/include/constants/contest.h @@ -6,6 +6,8 @@ #define CONTEST_LAST_APPEAL (CONTEST_NUM_APPEALS - 1) #define MAX_CONTEST_MOVE_HEARTS 8 +#define CONTESTANT_NONE 0xFF + #define LINK_CONTEST_FLAG_IS_LINK (1 << 0) #define LINK_CONTEST_FLAG_IS_WIRELESS (1 << 1) #define LINK_CONTEST_FLAG_HAS_RS_PLAYER (1 << 2) diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 2152be374..b2c900b42 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -13,16 +13,13 @@ #include "constants/abilities.h" #include "constants/battle_ai.h" #include "constants/battle_move_effects.h" +#include "constants/items.h" #include "constants/moves.h" -#define AI_ACTION_DONE 0x0001 -#define AI_ACTION_FLEE 0x0002 -#define AI_ACTION_WATCH 0x0004 -#define AI_ACTION_DO_NOT_ATTACK 0x0008 -#define AI_ACTION_UNK5 0x0010 -#define AI_ACTION_UNK6 0x0020 -#define AI_ACTION_UNK7 0x0040 -#define AI_ACTION_UNK8 0x0080 +#define AI_ACTION_DONE (1 << 0) +#define AI_ACTION_FLEE (1 << 1) +#define AI_ACTION_WATCH (1 << 2) +#define AI_ACTION_DO_NOT_ATTACK (1 << 3) #define AI_THINKING_STRUCT ((struct AI_ThinkingStruct *)(gBattleResources->ai)) #define BATTLE_HISTORY ((struct BattleHistory *)(gBattleResources->battleHistory)) @@ -283,7 +280,6 @@ static const u16 sIgnoredPowerfulMoveEffects[] = IGNORED_MOVES_END }; -// code void BattleAI_HandleItemUseBeforeAISetup(u8 defaultScoreMoves) { s32 i; @@ -302,7 +298,7 @@ void BattleAI_HandleItemUseBeforeAISetup(u8 defaultScoreMoves) { for (i = 0; i < MAX_TRAINER_ITEMS; i++) { - if (gTrainers[gTrainerBattleOpponent_A].items[i] != 0) + if (gTrainers[gTrainerBattleOpponent_A].items[i] != ITEM_NONE) { BATTLE_HISTORY->trainerItems[BATTLE_HISTORY->itemsNo] = gTrainers[gTrainerBattleOpponent_A].items[i]; BATTLE_HISTORY->itemsNo++; diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 5789a3ff6..06cdd6c82 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -687,7 +687,7 @@ u8 GetMostSuitableMonToSwitchInto(void) invalidMons = 0; - while (invalidMons != 0x3F) // All mons are invalid. + while (invalidMons != (1 << PARTY_SIZE) - 1) // All mons are invalid. { bestDmg = TYPE_MUL_NO_EFFECT; bestMonId = PARTY_SIZE; @@ -741,7 +741,7 @@ u8 GetMostSuitableMonToSwitchInto(void) } else { - invalidMons = 0x3F; // No viable mon to switch. + invalidMons = (1 << PARTY_SIZE) - 1; // No viable mon to switch. } } @@ -862,7 +862,7 @@ static bool8 ShouldUseItem(void) shouldUse = TRUE; break; case AI_ITEM_HEAL_HP: - paramOffset = GetItemEffectParamOffset(item, 4, 4); + paramOffset = GetItemEffectParamOffset(item, 4, ITEM4_HEAL_HP); if (paramOffset == 0) break; if (gBattleMons[gActiveBattler].hp == 0) @@ -935,7 +935,7 @@ static bool8 ShouldUseItem(void) { BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_ITEM, 0); *(gBattleStruct->chosenItem + (gActiveBattler / 2) * 2) = item; - gBattleResources->battleHistory->trainerItems[i] = 0; + gBattleResources->battleHistory->trainerItems[i] = ITEM_NONE; return shouldUse; } } diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index bf9197a0e..016110304 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7812,9 +7812,18 @@ static void Cmd_metronome(void) { s32 i; + #if MOVES_COUNT < 512 + // Original GF method of move selection is to pick a random + // number between 1-511. 355-511 are not valid moves, so if it + // picks in this range it retries. If MOVES_COUNT exceeds 511 we + // instead use a simpler solution. gCurrentMove = (Random() & 0x1FF) + 1; if (gCurrentMove >= MOVES_COUNT) continue; + #else + // Just pick a valid move value (between 1 and MOVES_COUNT-1) + gCurrentMove = (Random() % (MOVES_COUNT - 1)) + 1; + #endif for (i = 0; i < MAX_MON_MOVES; i++); // ? diff --git a/src/battle_util.c b/src/battle_util.c index 68a5b6ada..51fbaa3cf 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -342,7 +342,11 @@ void HandleAction_UseItem(void) gBattleCommunication[MULTISTRING_CHOOSER] = AI_HEAL_CONFUSION; if (*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) & (1 << AI_HEAL_CONFUSION)) { - if (*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) & 0x3E) + if (*(gBattleStruct->AI_itemFlags + gBattlerAttacker / 2) & ((1 << AI_HEAL_PARALYSIS) + | (1 << AI_HEAL_FREEZE) + | (1 << AI_HEAL_BURN) + | (1 << AI_HEAL_POISON) + | (1 << AI_HEAL_SLEEP))) gBattleCommunication[MULTISTRING_CHOOSER] = AI_HEAL_SLEEP; } else diff --git a/src/berry_tag_screen.c b/src/berry_tag_screen.c index 448ee3384..415f22e59 100644 --- a/src/berry_tag_screen.c +++ b/src/berry_tag_screen.c @@ -310,6 +310,8 @@ static void HandleInitBackgrounds(void) ShowBg(3); } +#define BG_TILE 0x42 + static bool8 LoadBerryTagGfx(void) { u16 i; @@ -333,15 +335,16 @@ static bool8 LoadBerryTagGfx(void) sBerryTag->gfxState++; break; case 3: + // Palette of the bg tiles changes depending on the player's gender if (gSaveBlock2Ptr->playerGender == MALE) { for (i = 0; i < ARRAY_COUNT(sBerryTag->tilemapBuffers[1]); i++) - sBerryTag->tilemapBuffers[1][i] = 0x4042; + sBerryTag->tilemapBuffers[1][i] = (4 << 12) | BG_TILE; } else { for (i = 0; i < ARRAY_COUNT(sBerryTag->tilemapBuffers[1]); i++) - sBerryTag->tilemapBuffers[1][i] = 0x5042; + sBerryTag->tilemapBuffers[1][i] = (5 << 12) | BG_TILE; } sBerryTag->gfxState++; break; @@ -545,6 +548,9 @@ static void Task_HandleInput(u8 taskId) } } +#define tBerryY data[0] +#define tBgOp data[1] + static void TryChangeDisplayedBerry(u8 taskId, s8 toMove) { s16 *data = gTasks[taskId].data; @@ -553,11 +559,11 @@ static void TryChangeDisplayedBerry(u8 taskId, s8 toMove) if (newPocketPosition < ITEM_TO_BERRY(MAX_BERRY_INDEX) && BagGetItemIdByPocketPosition(POCKET_BERRIES, newPocketPosition) != ITEM_NONE) { if (toMove < 0) - data[1] = 2; + tBgOp = BG_COORD_SUB; else - data[1] = 1; + tBgOp = BG_COORD_ADD; - data[0] = 0; + tBerryY = 0; PlaySE(SE_SELECT); HandleBagCursorPositionChange(toMove); gTasks[taskId].func = Task_DisplayAnotherBerry; @@ -586,101 +592,103 @@ static void HandleBagCursorPositionChange(s8 toMove) sBerryTag->berryId = ItemIdToBerryType(BagGetItemIdByPocketPosition(POCKET_BERRIES, *scrollPos + *cursorPos)); } +#define DISPLAY_SPEED 16 + static void Task_DisplayAnotherBerry(u8 taskId) { u16 i; - s16 posY; + s16 y; s16 *data = gTasks[taskId].data; - data[0] += 0x10; - data[0] &= 0xFF; + tBerryY += DISPLAY_SPEED; + tBerryY &= 0xFF; - if (data[1] == 1) + if (tBgOp == BG_COORD_ADD) { - switch (data[0]) + switch (tBerryY) { - case 0x30: + case 3 * DISPLAY_SPEED: FillWindowPixelBuffer(WIN_BERRY_NAME, PIXEL_FILL(0)); break; - case 0x40: + case 4 * DISPLAY_SPEED: PrintBerryNumberAndName(); break; - case 0x50: + case 5 * DISPLAY_SPEED: DestroyBerrySprite(); CreateBerrySprite(); break; - case 0x60: + case 6 * DISPLAY_SPEED: FillWindowPixelBuffer(WIN_SIZE_FIRM, PIXEL_FILL(0)); break; - case 0x70: + case 7 * DISPLAY_SPEED: PrintBerrySize(); break; - case 0x80: + case 8 * DISPLAY_SPEED: PrintBerryFirmness(); break; - case 0x90: + case 9 * DISPLAY_SPEED: SetFlavorCirclesVisiblity(); break; - case 0xA0: + case 10 * DISPLAY_SPEED: FillWindowPixelBuffer(WIN_DESC, PIXEL_FILL(0)); break; - case 0xB0: + case 11 * DISPLAY_SPEED: PrintBerryDescription1(); break; - case 0xC0: + case 12 * DISPLAY_SPEED: PrintBerryDescription2(); break; } } - else + else // BG_COORD_SUB { - switch (data[0]) + switch (tBerryY) { - case 0x30: + case 3 * DISPLAY_SPEED: FillWindowPixelBuffer(WIN_DESC, PIXEL_FILL(0)); break; - case 0x40: + case 4 * DISPLAY_SPEED: PrintBerryDescription2(); break; - case 0x50: + case 5 * DISPLAY_SPEED: PrintBerryDescription1(); break; - case 0x60: + case 6 * DISPLAY_SPEED: SetFlavorCirclesVisiblity(); break; - case 0x70: + case 7 * DISPLAY_SPEED: FillWindowPixelBuffer(WIN_SIZE_FIRM, PIXEL_FILL(0)); break; - case 0x80: + case 8 * DISPLAY_SPEED: PrintBerryFirmness(); break; - case 0x90: + case 9 * DISPLAY_SPEED: PrintBerrySize(); break; - case 0xA0: + case 10 * DISPLAY_SPEED: DestroyBerrySprite(); CreateBerrySprite(); break; - case 0xB0: + case 11 * DISPLAY_SPEED: FillWindowPixelBuffer(WIN_BERRY_NAME, PIXEL_FILL(0)); break; - case 0xC0: + case 12 * DISPLAY_SPEED: PrintBerryNumberAndName(); break; } } - if (data[1] == 1) - posY = -data[0]; + if (tBgOp == BG_COORD_ADD) + y = -tBerryY; else - posY = data[0]; + y = tBerryY; - gSprites[sBerryTag->berrySpriteId].y2 = posY; + gSprites[sBerryTag->berrySpriteId].y2 = y; for (i = 0; i < FLAVOR_COUNT; i++) - gSprites[sBerryTag->flavorCircleIds[i]].y2 = posY; + gSprites[sBerryTag->flavorCircleIds[i]].y2 = y; - ChangeBgY(1, 0x1000, data[1]); - ChangeBgY(2, 0x1000, data[1]); + ChangeBgY(1, 0x1000, tBgOp); + ChangeBgY(2, 0x1000, tBgOp); - if (data[0] == 0) + if (tBerryY == 0) gTasks[taskId].func = Task_HandleInput; } diff --git a/src/cable_club.c b/src/cable_club.c index 913a1b728..b12a50920 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -725,7 +725,7 @@ void TryContestEModeLinkup(void) u8 CreateTask_ReestablishCableClubLink(void) { if (FuncIsActiveTask(Task_ReestablishLink) != FALSE) - return 0xFF; + return TASK_NONE; switch (gSpecialVar_0x8004) { diff --git a/src/contest.c b/src/contest.c index 741a0e12d..3449d25f6 100644 --- a/src/contest.c +++ b/src/contest.c @@ -1112,10 +1112,10 @@ static void InitContestResources(void) for (i = 0; i < CONTESTANT_COUNT; i++) { - eContestantStatus[i].nextTurnOrder = 0xFF; + eContestantStatus[i].nextTurnOrder = CONTESTANT_NONE; eContest.prevTurnOrder[i] = gContestantTurnOrder[i]; } - // Calling this here while all the nextTurnOrder values are 0xFF will actually + // Calling this here while all the nextTurnOrder values are CONTESTANT_NONE will actually // just reverse the turn order. ApplyNextTurnOrder(); memset(gContestResources->tv, 0, sizeof(*gContestResources->tv) * CONTESTANT_COUNT); @@ -2891,7 +2891,7 @@ void SetContestants(u8 contestType, u8 rank) opponents[opponentsCount++] = i; } } - opponents[opponentsCount] = 0xFF; + opponents[opponentsCount] = CONTESTANT_NONE; // Choose three random opponents from the list for (i = 0; i < CONTESTANT_COUNT - 1; i++) @@ -2900,7 +2900,7 @@ void SetContestants(u8 contestType, u8 rank) s32 j; gContestMons[i] = gContestOpponents[opponents[rnd]]; - for (j = rnd; opponents[j] != 0xFF; j++) + for (j = rnd; opponents[j] != CONTESTANT_NONE; j++) opponents[j] = opponents[j + 1]; opponentsCount--; } @@ -2940,7 +2940,7 @@ void SetLinkAIContestants(u8 contestType, u8 rank, bool32 isPostgame) || (contestType == CONTEST_CATEGORY_TOUGH && gContestOpponents[i].aiPool_Tough)) opponents[opponentsCount++] = i; } - opponents[opponentsCount] = 0xFF; + opponents[opponentsCount] = CONTESTANT_NONE; // Fill remaining contestant slots with random AI opponents from the list for (i = 0; i < CONTESTANT_COUNT - gNumLinkContestPlayers; i++) @@ -2950,7 +2950,7 @@ void SetLinkAIContestants(u8 contestType, u8 rank, bool32 isPostgame) gContestMons[gNumLinkContestPlayers + i] = gContestOpponents[opponents[rnd]]; StripPlayerNameForLinkContest(gContestMons[gNumLinkContestPlayers + i].trainerName); StripMonNameForLinkContest(gContestMons[gNumLinkContestPlayers + i].nickname, GAME_LANGUAGE); - for (j = rnd; opponents[j] != 0xFF; j++) + for (j = rnd; opponents[j] != CONTESTANT_NONE; j++) opponents[j] = opponents[j + 1]; opponentsCount--; } @@ -4370,7 +4370,7 @@ void SortContestants(bool8 useRanking) // Note that ranking is calculated so that shared places still take up a ranking // space. A ranking like [1, 2, 2, 3] is not possible; it would be [1, 2, 2, 4] // instead. - memset(scratch, 0xFF, sizeof(scratch)); + memset(scratch, CONTESTANT_NONE, sizeof(scratch)); for (i = 0; i < CONTESTANT_COUNT; i++) { u8 j = eContestantStatus[i].ranking; @@ -4378,7 +4378,7 @@ void SortContestants(bool8 useRanking) while (1) { u8 *ptr = &scratch[j]; - if (*ptr == 0xFF) + if (*ptr == CONTESTANT_NONE) { *ptr = i; gContestantTurnOrder[i] = j; @@ -4636,7 +4636,7 @@ static void ApplyNextTurnOrder(void) // First, look for the first unassigned contestant. for (j = 0; j < CONTESTANT_COUNT; j++) { - if (!isContestantOrdered[j] && eContestantStatus[j].nextTurnOrder == 0xFF) + if (!isContestantOrdered[j] && eContestantStatus[j].nextTurnOrder == CONTESTANT_NONE) { nextContestant = j; j++; @@ -4647,7 +4647,7 @@ static void ApplyNextTurnOrder(void) // Then, look for a better candidate, with a higher turn order. for (; j < CONTESTANT_COUNT; j++) { - if (!isContestantOrdered[j] && eContestantStatus[j].nextTurnOrder == 0xFF + if (!isContestantOrdered[j] && eContestantStatus[j].nextTurnOrder == CONTESTANT_NONE && gContestantTurnOrder[nextContestant] > gContestantTurnOrder[j]) nextContestant = j; } @@ -4661,7 +4661,7 @@ static void ApplyNextTurnOrder(void) for (i = 0; i < CONTESTANT_COUNT; i++) { eContestAppealResults.turnOrder[i] = newTurnOrder[i]; - eContestantStatus[i].nextTurnOrder = 0xFF; + eContestantStatus[i].nextTurnOrder = CONTESTANT_NONE; eContestantStatus[i].turnOrderMod = 0; gContestantTurnOrder[i] = newTurnOrder[i]; } diff --git a/src/contest_ai.c b/src/contest_ai.c index 7aeba828a..8753ed170 100644 --- a/src/contest_ai.c +++ b/src/contest_ai.c @@ -6,6 +6,8 @@ #include "contest_effect.h" #include "constants/moves.h" +#define AI_ACTION_DONE (1 << 0) + extern const u8 *gAIScriptPtr; extern const u8 *gContestAI_ScriptsTable[]; @@ -362,9 +364,9 @@ static void ContestAI_DoAIProcessing(void) else { eContestAI.moveScores[eContestAI.nextMoveIndex] = 0; // don't consider a move that doesn't exist. - eContestAI.aiAction |= 1; + eContestAI.aiAction |= AI_ACTION_DONE; } - if (eContestAI.aiAction & 1) + if (eContestAI.aiAction & AI_ACTION_DONE) { eContestAI.nextMoveIndex++; if (eContestAI.nextMoveIndex < MAX_MON_MOVES) @@ -372,7 +374,7 @@ static void ContestAI_DoAIProcessing(void) else // aiState = CONTESTAI_FINISHED eContestAI.aiState++; - eContestAI.aiAction &= 0xFE; // TODO: Define action flags + eContestAI.aiAction &= ~AI_ACTION_DONE; } break; } @@ -1667,7 +1669,7 @@ static void ContestAICmd_call(void) static void ContestAICmd_end(void) { if (!AIStackPop()) - eContestAI.aiAction |= 1; + eContestAI.aiAction |= AI_ACTION_DONE; } static void AIStackPushVar(const u8 *ptr) diff --git a/src/contest_effect.c b/src/contest_effect.c index 864805a54..b92794303 100644 --- a/src/contest_effect.c +++ b/src/contest_effect.c @@ -147,7 +147,7 @@ static void ContestEffect_StartleFrontMon(void) break; } eContestAppealResults.jamQueue[0] = i; - eContestAppealResults.jamQueue[1] = 0xFF; + eContestAppealResults.jamQueue[1] = CONTESTANT_NONE; idx = WasAtLeastOneOpponentJammed(); } if (idx == 0) @@ -171,7 +171,7 @@ static void ContestEffect_StartlePrevMons(void) eContestAppealResults.jamQueue[j++] = i; } - eContestAppealResults.jamQueue[j] = 0xFF; + eContestAppealResults.jamQueue[j] = CONTESTANT_NONE; idx = WasAtLeastOneOpponentJammed(); } if (idx == 0) @@ -214,7 +214,7 @@ static void ContestEffect_StartlePrevMons2(void) u8 rval, jam; eContestAppealResults.jamQueue[0] = i; - eContestAppealResults.jamQueue[1] = 0xFF; + eContestAppealResults.jamQueue[1] = CONTESTANT_NONE; rval = Random() % 10; if (rval == 0) @@ -291,7 +291,7 @@ static void ContestEffect_StartleMonWithJudgesAttention(void) else eContestAppealResults.jam = 10; eContestAppealResults.jamQueue[0] = i; - eContestAppealResults.jamQueue[1] = 0xFF; + eContestAppealResults.jamQueue[1] = CONTESTANT_NONE; if (WasAtLeastOneOpponentJammed()) numStartled++; } @@ -396,7 +396,7 @@ static void ContestEffect_MakeFollowingMonsNervous(void) s16 oddsMod[CONTESTANT_COUNT]; s16 odds[CONTESTANT_COUNT]; - memset(contestantIds, 0xFF, ARRAY_COUNT(contestantIds)); + memset(contestantIds, CONTESTANT_NONE, ARRAY_COUNT(contestantIds)); for (i = 0, numAfter = 0; i < CONTESTANT_COUNT; i++) { if (eContestAppealResults.turnOrder[eContestAppealResults.contestant] < eContestAppealResults.turnOrder[i] && @@ -434,7 +434,7 @@ static void ContestEffect_MakeFollowingMonsNervous(void) } if (odds[0] != 0) { - for (i = 0; contestantIds[i] != 0xFF; i++) + for (i = 0; contestantIds[i] != CONTESTANT_NONE; i++) { if (Random() % 100 < odds[i] + oddsMod[contestantIds[i]]) { @@ -507,7 +507,7 @@ static void ContestEffect_BadlyStartlesMonsInGoodCondition(void) else eContestAppealResults.jam = 10; eContestAppealResults.jamQueue[0] = i; - eContestAppealResults.jamQueue[1] = 0xFF; + eContestAppealResults.jamQueue[1] = CONTESTANT_NONE; if (WasAtLeastOneOpponentJammed()) numHit++; } @@ -758,7 +758,7 @@ static void ContestEffect_NextAppealEarlier(void) for (i = 0; i < CONTESTANT_COUNT; i++) turnOrder[i] = eContestantStatus[i].nextTurnOrder; - turnOrder[eContestAppealResults.contestant] = 0xFF; + turnOrder[eContestAppealResults.contestant] = CONTESTANT_NONE; for (i = 0; i < CONTESTANT_COUNT; i++) { @@ -800,7 +800,7 @@ static void ContestEffect_NextAppealLater(void) for (i = 0; i < CONTESTANT_COUNT; i++) turnOrder[i] = eContestantStatus[i].nextTurnOrder; - turnOrder[eContestAppealResults.contestant] = 0xFF; + turnOrder[eContestAppealResults.contestant] = CONTESTANT_NONE; for (i = CONTESTANT_COUNT - 1; i > -1; i--) { @@ -858,12 +858,12 @@ static void ContestEffect_ScrambleNextTurnOrder(void) for (j = 0; j < CONTESTANT_COUNT; j++) { - if (unselectedContestants[j] != 0xFF) + if (unselectedContestants[j] != CONTESTANT_NONE) { if (rval == 0) { turnOrder[j] = i; - unselectedContestants[j] = 0xFF; + unselectedContestants[j] = CONTESTANT_NONE; break; } else @@ -909,7 +909,7 @@ static void ContestEffect_BadlyStartleMonsWithGoodAppeals(void) else eContestAppealResults.jam = 10; eContestAppealResults.jamQueue[0] = i; - eContestAppealResults.jamQueue[1] = 0xFF; + eContestAppealResults.jamQueue[1] = CONTESTANT_NONE; if (WasAtLeastOneOpponentJammed()) numJammed++; } @@ -977,7 +977,7 @@ static void JamByMoveCategory(u8 category) else eContestAppealResults.jam = 10; eContestAppealResults.jamQueue[0] = i; - eContestAppealResults.jamQueue[1] = 0xFF; + eContestAppealResults.jamQueue[1] = CONTESTANT_NONE; if (WasAtLeastOneOpponentJammed()) numJammed++; } @@ -1016,7 +1016,7 @@ static bool8 WasAtLeastOneOpponentJammed(void) s16 jamBuffer[CONTESTANT_COUNT] = {0}; int i; - for (i = 0; eContestAppealResults.jamQueue[i] != 0xFF; i++) + for (i = 0; eContestAppealResults.jamQueue[i] != CONTESTANT_NONE; i++) { u8 contestant = eContestAppealResults.jamQueue[i]; if (CanUnnerveContestant(contestant)) diff --git a/src/contest_util.c b/src/contest_util.c index ec999be92..e0e80a709 100644 --- a/src/contest_util.c +++ b/src/contest_util.c @@ -2011,7 +2011,7 @@ void GiveMonContestRibbon(void) { case CONTEST_CATEGORY_COOL: ribbonData = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_COOL_RIBBON); - if (ribbonData <= gSpecialVar_ContestRank && ribbonData < 4) + if (ribbonData <= gSpecialVar_ContestRank && ribbonData <= CONTEST_RANK_MASTER) { ribbonData++; SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_COOL_RIBBON, &ribbonData); @@ -2021,7 +2021,7 @@ void GiveMonContestRibbon(void) break; case CONTEST_CATEGORY_BEAUTY: ribbonData = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_BEAUTY_RIBBON); - if (ribbonData <= gSpecialVar_ContestRank && ribbonData < 4) + if (ribbonData <= gSpecialVar_ContestRank && ribbonData <= CONTEST_RANK_MASTER) { ribbonData++; SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_BEAUTY_RIBBON, &ribbonData); @@ -2031,7 +2031,7 @@ void GiveMonContestRibbon(void) break; case CONTEST_CATEGORY_CUTE: ribbonData = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_CUTE_RIBBON); - if (ribbonData <= gSpecialVar_ContestRank && ribbonData < 4) + if (ribbonData <= gSpecialVar_ContestRank && ribbonData <= CONTEST_RANK_MASTER) { ribbonData++; SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_CUTE_RIBBON, &ribbonData); @@ -2041,7 +2041,7 @@ void GiveMonContestRibbon(void) break; case CONTEST_CATEGORY_SMART: ribbonData = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SMART_RIBBON); - if (ribbonData <= gSpecialVar_ContestRank && ribbonData < 4) + if (ribbonData <= gSpecialVar_ContestRank && ribbonData <= CONTEST_RANK_MASTER) { ribbonData++; SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SMART_RIBBON, &ribbonData); @@ -2051,7 +2051,7 @@ void GiveMonContestRibbon(void) break; case CONTEST_CATEGORY_TOUGH: ribbonData = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_TOUGH_RIBBON); - if (ribbonData <= gSpecialVar_ContestRank && ribbonData < 4) + if (ribbonData <= gSpecialVar_ContestRank && ribbonData <= CONTEST_RANK_MASTER) { ribbonData++; SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_TOUGH_RIBBON, &ribbonData); diff --git a/src/data/contest_opponents.h b/src/data/contest_opponents.h index 7c3aad315..d8241c4f0 100644 --- a/src/data/contest_opponents.h +++ b/src/data/contest_opponents.h @@ -138,11 +138,14 @@ enum { #define CONTEST_AI_SET_20 (CONTEST_AI_COMMON | CONTEST_AI_DUMMY_12 | CONTEST_AI_DUMMY_25) #define CONTEST_AI_SET_21 (CONTEST_AI_COMMON | CONTEST_AI_DUMMY_7 | CONTEST_AI_DUMMY_25) +// All AI contestants have the same trainer ID +#define CONTEST_AI_TRAINER_ID 0xFFFF + const struct ContestWinner gDefaultContestWinners[] = { [CONTEST_WINNER_HALL_1 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_ELECTRIKE, .contestCategory = CONTEST_CATEGORY_CUTE, .monName = _("ELECTER"), @@ -151,7 +154,7 @@ const struct ContestWinner gDefaultContestWinners[] = }, [CONTEST_WINNER_HALL_2 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_TROPIUS, .contestCategory = CONTEST_CATEGORY_COOL, .monName = _("TROPO"), @@ -160,7 +163,7 @@ const struct ContestWinner gDefaultContestWinners[] = }, [CONTEST_WINNER_HALL_3 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_XATU, .contestCategory = CONTEST_CATEGORY_BEAUTY, .monName = _("TUXA"), @@ -169,7 +172,7 @@ const struct ContestWinner gDefaultContestWinners[] = }, [CONTEST_WINNER_HALL_4 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_PLUSLE, .contestCategory = CONTEST_CATEGORY_TOUGH, .monName = _("PULSE"), @@ -178,7 +181,7 @@ const struct ContestWinner gDefaultContestWinners[] = }, [CONTEST_WINNER_HALL_5 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_SHUPPET, .contestCategory = CONTEST_CATEGORY_SMART, .monName = _("SHUPUP"), @@ -187,7 +190,7 @@ const struct ContestWinner gDefaultContestWinners[] = }, [CONTEST_WINNER_HALL_6 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_ZANGOOSE, .contestCategory = CONTEST_CATEGORY_COOL, .monName = _("GOOZAN"), @@ -196,7 +199,7 @@ const struct ContestWinner gDefaultContestWinners[] = }, [CONTEST_WINNER_HALL_UNUSED_1 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_LOUDRED, .contestCategory = CONTEST_CATEGORY_BEAUTY, .monName = _("LOUDED"), @@ -205,7 +208,7 @@ const struct ContestWinner gDefaultContestWinners[] = }, [CONTEST_WINNER_HALL_UNUSED_2 - 1] = { .personality = 0, - .trainerId = 0xFFFF, + .trainerId = CONTEST_AI_TRAINER_ID, .species = SPECIES_DELCATTY, .contestCategory = CONTEST_CATEGORY_CUTE, .monName = _("KITSY"), @@ -242,7 +245,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 4, .sheen = 50, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_EDITH] = { .species = SPECIES_ILLUMISE, @@ -270,7 +273,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 2, .sheen = 60, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_EVAN] = { .species = SPECIES_DUSTOX, @@ -298,7 +301,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 4, .sheen = 70, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KELSEY] = { .species = SPECIES_SEEDOT, @@ -326,7 +329,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 7, .sheen = 80, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MADISON] = { .species = SPECIES_TAILLOW, @@ -354,7 +357,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 4, .sheen = 90, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_RAYMOND] = { .species = SPECIES_NINCADA, @@ -382,7 +385,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 8, .sheen = 100, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_GRANT] = { .species = SPECIES_SHROOMISH, @@ -410,7 +413,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 2, .sheen = 50, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_PAIGE] = { .species = SPECIES_SPHEAL, @@ -438,7 +441,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 10, .sheen = 60, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ALEC] = { .species = SPECIES_SLAKOTH, @@ -466,7 +469,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 18, .sheen = 70, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_SYDNEY] = { .species = SPECIES_WHISMUR, @@ -494,7 +497,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 7, .sheen = 80, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MORRIS] = { .species = SPECIES_MAKUHITA, @@ -522,7 +525,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 1, .sheen = 90, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MARIAH] = { .species = SPECIES_ARON, @@ -550,7 +553,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 2, .sheen = 100, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_RUSSELL] = { .species = SPECIES_CROBAT, @@ -578,7 +581,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 10, .sheen = 50, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MELANIE] = { .species = SPECIES_GULPIN, @@ -606,7 +609,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 5, .sheen = 60, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CHANCE] = { .species = SPECIES_MANECTRIC, @@ -634,7 +637,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 1, .sheen = 70, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_AGATHA] = { .species = SPECIES_BULBASAUR, @@ -662,7 +665,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 4, .sheen = 50, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_BEAU] = { .species = SPECIES_BUTTERFREE, @@ -690,7 +693,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 4, .sheen = 60, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KAY] = { .species = SPECIES_PIDGEOTTO, @@ -718,7 +721,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 3, .sheen = 70, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CALE] = { .species = SPECIES_DIGLETT, @@ -746,7 +749,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 10, .sheen = 80, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CAITLIN] = { .species = SPECIES_POLIWAG, @@ -774,7 +777,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 10, .sheen = 90, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_COLBY] = { .species = SPECIES_TOTODILE, @@ -802,7 +805,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 5, .sheen = 100, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KYLIE] = { .species = SPECIES_LEDYBA, @@ -830,7 +833,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 2, .sheen = 90, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_LIAM] = { .species = SPECIES_DELIBIRD, @@ -858,7 +861,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 3, .sheen = 80, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MILO] = { .species = SPECIES_LARVITAR, @@ -886,7 +889,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 10, .sheen = 70, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KARINA] = { .species = SPECIES_ROSELIA, @@ -914,7 +917,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 100, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_BOBBY] = { .species = SPECIES_DODRIO, @@ -942,7 +945,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 35, .sheen = 110, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CLAIRE] = { .species = SPECIES_TRAPINCH, @@ -970,7 +973,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 25, .sheen = 120, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_WILLIE] = { .species = SPECIES_CACNEA, @@ -998,7 +1001,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 25, .sheen = 130, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CASSIDY] = { .species = SPECIES_SANDSLASH, @@ -1026,7 +1029,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 100, .sheen = 140, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MORGAN] = { .species = SPECIES_BALTOY, @@ -1054,7 +1057,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 35, .sheen = 150, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_SUMMER] = { .species = SPECIES_MEDICHAM, @@ -1082,7 +1085,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 40, .sheen = 100, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MILES] = { .species = SPECIES_SPINDA, @@ -1110,7 +1113,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 25, .sheen = 110, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_AUDREY] = { .species = SPECIES_SWABLU, @@ -1138,7 +1141,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 25, .sheen = 120, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_AVERY] = { .species = SPECIES_SPOINK, @@ -1166,7 +1169,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 30, .sheen = 130, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ARIANA] = { .species = SPECIES_KECLEON, @@ -1194,7 +1197,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 35, .sheen = 140, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ASHTON] = { .species = SPECIES_GOLDEEN, @@ -1222,7 +1225,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 25, .sheen = 150, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_SANDRA] = { .species = SPECIES_BARBOACH, @@ -1250,7 +1253,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 15, .sheen = 100, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CARSON] = { .species = SPECIES_SKARMORY, @@ -1278,7 +1281,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 110, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KATRINA] = { .species = SPECIES_LOTAD, @@ -1306,7 +1309,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 75, .sheen = 120, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_LUKE] = { .species = SPECIES_SLOWBRO, @@ -1334,7 +1337,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 100, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_RAUL] = { .species = SPECIES_FARFETCHD, @@ -1362,7 +1365,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 110, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_JADA] = { .species = SPECIES_SEEL, @@ -1390,7 +1393,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 120, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ZEEK] = { .species = SPECIES_DROWZEE, @@ -1418,7 +1421,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 45, .sheen = 130, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_DIEGO] = { .species = SPECIES_HITMONCHAN, @@ -1446,7 +1449,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 45, .sheen = 140, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ALIYAH] = { .species = SPECIES_BLISSEY, @@ -1474,7 +1477,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 150, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_NATALIA] = { .species = SPECIES_ELEKID, @@ -1502,7 +1505,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 25, .sheen = 140, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_DEVIN] = { .species = SPECIES_SNUBBULL, @@ -1530,7 +1533,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 130, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_TYLOR] = { .species = SPECIES_MISDREAVUS, @@ -1558,7 +1561,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 20, .sheen = 120, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_RONNIE] = { .species = SPECIES_LAIRON, @@ -1586,7 +1589,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 90, .sheen = 200, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CLAUDIA] = { .species = SPECIES_SHIFTRY, @@ -1614,7 +1617,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 70, .sheen = 210, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ELIAS] = { .species = SPECIES_NINJASK, @@ -1642,7 +1645,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 70, .sheen = 220, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_JADE] = { .species = SPECIES_SWELLOW, @@ -1670,7 +1673,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 40, .sheen = 230, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_FRANCIS] = { .species = SPECIES_MIGHTYENA, @@ -1698,7 +1701,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 70, .sheen = 240, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ALISHA] = { .species = SPECIES_BEAUTIFLY, @@ -1726,7 +1729,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 100, .sheen = 250, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_SAUL] = { .species = SPECIES_SEAKING, @@ -1754,7 +1757,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 90, .sheen = 200, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_FELICIA] = { .species = SPECIES_CASTFORM, @@ -1782,7 +1785,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 65, .sheen = 210, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_EMILIO] = { .species = SPECIES_MACHOKE, @@ -1810,7 +1813,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 50, .sheen = 220, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KARLA] = { .species = SPECIES_LOMBRE, @@ -1838,7 +1841,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 70, .sheen = 230, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_DARRYL] = { .species = SPECIES_SEVIPER, @@ -1866,7 +1869,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 100, .sheen = 240, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_SELENA] = { .species = SPECIES_WAILMER, @@ -1894,7 +1897,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 30, .sheen = 250, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_NOEL] = { .species = SPECIES_MAGIKARP, @@ -1922,7 +1925,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 160, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_LACEY] = { .species = SPECIES_LUNATONE, @@ -1950,7 +1953,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 50, .sheen = 210, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CORBIN] = { .species = SPECIES_ABSOL, @@ -1978,7 +1981,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 35, .sheen = 220, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_GRACIE] = { .species = SPECIES_EXEGGUTOR, @@ -2006,7 +2009,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 80, .sheen = 200, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_COLTIN] = { .species = SPECIES_CUBONE, @@ -2034,7 +2037,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 100, .sheen = 210, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ELLIE] = { .species = SPECIES_HITMONLEE, @@ -2062,7 +2065,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 100, .sheen = 220, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MARCUS] = { .species = SPECIES_SQUIRTLE, @@ -2090,7 +2093,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 95, .sheen = 230, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KIARA] = { .species = SPECIES_KANGASKHAN, @@ -2118,7 +2121,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 100, .sheen = 240, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_BRYCE] = { .species = SPECIES_PINECO, @@ -2146,7 +2149,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 80, .sheen = 250, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_JAMIE] = { .species = SPECIES_DUNSPARCE, @@ -2174,7 +2177,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 110, .sheen = 240, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_JORGE] = { .species = SPECIES_HOUNDOOM, @@ -2202,7 +2205,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 80, .sheen = 230, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_DEVON] = { .species = SPECIES_MILTANK, @@ -2230,7 +2233,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 40, .sheen = 220, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_JUSTINA] = { .species = SPECIES_GYARADOS, @@ -2258,7 +2261,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 160, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_RALPH] = { .species = SPECIES_LOUDRED, @@ -2286,7 +2289,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 160, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_ROSA] = { .species = SPECIES_SKITTY, @@ -2314,7 +2317,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 60, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KEATON] = { .species = SPECIES_SLAKING, @@ -2342,7 +2345,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 150, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MAYRA] = { .species = SPECIES_ALTARIA, @@ -2370,7 +2373,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 90, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_LAMAR] = { .species = SPECIES_KIRLIA, @@ -2398,7 +2401,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 80, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_AUBREY] = { .species = SPECIES_BELLOSSOM, @@ -2426,7 +2429,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 40, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_NIGEL] = { .species = SPECIES_SABLEYE, @@ -2454,7 +2457,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 160, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CAMILLE] = { .species = SPECIES_NATU, @@ -2482,7 +2485,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 170, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_DEON] = { .species = SPECIES_SHARPEDO, @@ -2510,7 +2513,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 100, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_JANELLE] = { .species = SPECIES_LUVDISC, @@ -2538,7 +2541,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 190, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_HEATH] = { .species = SPECIES_HERACROSS, @@ -2566,7 +2569,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 140, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_SASHA] = { .species = SPECIES_ELECTRODE, @@ -2594,7 +2597,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 50, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_FRANKIE] = { .species = SPECIES_PICHU, @@ -2622,7 +2625,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 120, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_HELEN] = { .species = SPECIES_WOBBUFFET, @@ -2650,7 +2653,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 210, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CAMILE] = { .species = SPECIES_GENGAR, @@ -2678,7 +2681,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 180, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_MARTIN] = { .species = SPECIES_PORYGON, @@ -2706,7 +2709,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 130, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_SERGIO] = { .species = SPECIES_DRAGONITE, @@ -2734,7 +2737,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 150, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_KAILEY] = { .species = SPECIES_MEOWTH, @@ -2762,7 +2765,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 80, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_PERLA] = { .species = SPECIES_JYNX, @@ -2790,7 +2793,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 120, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_CLARA] = { .species = SPECIES_TOGEPI, @@ -2818,7 +2821,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 80, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_JAKOB] = { .species = SPECIES_ESPEON, @@ -2846,7 +2849,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 150, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_TREY] = { .species = SPECIES_SLOWKING, @@ -2874,7 +2877,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 170, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, }, [CONTEST_OPPONENT_LANE] = { .species = SPECIES_URSARING, @@ -2902,7 +2905,7 @@ const struct ContestPokemon gContestOpponents[] = .tough = 190, .sheen = 255, .personality = 0, - .otId = 0xFFFF + .otId = CONTEST_AI_TRAINER_ID, } }; diff --git a/src/decoration.c b/src/decoration.c index b33580d2d..688018b2d 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -422,7 +422,16 @@ static const u8 sDecorationSlideElevation[] = }; static const u16 sDecorShapeSizes[] = { - 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x10, 0x20, 0x40, 0x20 + [DECORSHAPE_1x1] = 4, + [DECORSHAPE_2x1] = 8, + [DECORSHAPE_3x1] = 16, + [DECORSHAPE_4x2] = 32, + [DECORSHAPE_2x2] = 16, + [DECORSHAPE_1x2] = 8, + [DECORSHAPE_1x3] = 16, + [DECORSHAPE_2x4] = 32, + [DECORSHAPE_3x3] = 64, + [DECORSHAPE_3x2] = 32, }; static const u16 sBrendanPalette[] = INCBIN_U16("graphics/decorations/brendan.gbapal"); diff --git a/src/dewford_trend.c b/src/dewford_trend.c index 08dd9afe0..45c18f601 100644 --- a/src/dewford_trend.c +++ b/src/dewford_trend.c @@ -224,7 +224,7 @@ static void SortTrends(struct DewfordTrend *trends, u16 numTrends, u8 mode) } #define SAVED_TRENDS_SIZE (sizeof(struct DewfordTrend) * SAVED_TRENDS_COUNT) -#define BUFFER_SIZE (SAVED_TRENDS_SIZE * MAX_LINK_PLAYERS > 0x100 ? SAVED_TRENDS_SIZE * MAX_LINK_PLAYERS : 0x100) // More space was allocated than needed +#define BUFFER_SIZE max(SAVED_TRENDS_SIZE * MAX_LINK_PLAYERS, 0x100) // More space was allocated than needed void ReceiveDewfordTrendData(struct DewfordTrend *linkedTrends, size_t size, u8 unused) { diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index 894ad0012..c5b8712b5 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -753,11 +753,11 @@ void EReaderHelper_SerialCallback(void) switch (sSendRecvMgr.state) { case EREADER_XFR_STATE_HANDSHAKE: - REG_SIOMLT_SEND = 0xCCD0; // Handshake id + REG_SIOMLT_SEND = EREADER_HANDSHAKE; *(u64 *)recv = REG_SIOMLT_RECV; for (i = 0, cnt1 = 0, cnt2 = 0; i < 4; i++) { - if (recv[i] == 0xCCD0) + if (recv[i] == EREADER_HANDSHAKE) cnt1++; else if (recv[i] != 0xFFFF) cnt2++; diff --git a/src/field_specials.c b/src/field_specials.c index 38746c97a..53084c829 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -3260,6 +3260,7 @@ void ScrollableMultichoice_ClosePersistentMenu(void) #undef tTaskId #define DEOXYS_ROCK_LEVELS 11 +#define ROCK_PAL_ID 10 void DoDeoxysRockInteraction(void) { @@ -3339,7 +3340,7 @@ static void Task_DeoxysRockInteraction(u8 taskId) static void ChangeDeoxysRockLevel(u8 rockLevel) { u8 objectEventId; - LoadPalette(&sDeoxysRockPalettes[rockLevel], OBJ_PLTT_ID(10), PLTT_SIZEOF(4)); + LoadPalette(&sDeoxysRockPalettes[rockLevel], OBJ_PLTT_ID(ROCK_PAL_ID), PLTT_SIZEOF(4)); TryGetObjectEventIdByLocalIdAndMap(LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectEventId); if (rockLevel == 0) @@ -3376,21 +3377,20 @@ static void WaitForDeoxysRockMovement(u8 taskId) void IncrementBirthIslandRockStepCount(void) { - u16 var = VarGet(VAR_DEOXYS_ROCK_STEP_COUNT); + u16 stepCount = VarGet(VAR_DEOXYS_ROCK_STEP_COUNT); if (gSaveBlock1Ptr->location.mapNum == MAP_NUM(BIRTH_ISLAND_EXTERIOR) && gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(BIRTH_ISLAND_EXTERIOR)) { - var++; - if (var > 99) + if (++stepCount > 99) VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, 0); else - VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, var); + VarSet(VAR_DEOXYS_ROCK_STEP_COUNT, stepCount); } } void SetDeoxysRockPalette(void) { - LoadPalette(&sDeoxysRockPalettes[(u8)VarGet(VAR_DEOXYS_ROCK_LEVEL)], OBJ_PLTT_ID(10), PLTT_SIZEOF(4)); - BlendPalettes(0x04000000, 16, 0); + LoadPalette(&sDeoxysRockPalettes[(u8)VarGet(VAR_DEOXYS_ROCK_LEVEL)], OBJ_PLTT_ID(ROCK_PAL_ID), PLTT_SIZEOF(4)); + BlendPalettes(1 << (ROCK_PAL_ID + 16), 16, 0); } void SetPCBoxToSendMon(u8 boxId) @@ -3957,16 +3957,15 @@ bool8 InPokemonCenter(void) #define FANCLUB_BITFIELD (gSaveBlock1Ptr->vars[VAR_FANCLUB_FAN_COUNTER - VARS_START]) #define FANCLUB_COUNTER 0x007F -#define FANCLUB_FAN_FLAGS 0xFF80 #define GET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD >> (flag) & 1) #define SET_TRAINER_FAN_CLUB_FLAG(flag) (FANCLUB_BITFIELD |= 1 << (flag)) #define FLIP_TRAINER_FAN_CLUB_FLAG(flag)(FANCLUB_BITFIELD ^= 1 << (flag)) #define GET_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD & FANCLUB_COUNTER) -#define SET_TRAINER_FAN_CLUB_COUNTER(count) (FANCLUB_BITFIELD = (FANCLUB_BITFIELD & FANCLUB_FAN_FLAGS) | (count)) +#define SET_TRAINER_FAN_CLUB_COUNTER(count) (FANCLUB_BITFIELD = (FANCLUB_BITFIELD & ~FANCLUB_COUNTER) | (count)) #define INCR_TRAINER_FAN_CLUB_COUNTER(count)(FANCLUB_BITFIELD += (count)) -#define CLEAR_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD &= ~(FANCLUB_COUNTER)) +#define CLEAR_TRAINER_FAN_CLUB_COUNTER (FANCLUB_BITFIELD &= ~FANCLUB_COUNTER) void ResetFanClub(void) { diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c index 319743d0d..da37b8fc1 100644 --- a/src/librfu_rfu.c +++ b/src/librfu_rfu.c @@ -139,7 +139,7 @@ u16 rfu_initializeAPI(u32 *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p u16 buffByteSizeMax; // is in EWRAM? - if (((uintptr_t)APIBuffer & 0xF000000) == 0x2000000 && copyInterruptToRam) + if (((uintptr_t)APIBuffer & 0xF000000) == EWRAM_START && copyInterruptToRam) return ERR_RFU_API_BUFF_ADR; // is not 4-byte aligned? if ((u32)APIBuffer & 3) @@ -338,7 +338,7 @@ u16 rfu_getRFUStatus(u8 *rfuState) u16 rfu_MBOOT_CHILD_inheritanceLinkStatus(void) { const char *s1 = str_checkMbootLL; - char *s2 = (char *)0x30000F0; + char *s2 = (char *)(IWRAM_START + 0xF0); u16 checksum; u16 *mb_buff_iwram_p; u8 i; @@ -347,15 +347,15 @@ u16 rfu_MBOOT_CHILD_inheritanceLinkStatus(void) while (*s1 != '\0') if (*s1++ != *s2++) return 1; - mb_buff_iwram_p = (u16 *)0x3000000; + mb_buff_iwram_p = (u16 *)IWRAM_START; // The size of struct RfuLinkStatus is 180 checksum = 0; for (i = 0; i < 180/2; ++i) checksum += *mb_buff_iwram_p++; - if (checksum != *(u16 *)0x30000FA) + if (checksum != *(u16 *)(IWRAM_START + 0xFA)) return 1; - CpuCopy16((u16 *)0x3000000, gRfuLinkStatus, sizeof(struct RfuLinkStatus)); + CpuCopy16((u16 *)IWRAM_START, gRfuLinkStatus, sizeof(struct RfuLinkStatus)); gRfuStatic->flags |= 0x80; // mboot return 0; } diff --git a/src/link_rfu_2.c b/src/link_rfu_2.c index 9d66a1837..6c84ffefe 100644 --- a/src/link_rfu_2.c +++ b/src/link_rfu_2.c @@ -1918,7 +1918,8 @@ static void Task_PlayerExchangeUpdate(u8 taskId) for (i = 0; i < RFU_CHILD_MAX; i++) sio->linkPlayerIdx[i] = gRfu.linkPlayerIdx[i]; memcpy(sio->linkPlayers, gLinkPlayers, sizeof(gLinkPlayers)); - if (SendBlock(0, gBlockSendBuffer, 0xa0)) + // Send SioInfo but exclude the 92 unused bytes at the end + if (SendBlock(0, gBlockSendBuffer, offsetof(struct SioInfo, filler))) gTasks[taskId].tState++; break; case 5: diff --git a/src/main_menu.c b/src/main_menu.c index ef4bbd636..ddbcda5fd 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -4,6 +4,7 @@ #include "constants/rgb.h" #include "constants/songs.h" #include "constants/trainers.h" +#include "data.h" #include "decompress.h" #include "event_data.h" #include "field_effect.h" @@ -1900,7 +1901,7 @@ static void AddBirchSpeechObjects(u8 taskId) gSprites[brendanSpriteId].invisible = TRUE; gSprites[brendanSpriteId].oam.priority = 0; gTasks[taskId].tBrendanSpriteId = brendanSpriteId; - maySpriteId = CreateTrainerSprite(FacilityClassToPicIndex(FACILITY_CLASS_MAY), 120, 60, 0, &gDecompressionBuffer[0x800]); + maySpriteId = CreateTrainerSprite(FacilityClassToPicIndex(FACILITY_CLASS_MAY), 120, 60, 0, &gDecompressionBuffer[TRAINER_PIC_SIZE]); gSprites[maySpriteId].callback = SpriteCB_Null; gSprites[maySpriteId].invisible = TRUE; gSprites[maySpriteId].oam.priority = 0; diff --git a/src/palette.c b/src/palette.c index 43a4c213c..e36066462 100644 --- a/src/palette.c +++ b/src/palette.c @@ -440,7 +440,7 @@ static u8 UpdateNormalPaletteFade(void) else { selectedPalettes = gPaletteFade_selectedPalettes >> 16; - paletteOffset = 256; + paletteOffset = OBJ_PLTT_OFFSET; } while (selectedPalettes) diff --git a/src/region_map.c b/src/region_map.c index f6123359b..7d5fe9365 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -1419,7 +1419,7 @@ void CreateRegionMapCursor(u16 tileTag, u16 paletteTag) sRegionMap->cursorSprite->y = 8 * sRegionMap->cursorPosY + 4; } sRegionMap->cursorSprite->data[1] = 2; - sRegionMap->cursorSprite->data[2] = (IndexOfSpritePaletteTag(paletteTag) << 4) + 0x101; + sRegionMap->cursorSprite->data[2] = OBJ_PLTT_ID(IndexOfSpritePaletteTag(paletteTag)) + 1; sRegionMap->cursorSprite->data[3] = TRUE; } } diff --git a/src/secret_base.c b/src/secret_base.c index 1a4a0ac9c..9509cd0fc 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -47,6 +47,8 @@ #include "constants/songs.h" #include "constants/trainers.h" +#define TAG_SCROLL_ARROW 5112 + // Values for registryStatus enum { UNREGISTERED, @@ -985,7 +987,7 @@ static void FinalizeRegistryMenu(u8 taskId) static void AddRegistryMenuScrollArrows(u8 taskId) { s16 *data = gTasks[taskId].data; - tArrowTaskId = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 188, 12, 148, tNumBases - tMaxShownItems, 0x13f8, 0x13f8, &tScrollOffset); + tArrowTaskId = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 188, 12, 148, tNumBases - tMaxShownItems, TAG_SCROLL_ARROW, TAG_SCROLL_ARROW, &tScrollOffset); } static void HandleRegistryMenuInput(u8 taskId)