diff options
author | GriffinR <griffin.richards@comcast.net> | 2019-11-18 12:45:56 -0500 |
---|---|---|
committer | GriffinR <griffin.richards@comcast.net> | 2019-11-18 12:47:10 -0500 |
commit | a486c8affd35bec6e3b71c8c1bfbaba2dc94ec4b (patch) | |
tree | 062ac919817dbfa142929167da4e131c2dc58d49 /src | |
parent | fc3783b7395b25d290ec650d79fbdc80518046cd (diff) | |
parent | 5393b42f7ccfd10986a9a253e29ce54fae847a78 (diff) |
Begin documenting Apprentice, merge with master
Diffstat (limited to 'src')
-rw-r--r-- | src/battle_message.c | 9 | ||||
-rw-r--r-- | src/battle_setup.c | 25 | ||||
-rw-r--r-- | src/battle_tower.c | 45 | ||||
-rw-r--r-- | src/contest.c | 67 | ||||
-rw-r--r-- | src/data/battle_frontier/battle_frontier_exchange_corner.h | 60 | ||||
-rw-r--r-- | src/data/battle_frontier/trainer_hill.h | 129 | ||||
-rw-r--r-- | src/data/contest_text_tables.h | 765 | ||||
-rwxr-xr-x | src/ereader_helpers.c | 6 | ||||
-rw-r--r-- | src/field_control_avatar.c | 21 | ||||
-rw-r--r-- | src/field_special_scene.c | 67 | ||||
-rw-r--r-- | src/field_specials.c | 209 | ||||
-rw-r--r-- | src/fieldmap.c | 2 | ||||
-rw-r--r-- | src/frontier_util.c | 68 | ||||
-rw-r--r-- | src/overworld.c | 7 | ||||
-rw-r--r-- | src/strings.c | 10 | ||||
-rw-r--r-- | src/trainer_hill.c | 467 | ||||
-rw-r--r-- | src/tv.c | 38 |
17 files changed, 1014 insertions, 981 deletions
diff --git a/src/battle_message.c b/src/battle_message.c index fd4213baf..1701f26ec 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -24,6 +24,7 @@ #include "constants/items.h" #include "constants/moves.h" #include "constants/trainers.h" +#include "constants/trainer_hill.h" struct BattleWindowText { @@ -2574,7 +2575,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) } else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL) { - CopyTrainerHillTrainerText(4, gTrainerBattleOpponent_A); + CopyTrainerHillTrainerText(TRAINER_HILL_TEXT_PLAYER_WON, gTrainerBattleOpponent_A); toCpy = gStringVar4; } else @@ -2590,7 +2591,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) } else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL) { - CopyTrainerHillTrainerText(3, gTrainerBattleOpponent_A); + CopyTrainerHillTrainerText(TRAINER_HILL_TEXT_PLAYER_LOST, gTrainerBattleOpponent_A); toCpy = gStringVar4; } break; @@ -2671,7 +2672,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) } else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL) { - CopyTrainerHillTrainerText(4, gTrainerBattleOpponent_B); + CopyTrainerHillTrainerText(TRAINER_HILL_TEXT_PLAYER_WON, gTrainerBattleOpponent_B); toCpy = gStringVar4; } else @@ -2687,7 +2688,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst) } else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL) { - CopyTrainerHillTrainerText(3, gTrainerBattleOpponent_B); + CopyTrainerHillTrainerText(TRAINER_HILL_TEXT_PLAYER_LOST, gTrainerBattleOpponent_B); toCpy = gStringVar4; } break; diff --git a/src/battle_setup.c b/src/battle_setup.c index 77d98def7..b98b5df06 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -1,25 +1,18 @@ #include "global.h" -#include "constants/trainers.h" #include "battle.h" -#include "constants/battle_setup.h" #include "battle_setup.h" #include "battle_transition.h" #include "main.h" #include "task.h" #include "safari_zone.h" #include "script.h" -#include "constants/game_stat.h" #include "event_data.h" -#include "constants/species.h" -#include "constants/songs.h" #include "metatile_behavior.h" -#include "constants/maps.h" #include "field_player_avatar.h" #include "fieldmap.h" #include "random.h" #include "starter_choose.h" #include "script_pokemon_80F8.h" -#include "constants/items.h" #include "palette.h" #include "window.h" #include "event_object_movement.h" @@ -42,10 +35,18 @@ #include "fldeff_misc.h" #include "field_control_avatar.h" #include "mirage_tower.h" -#include "constants/map_types.h" -#include "constants/battle_frontier.h" #include "field_screen_effect.h" #include "data.h" +#include "constants/battle_frontier.h" +#include "constants/battle_setup.h" +#include "constants/game_stat.h" +#include "constants/items.h" +#include "constants/songs.h" +#include "constants/map_types.h" +#include "constants/maps.h" +#include "constants/species.h" +#include "constants/trainers.h" +#include "constants/trainer_hill.h" enum { @@ -1140,7 +1141,7 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data) case TRAINER_BATTLE_SET_TRAINER_B: TrainerBattleLoadArgs(sTrainerBOrdinaryBattleParams, data); return NULL; - case TRAINER_BATTLE_12: + case TRAINER_BATTLE_HILL: if (gApproachingTrainerId == 0) { TrainerBattleLoadArgs(sOrdinaryBattleParams, data); @@ -1364,9 +1365,9 @@ void ShowTrainerIntroSpeech(void) else if (InTrainerHillChallenge()) { if (gNoOfApproachingTrainers == 0 || gNoOfApproachingTrainers == 1) - CopyTrainerHillTrainerText(2, LocalIdToHillTrainerId(gSpecialVar_LastTalked)); + CopyTrainerHillTrainerText(TRAINER_HILL_TEXT_INTRO, LocalIdToHillTrainerId(gSpecialVar_LastTalked)); else - CopyTrainerHillTrainerText(2, LocalIdToHillTrainerId(gEventObjects[gApproachingTrainers[gApproachingTrainerId].eventObjectId].localId)); + CopyTrainerHillTrainerText(TRAINER_HILL_TEXT_INTRO, LocalIdToHillTrainerId(gEventObjects[gApproachingTrainers[gApproachingTrainerId].eventObjectId].localId)); sub_80982B8(); } diff --git a/src/battle_tower.c b/src/battle_tower.c index a6e816b7d..27fdc9d6e 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -24,6 +24,7 @@ #include "tv.h" #include "battle_factory.h" #include "constants/battle_frontier.h" +#include "constants/battle_tower.h" #include "constants/items.h" #include "constants/trainers.h" #include "constants/event_objects.h" @@ -52,7 +53,7 @@ static void AwardBattleTowerRibbons(void); static void SaveBattleTowerProgress(void); static void sub_8163914(void); static void nullsub_61(void); -static void SpriteCB_Null6(void); +static void nullsub_116(void); static void sub_81642A0(void); static void sub_8164828(void); static void sub_8164B74(void); @@ -1051,24 +1052,24 @@ struct #include "data/battle_frontier/battle_tent.h" -static void (* const gUnknown_085DF96C[])(void) = -{ - sub_8161F94, - sub_8162054, - sub_81620F4, - ChooseNextBattleTowerTrainer, - sub_81621C0, - AwardBattleTowerRibbons, - SaveBattleTowerProgress, - sub_8163914, - nullsub_61, - SpriteCB_Null6, - sub_81642A0, - sub_8164828, - sub_8164B74, - sub_8164DCC, - sub_8164DE4, - sub_8164E04, +static void (* const sBattleTowerFuncs[])(void) = +{ + [BATTLE_TOWER_FUNC_0] = sub_8161F94, + [BATTLE_TOWER_FUNC_1] = sub_8162054, + [BATTLE_TOWER_FUNC_2] = sub_81620F4, + [BATTLE_TOWER_FUNC_CHOOSE_TRAINER] = ChooseNextBattleTowerTrainer, + [BATTLE_TOWER_FUNC_4] = sub_81621C0, + [BATTLE_TOWER_FUNC_GIVE_RIBBONS] = AwardBattleTowerRibbons, + [BATTLE_TOWER_FUNC_SAVE] = SaveBattleTowerProgress, + [BATTLE_TOWER_FUNC_7] = sub_8163914, + [BATTLE_TOWER_FUNC_NOP] = nullsub_61, + [BATTLE_TOWER_FUNC_NOP2] = nullsub_116, + [BATTLE_TOWER_FUNC_10] = sub_81642A0, + [BATTLE_TOWER_FUNC_11] = sub_8164828, + [BATTLE_TOWER_FUNC_12] = sub_8164B74, + [BATTLE_TOWER_FUNC_13] = sub_8164DCC, + [BATTLE_TOWER_FUNC_14] = sub_8164DE4, + [BATTLE_TOWER_FUNC_15] = sub_8164E04, }; static const u32 gUnknown_085DF9AC[][2] = @@ -1145,9 +1146,9 @@ static const u16 gUnknown_085DFA52[] = }; // code -void sub_8161F74(void) +void CallBattleTowerFunc(void) { - gUnknown_085DF96C[gSpecialVar_0x8004](); + sBattleTowerFuncs[gSpecialVar_0x8004](); } static void sub_8161F94(void) @@ -2438,7 +2439,7 @@ static void nullsub_61(void) } -static void SpriteCB_Null6(void) +static void nullsub_116(void) { } diff --git a/src/contest.c b/src/contest.c index 8191f7a39..4830e05d5 100644 --- a/src/contest.c +++ b/src/contest.c @@ -246,29 +246,8 @@ EWRAM_DATA u8 gUnknown_02039F5D = 0; u32 gContestRngValue; extern const u8 gText_LinkStandby4[]; -extern const u8 gText_0827D55A[]; -extern const u8 gText_0827E793[]; -extern const u8 gText_0827E32E[]; -extern const u8 gText_0827E35B[]; -extern const u8 gText_0827E38D[]; -extern const u8 gText_0827E2FE[]; -extern const u8 gText_RepeatedAppeal[]; -extern const u8 gText_0827E73C[]; -extern const u8 gText_0827E717[]; -extern const u8 gText_0827E76A[]; -extern const u8 gText_0827E7EA[]; -extern const u8 gText_0827E817[]; -extern const u8 gText_0827E58A[]; -extern const u8 gText_0827D56F[]; -extern const u8 gText_0827D597[]; -extern const u8 gText_Contest_Shyness[]; -extern const u8 gText_Contest_Anxiety[]; -extern const u8 gText_Contest_Laziness[]; -extern const u8 gText_Contest_Hesitancy[]; -extern const u8 gText_Contest_Fear[]; extern const u8 gText_BDot[]; extern const u8 gText_CDot[]; -extern const u8 *const gUnknown_08587E10[]; extern void (*const gContestEffectFuncs[])(void); static const u8 gUnknown_08587A6C[] = @@ -1345,9 +1324,9 @@ static void sub_80D833C(u8 taskId) DmaCopy32Defvars(3, gPlttBufferUnfaded, eUnknownHeap1A004.unk18204, PLTT_BUFFER_SIZE * 2); ConvertIntToDecimalStringN(gStringVar1, eContest.turnNumber + 1, STR_CONV_MODE_LEFT_ALIGN, 1); if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex)) - StringCopy(gDisplayedStringBattle, gText_0827D507); + StringCopy(gDisplayedStringBattle, gText_AppealNumWhichMoveWillBePlayed); else - StringCopy(gDisplayedStringBattle, gText_0827D531); + StringCopy(gDisplayedStringBattle, gText_AppealNumButItCantParticipate); ContestClearGeneralTextWindow(); StringExpandPlaceholders(gStringVar4, gDisplayedStringBattle); Contest_StartTextPrinter(gStringVar4, TRUE); @@ -1443,9 +1422,9 @@ static void sub_80D8610(u8 taskId) sub_80DC490(FALSE); ConvertIntToDecimalStringN(gStringVar1, eContest.turnNumber + 1, STR_CONV_MODE_LEFT_ALIGN, 1); if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex)) - StringCopy(gDisplayedStringBattle, gText_0827D507); + StringCopy(gDisplayedStringBattle, gText_AppealNumWhichMoveWillBePlayed); else - StringCopy(gDisplayedStringBattle, gText_0827D531); + StringCopy(gDisplayedStringBattle, gText_AppealNumButItCantParticipate); ContestClearGeneralTextWindow(); StringExpandPlaceholders(gStringVar4, gDisplayedStringBattle); Contest_StartTextPrinter(gStringVar4, 0); @@ -1673,8 +1652,8 @@ static void sub_80D8B38(u8 taskId) if (eContestantStatus[r6].currMove < MOVES_COUNT) StringCopy(gStringVar2, gMoveNames[eContestantStatus[r6].currMove]); else - StringCopy(gStringVar2, gUnknown_08587F1C[eContestantStatus[r6].moveCategory]); - StringExpandPlaceholders(gStringVar4, gText_0827D55A); + StringCopy(gStringVar2, sInvalidContestMoveNames[eContestantStatus[r6].moveCategory]); + StringExpandPlaceholders(gStringVar4, gText_MonAppealedWithMove); Contest_StartTextPrinter(gStringVar4, 1); gTasks[taskId].data[0] = 6; } @@ -1932,7 +1911,7 @@ static void sub_80D8B38(u8 taskId) { ContestClearGeneralTextWindow(); StringCopy(gStringVar1, gContestMons[r6].nickname); - StringExpandPlaceholders(gStringVar4, gText_0827E793); + StringExpandPlaceholders(gStringVar4, gText_MonCantAppealNextTurn); Contest_StartTextPrinter(gStringVar4, 1); } gTasks[taskId].data[0] = 52; @@ -1953,11 +1932,11 @@ static void sub_80D8B38(u8 taskId) { ContestClearGeneralTextWindow(); if (r3 == 1) - Contest_StartTextPrinter(gText_0827E32E, TRUE); + Contest_StartTextPrinter(gText_AppealComboWentOverWell, TRUE); else if (r3 == 2) - Contest_StartTextPrinter(gText_0827E35B, TRUE); + Contest_StartTextPrinter(gText_AppealComboWentOverVeryWell, TRUE); else - Contest_StartTextPrinter(gText_0827E38D, TRUE); + Contest_StartTextPrinter(gText_AppealComboWentOverExcellently, TRUE); sub_80DD720(3); gTasks[taskId].data[10] = 0; gTasks[taskId].data[0] = 45; @@ -1966,7 +1945,7 @@ static void sub_80D8B38(u8 taskId) { ContestClearGeneralTextWindow(); StringCopy(gStringVar1, gContestMons[r6].nickname); - StringExpandPlaceholders(gStringVar4, gText_0827E2FE); + StringExpandPlaceholders(gStringVar4, gText_JudgeLookedAtMonExpectantly); Contest_StartTextPrinter(gStringVar4, 1); sub_80DD720(2); gTasks[taskId].data[10] = 0; @@ -2056,7 +2035,7 @@ static void sub_80D8B38(u8 taskId) } else { - StringCopy(gStringVar3, gUnknown_08587F08[gContestMoves[eContestantStatus[r6].currMove].contestCategory]); + StringCopy(gStringVar3, sContestConditions[gContestMoves[eContestantStatus[r6].currMove].contestCategory]); } if (r3 > 0) { @@ -2075,11 +2054,11 @@ static void sub_80D8B38(u8 taskId) else { if (r3 < 0) - StringExpandPlaceholders(gStringVar4, gText_0827E73C); + StringExpandPlaceholders(gStringVar4, gText_MonsXDidntGoOverWell); else if (r3 > 0 && eContest.applauseLevel <= 4) - StringExpandPlaceholders(gStringVar4, gText_0827E717); + StringExpandPlaceholders(gStringVar4, gText_MonsXWentOverGreat); else - StringExpandPlaceholders(gStringVar4, gText_0827E76A); + StringExpandPlaceholders(gStringVar4, gText_MonsXGotTheCrowdGoing); Contest_StartTextPrinter(gStringVar4, 1); gTasks[taskId].data[10] = 0; gTasks[taskId].data[11] = 0; @@ -2189,7 +2168,7 @@ static void sub_80D8B38(u8 taskId) StringCopy(gStringVar3, gContestMons[gContestResources->field_10->excitementFreezer].nickname); StringCopy(gStringVar1, gContestMons[r6].nickname); StringCopy(gStringVar2, gMoveNames[eContestantStatus[r6].currMove]); - StringExpandPlaceholders(gStringVar4, gText_0827E7EA); + StringExpandPlaceholders(gStringVar4, gText_CrowdContinuesToWatchMon); Contest_StartTextPrinter(gStringVar4, TRUE); gTasks[taskId].data[0] = 58; return; @@ -2197,7 +2176,7 @@ static void sub_80D8B38(u8 taskId) if (!Contest_RunTextPrinters()) { ContestClearGeneralTextWindow(); - StringExpandPlaceholders(gStringVar4, gText_0827E817); + StringExpandPlaceholders(gStringVar4, gText_MonsMoveIsIgnored); Contest_StartTextPrinter(gStringVar4, TRUE); gTasks[taskId].data[0] = 59; } @@ -2215,7 +2194,7 @@ static void sub_80D8B38(u8 taskId) sub_80DC9B4(r6); StringCopy(gStringVar1, gContestMons[r6].nickname); StringCopy(gStringVar2, gMoveNames[eContestantStatus[r6].currMove]); - StringExpandPlaceholders(gStringVar4, gText_0827E58A); + StringExpandPlaceholders(gStringVar4, gText_MonWasTooNervousToMove); Contest_StartTextPrinter(gStringVar4, TRUE); gTasks[taskId].data[0] = 34; return; @@ -2259,7 +2238,7 @@ static void sub_80D8B38(u8 taskId) case 31: ContestClearGeneralTextWindow(); StringCopy(gStringVar1, gContestMons[r6].nickname); - StringExpandPlaceholders(gStringVar4, gText_0827D56F); + StringExpandPlaceholders(gStringVar4, gText_MonWasWatchingOthers); Contest_StartTextPrinter(gStringVar4, TRUE); gTasks[taskId].data[0] = 32; return; @@ -2427,11 +2406,11 @@ static void sub_80DA3CC(u8 taskId) { if (gTasks[taskId].data[0] == 0) { - u8 r4 = eContestantStatus[gContestPlayerMonIndex].attentionLevel; + u8 attention = eContestantStatus[gContestPlayerMonIndex].attentionLevel; ContestClearGeneralTextWindow(); StringCopy(gStringVar1, gContestMons[gContestPlayerMonIndex].nickname); - StringExpandPlaceholders(gStringVar4, gUnknown_08587D90[r4]); + StringExpandPlaceholders(gStringVar4, sRoundResultTexts[attention]); Contest_StartTextPrinter(gStringVar4, TRUE); gTasks[taskId].data[0]++; } @@ -2522,7 +2501,7 @@ static void sub_80DA5E8(u8 taskId) ContestDebugPrintBitStrings(); } gContestRngValue = gRngValue; - StringExpandPlaceholders(gStringVar4, gText_0827D597); + StringExpandPlaceholders(gStringVar4, gText_AllOutOfAppealTime); Contest_StartTextPrinter(gStringVar4, TRUE); gTasks[taskId].data[2] = 0; gTasks[taskId].func = sub_80DA6B4; @@ -4381,7 +4360,7 @@ static void sub_80DD45C(u8 contestant, u8 stringId) StringCopy(gStringVar3, gText_Contest_Hesitancy); else StringCopy(gStringVar3, gText_Contest_Fear); - StringExpandPlaceholders(gStringVar4, gUnknown_08587E10[stringId]); + StringExpandPlaceholders(gStringVar4, sAppealResultTexts[stringId]); ContestClearGeneralTextWindow(); Contest_StartTextPrinter(gStringVar4, 1); } diff --git a/src/data/battle_frontier/battle_frontier_exchange_corner.h b/src/data/battle_frontier/battle_frontier_exchange_corner.h index bcb3cdd62..d29dbdc44 100644 --- a/src/data/battle_frontier/battle_frontier_exchange_corner.h +++ b/src/data/battle_frontier/battle_frontier_exchange_corner.h @@ -50,50 +50,50 @@ static const u16 sFrontierExchangeCorner_HoldItems[] = static const u8 *const sFrontierExchangeCorner_Decor1Descriptions[] = { - BattleFrontier_BattlePointExchangeServiceCorner_Text_2601AA, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2601D0, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260201, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26022F, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26025B, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260287, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2602B5, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2602E0, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26030F, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26033E, + BattleFrontier_ExchangeServiceCorner_Text_KissPosterDesc, + BattleFrontier_ExchangeServiceCorner_Text_KissCushionDesc, + BattleFrontier_ExchangeServiceCorner_Text_SmoochumDollDesc, + BattleFrontier_ExchangeServiceCorner_Text_TogepiDollDesc, + BattleFrontier_ExchangeServiceCorner_Text_MeowthDollDesc, + BattleFrontier_ExchangeServiceCorner_Text_ClefairyDollDesc, + BattleFrontier_ExchangeServiceCorner_Text_DittoDollDesc, + BattleFrontier_ExchangeServiceCorner_Text_CyndaquilDollDesc, + BattleFrontier_ExchangeServiceCorner_Text_ChikoritaDollDesc, + BattleFrontier_ExchangeServiceCorner_Text_TotodileDollDesc, gText_Exit, }; static const u8 *const sFrontierExchangeCorner_Decor2Descriptions[] = { - BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + BattleFrontier_ExchangeServiceCorner_Text_LargeDollDesc, + BattleFrontier_ExchangeServiceCorner_Text_LargeDollDesc, + BattleFrontier_ExchangeServiceCorner_Text_LargeDollDesc, + BattleFrontier_ExchangeServiceCorner_Text_LargeDollDesc, + BattleFrontier_ExchangeServiceCorner_Text_LargeDollDesc, gText_Exit }; static const u8 *const sFrontierExchangeCorner_VitaminsDescriptions[] = { - BattleFrontier_BattlePointExchangeServiceCorner_Text_260397, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2603BE, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2603E6, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26040E, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260436, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26045C, + BattleFrontier_ExchangeServiceCorner_Text_ProteinDesc, + BattleFrontier_ExchangeServiceCorner_Text_CalciumDesc, + BattleFrontier_ExchangeServiceCorner_Text_IronDesc, + BattleFrontier_ExchangeServiceCorner_Text_ZincDesc, + BattleFrontier_ExchangeServiceCorner_Text_CarbosDesc, + BattleFrontier_ExchangeServiceCorner_Text_HPUpDesc, gText_Exit }; static const u8 *const sFrontierExchangeCorner_HoldItemsDescriptions[] = { - BattleFrontier_BattlePointExchangeServiceCorner_Text_26047A, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2604AC, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2604D8, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26050F, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260542, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260575, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2605A8, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2605E2, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260613, + BattleFrontier_ExchangeServiceCorner_Text_LeftoversDesc, + BattleFrontier_ExchangeServiceCorner_Text_WhiteHerbDesc, + BattleFrontier_ExchangeServiceCorner_Text_QuickClawDesc, + BattleFrontier_ExchangeServiceCorner_Text_MentalHerbDesc, + BattleFrontier_ExchangeServiceCorner_Text_BrightpowderDesc, + BattleFrontier_ExchangeServiceCorner_Text_ChoiceBandDesc, + BattleFrontier_ExchangeServiceCorner_Text_KingsRockDesc, + BattleFrontier_ExchangeServiceCorner_Text_FocusBandDesc, + BattleFrontier_ExchangeServiceCorner_Text_ScopeLensDesc, gText_Exit }; diff --git a/src/data/battle_frontier/trainer_hill.h b/src/data/battle_frontier/trainer_hill.h index 54d49422a..f38cfcc38 100644 --- a/src/data/battle_frontier/trainer_hill.h +++ b/src/data/battle_frontier/trainer_hill.h @@ -1,16 +1,17 @@ #define TRAINER_HILL_OTID 0x10000000 -static const struct TrHillTag gUnknown_0862609C = { - .unkField_0 = 4, +static const struct TrHillTag sDataTagJPDefault = { + .numTrainers = NUM_TRAINER_HILL_TRAINERS_JP, .unused1 = 1, - .numFloors = 2, + .numFloors = NUM_TRAINER_HILL_FLOORS_JP, .checksum = 0x0 }; -static const struct TrHillFloor gUnknown_0862609C_floors[] = { + +static const struct TrHillFloor sDataTagJPDefault_Floors[] = { [0] = { - .unk0 = 0, - .unk1 = 0, + .trainerNum1 = 0, + .trainerNum2 = 0, .trainers = { [0] = { .name = __("シゲノブ$$$$ "), @@ -33,7 +34,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = { .speedEV = 100, .spAttackEV = 0, .spDefenseEV = 100, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -57,7 +58,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = { .speedEV = 0, .spAttackEV = 150, .spDefenseEV = 120, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -81,7 +82,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = { .speedEV = 0, .spAttackEV = 0, .spDefenseEV = 200, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -122,7 +123,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = { .speedEV = 0, .spAttackEV = 100, .spDefenseEV = 100, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -146,7 +147,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = { .speedEV = 0, .spAttackEV = 100, .spDefenseEV = 100, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -170,7 +171,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = { .speedEV = 0, .spAttackEV = 100, .spDefenseEV = 100, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -194,8 +195,8 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = { } }, [1] = { - .unk0 = 0, - .unk1 = 0, + .trainerNum1 = 0, + .trainerNum2 = 0, .trainers = { [0] = { .name = __("シゲゾウ$$$$ "), @@ -218,7 +219,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = { .speedEV = 120, .spAttackEV = 150, .spDefenseEV = 0, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -242,7 +243,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = { .speedEV = 0, .spAttackEV = 100, .spDefenseEV = 100, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -266,7 +267,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = { .speedEV = 0, .spAttackEV = 110, .spDefenseEV = 100, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -307,7 +308,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = { .speedEV = 0, .spAttackEV = 110, .spDefenseEV = 100, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -331,7 +332,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = { .speedEV = 100, .spAttackEV = 110, .spDefenseEV = 100, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -355,7 +356,7 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = { .speedEV = 80, .spAttackEV = 80, .spDefenseEV = 80, - .otId = 0x10000000, + .otId = TRAINER_HILL_OTID, .hpIV = 5, .attackIV = 5, .defenseIV = 5, @@ -382,18 +383,18 @@ static const struct TrHillFloor gUnknown_0862609C_floors[] = { static const struct TrHillTag sDataTagNormal = { - .unkField_0 = 8, + .numTrainers = NUM_TRAINER_HILL_TRAINERS, .unused1 = 2, - .numFloors = 4, + .numFloors = NUM_TRAINER_HILL_FLOORS, .checksum = 0x00051E05 }; -static const struct TrHillFloor sDataTagNormal_floors[] = +static const struct TrHillFloor sDataTagNormal_Floors[] = { [0] = { - .unk0 = 0x11, - .unk1 = 0x12, + .trainerNum1 = 17, + .trainerNum2 = 18, .trainers = { [0] = @@ -694,8 +695,8 @@ static const struct TrHillFloor sDataTagNormal_floors[] = }, [1] = { - .unk0 = 0x13, - .unk1 = 0x14, + .trainerNum1 = 19, + .trainerNum2 = 20, .trainers = { [0] = @@ -999,8 +1000,8 @@ static const struct TrHillFloor sDataTagNormal_floors[] = }, [2] = { - .unk0 = 0x15, - .unk1 = 0x16, + .trainerNum1 = 21, + .trainerNum2 = 22, .trainers = { [0] = @@ -1303,8 +1304,8 @@ static const struct TrHillFloor sDataTagNormal_floors[] = }, [3] = { - .unk0 = 0x17, - .unk1 = 0x18, + .trainerNum1 = 23, + .trainerNum2 = 24, .trainers = { [0] = @@ -1602,17 +1603,17 @@ static const struct TrHillFloor sDataTagNormal_floors[] = static const struct TrHillTag sDataTagVariety = { - .unkField_0 = 8, + .numTrainers = NUM_TRAINER_HILL_TRAINERS, .unused1 = 1, - .numFloors = 4, + .numFloors = NUM_TRAINER_HILL_FLOORS, .checksum = 0x00054C15 }; -static const struct TrHillFloor sDataTagVariety_floors[] = { +static const struct TrHillFloor sDataTagVariety_Floors[] = { [0] = { - .unk0 = 0x29, - .unk1 = 0x2A, + .trainerNum1 = 41, + .trainerNum2 = 42, .trainers = { [0] = @@ -1904,8 +1905,8 @@ static const struct TrHillFloor sDataTagVariety_floors[] = { }, [1] = { - .unk0 = 0x2B, - .unk1 = 0x2C, + .trainerNum1 = 43, + .trainerNum2 = 44, .trainers = { [0] = @@ -2227,8 +2228,8 @@ static const struct TrHillFloor sDataTagVariety_floors[] = { }, [2] = { - .unk0 = 0x2D, - .unk1 = 0x2E, + .trainerNum1 = 45, + .trainerNum2 = 46, .trainers = { [0] = @@ -2531,8 +2532,8 @@ static const struct TrHillFloor sDataTagVariety_floors[] = { }, [3] = { - .unk0 = 0x2F, - .unk1 = 0x30, + .trainerNum1 = 47, + .trainerNum2 = 48, .trainers = { [0] = @@ -2828,17 +2829,17 @@ static const struct TrHillFloor sDataTagVariety_floors[] = { static const struct TrHillTag sDataTagUnique = { - .unkField_0 = 8, + .numTrainers = NUM_TRAINER_HILL_TRAINERS, .unused1 = 3, - .numFloors = 4, + .numFloors = NUM_TRAINER_HILL_FLOORS, .checksum = 0x000652F3 }; -static const struct TrHillFloor sDataTagUnique_floors[] = { +static const struct TrHillFloor sDataTagUnique_Floors[] = { [0] = { - .unk0 = 0x31, - .unk1 = 0x32, + .trainerNum1 = 49, + .trainerNum2 = 50, .trainers = { [0] = @@ -3135,8 +3136,8 @@ static const struct TrHillFloor sDataTagUnique_floors[] = { }, [1] = { - .unk0 = 0x33, - .unk1 = 0x34, + .trainerNum1 = 51, + .trainerNum2 = 52, .trainers = { [0] = @@ -3439,8 +3440,8 @@ static const struct TrHillFloor sDataTagUnique_floors[] = { }, [2] = { - .unk0 = 0x35, - .unk1 = 0x36, + .trainerNum1 = 53, + .trainerNum2 = 54, .trainers = { [0] = @@ -3743,8 +3744,8 @@ static const struct TrHillFloor sDataTagUnique_floors[] = { }, [3] = { - .unk0 = 0x38, - .unk1 = 0x37, + .trainerNum1 = 56, + .trainerNum2 = 55, .trainers = { [0] = @@ -4039,17 +4040,17 @@ static const struct TrHillFloor sDataTagUnique_floors[] = { static const struct TrHillTag sDataTagExpert = { - .unkField_0 = 8, + .numTrainers = NUM_TRAINER_HILL_TRAINERS, .unused1 = 1, - .numFloors = 4, + .numFloors = NUM_TRAINER_HILL_FLOORS, .checksum = 0x00061F3F }; -static const struct TrHillFloor sDataTagExpert_floors[] = { +static const struct TrHillFloor sDataTagExpert_Floors[] = { [0] = { - .unk0 = 0x39, - .unk1 = 0x3A, + .trainerNum1 = 57, + .trainerNum2 = 58, .trainers = { [0] = @@ -4353,8 +4354,8 @@ static const struct TrHillFloor sDataTagExpert_floors[] = { }, [1] = { - .unk0 = 0x3B, - .unk1 = 0x3C, + .trainerNum1 = 59, + .trainerNum2 = 60, .trainers = { [0] = @@ -4658,8 +4659,8 @@ static const struct TrHillFloor sDataTagExpert_floors[] = { }, [2] = { - .unk0 = 0x3D, - .unk1 = 0x3E, + .trainerNum1 = 61, + .trainerNum2 = 62, .trainers = { [0] = @@ -4963,8 +4964,8 @@ static const struct TrHillFloor sDataTagExpert_floors[] = { }, [3] = { - .unk0 = 0x3F, - .unk1 = 0x40, + .trainerNum1 = 63, + .trainerNum2 = 64, .trainers = { [0] = diff --git a/src/data/contest_text_tables.h b/src/data/contest_text_tables.h index 8375520d1..f893bc66a 100644 --- a/src/data/contest_text_tables.h +++ b/src/data/contest_text_tables.h @@ -1,414 +1,439 @@ #include "global.h" -extern const u8 gContestEffect00hDescription[]; -extern const u8 gContestEffect01hDescription[]; -extern const u8 gContestEffect02hDescription[]; -extern const u8 gContestEffect03hDescription[]; -extern const u8 gContestEffect04hDescription[]; -extern const u8 gContestEffect05hDescription[]; -extern const u8 gContestEffect06hDescription[]; -extern const u8 gContestEffect07hDescription[]; -extern const u8 gContestEffect08hDescription[]; -extern const u8 gContestEffect09hDescription[]; -extern const u8 gContestEffect0AhDescription[]; -extern const u8 gContestEffect0BhDescription[]; -extern const u8 gContestEffect0ChDescription[]; -extern const u8 gContestEffect0DhDescription[]; -extern const u8 gContestEffect0EhDescription[]; -extern const u8 gContestEffect0FhDescription[]; -extern const u8 gContestEffect10hDescription[]; -extern const u8 gContestEffect11hDescription[]; -extern const u8 gContestEffect12hDescription[]; -extern const u8 gContestEffect13hDescription[]; -extern const u8 gContestEffect14hDescription[]; -extern const u8 gContestEffect15hDescription[]; -extern const u8 gContestEffect16hDescription[]; -extern const u8 gContestEffect17hDescription[]; -extern const u8 gContestEffect18hDescription[]; -extern const u8 gContestEffect19hDescription[]; -extern const u8 gContestEffect1AhDescription[]; -extern const u8 gContestEffect1BhDescription[]; -extern const u8 gContestEffect1ChDescription[]; -extern const u8 gContestEffect1DhDescription[]; -extern const u8 gContestEffect1EhDescription[]; -extern const u8 gContestEffect1FhDescription[]; -extern const u8 gContestEffect20hDescription[]; -extern const u8 gContestEffect21hDescription[]; -extern const u8 gContestEffect22hDescription[]; -extern const u8 gContestEffect23hDescription[]; -extern const u8 gContestEffect24hDescription[]; -extern const u8 gContestEffect25hDescription[]; -extern const u8 gContestEffect26hDescription[]; -extern const u8 gContestEffect27hDescription[]; -extern const u8 gContestEffect28hDescription[]; -extern const u8 gContestEffect29hDescription[]; -extern const u8 gContestEffect2AhDescription[]; -extern const u8 gContestEffect2BhDescription[]; -extern const u8 gContestEffect2ChDescription[]; -extern const u8 gContestEffect2DhDescription[]; -extern const u8 gContestEffect2EhDescription[]; -extern const u8 gContestEffect2FhDescription[]; +// gContestEffectDescriptionPointers +extern const u8 gText_HighlyAppealingMove[]; +extern const u8 gText_UserMoreEasilyStartled[]; +extern const u8 gText_GreatAppealButNoMoreToEnd[]; +extern const u8 gText_UsedRepeatedlyWithoutBoringJudge[]; +extern const u8 gText_AvoidStartledByOthersOnce[]; +extern const u8 gText_AvoidStartledByOthers[]; +extern const u8 gText_AvoidStartledByOthersLittle[]; +extern const u8 gText_UserLessLikelyStartled[]; +extern const u8 gText_SlightlyStartleFrontMon[]; +extern const u8 gText_SlightlyStartleAppealed[]; +extern const u8 gText_StartleAppealedBeforeUser[]; +extern const u8 gText_StartleAllAppealed[]; +extern const u8 gText_BadlyStartleFrontMon[]; +extern const u8 gText_BadlyStartleAppealed[]; +extern const u8 gText_StartleAppealedBeforeUser2[]; +extern const u8 gText_StartleAllAppealed2[]; +extern const u8 gText_ShiftJudgesAttentionFromOthers[]; +extern const u8 gText_StartleMonHasJudgesAttention[]; +extern const u8 gText_JamOthersMissesTurn[]; +extern const u8 gText_StartleMonsMadeSameTypeAppeal[]; +extern const u8 gText_BadlyStartleCoolAppeals[]; +extern const u8 gText_BadlyStartleBeautyAppeals[]; +extern const u8 gText_BadlyStartleCuteAppeals[]; +extern const u8 gText_BadlyStartleSmartAppeals[]; +extern const u8 gText_BadlyStartleToughAppeals[]; +extern const u8 gText_MakeMonAfterUserNervous[]; +extern const u8 gText_MakeAllMonsAfterUserNervous[]; +extern const u8 gText_WorsenConditionOfThoseMadeAppeals[]; +extern const u8 gText_BadlyStartleMonsGoodCondition[]; +extern const u8 gText_AppealGreatIfPerformedFirst[]; +extern const u8 gText_AppealGreatIfPerformedLast[]; +extern const u8 gText_AppealAsGoodAsThoseBeforeIt[]; +extern const u8 gText_AppealAsGoodAsOneBeforeIt[]; +extern const u8 gText_AppealBetterLaterItsPerformed[]; +extern const u8 gText_AppealVariesDependingOnTiming[]; +extern const u8 gText_WorksWellIfSameTypeAsBefore[]; +extern const u8 gText_WorksWellIfDifferentTypeAsBefore[]; +extern const u8 gText_AffectedByAppealInFront[]; +extern const u8 gText_UpsConditionHelpsPreventNervousness[]; +extern const u8 gText_AppealWorksWellIfConditionGood[]; +extern const u8 gText_NextAppealMadeEarlier[]; +extern const u8 gText_NextAppealMadeLater[]; +extern const u8 gText_TurnOrderMoreEasilyScrambled[]; +extern const u8 gText_ScrambleOrderOfNextAppeals[]; +extern const u8 gText_AppealExcitesAudienceInAnyContest[]; +extern const u8 gText_BadlyStartlesMonsGoodAppeals[]; +extern const u8 gText_AppealBestMoreCrowdExcited[]; +extern const u8 gText_TemporarilyStopCrowdExcited[]; -extern const u8 gUnusedContestMoveName0[]; -extern const u8 gUnusedContestMoveName1[]; -extern const u8 gUnusedContestMoveName2[]; -extern const u8 gUnusedContestMoveName3[]; -extern const u8 gUnusedContestMoveName4[]; -extern const u8 gUnusedContestMoveName5[]; -extern const u8 gUnusedContestMoveName6[]; -extern const u8 gUnusedContestMoveName7[]; -extern const u8 gUnusedContestMoveName8[]; -extern const u8 gUnusedContestMoveName9[]; -extern const u8 gUnusedContestMoveName10[]; -extern const u8 gUnusedContestMoveName11[]; -extern const u8 gUnusedContestMoveName12[]; +// sUnusedComboMoveNameTexts +extern const u8 gText_RainDance[]; +extern const u8 gText_Rage[]; +extern const u8 gText_FocusEnergy[]; +extern const u8 gText_Hypnosis[]; +extern const u8 gText_Softboiled[]; +extern const u8 gText_HornAttack[]; +extern const u8 gText_SwordsDance[]; +extern const u8 gText_Conversion[]; +extern const u8 gText_SunnyDay[]; +extern const u8 gText_Rest2[]; +extern const u8 gText_Vicegrip[]; +extern const u8 gText_DefenseCurl[]; +extern const u8 gText_LockOn[]; +// gContestMoveTypeTextPointers extern const u8 gContestMoveTypeCoolText[]; extern const u8 gContestMoveTypeBeautyText[]; extern const u8 gContestMoveTypeCuteText[]; extern const u8 gContestMoveTypeSmartText[]; extern const u8 gContestMoveTypeToughText[]; -extern const u8 gText_0827D5C1[]; -extern const u8 gText_0827D5DC[]; -extern const u8 gText_0827D600[]; -extern const u8 gText_0827D612[]; -extern const u8 gText_0827D612[]; -extern const u8 gText_0827D62D[]; -extern const u8 gText_0827D654[]; -extern const u8 gText_0827D67E[]; -extern const u8 gText_0827D69C[]; -extern const u8 gText_0827D6BA[]; -extern const u8 gText_0827D6E5[]; -extern const u8 gText_0827D706[]; -extern const u8 gText_0827D71D[]; +// sUnusedAppealResultTexts +extern const u8 gText_ButAppealWasJammed[]; +extern const u8 gText_FollowedAnotherMonsLead[]; +extern const u8 gText_ButItMessedUp[]; +extern const u8 gText_WentBetterThanUsual[]; +extern const u8 gText_JudgeLookedAwayForSomeReason[]; +extern const u8 gText_WorkedHardToBuildOnPastMistakes[]; +extern const u8 gText_CantMakeAnyMoreMoves[]; +extern const u8 gText_WorkedFrighteninglyWell[]; +extern const u8 gText_WorkedHardAsStandoutMon[]; +extern const u8 gText_JudgedLookedOnExpectantly[]; +extern const u8 gText_WorkedRatherWell[]; +extern const u8 gText_WorkedLittleBetterThanUsual[]; -extern const u8 gText_0827D743[]; -extern const u8 gText_0827D764[]; -extern const u8 gText_0827D785[]; -extern const u8 gText_0827D7A5[]; -extern const u8 gText_0827D7C8[]; -extern const u8 gText_0827D7E8[]; -extern const u8 gText_0827D831[]; -extern const u8 gText_0827D855[]; -extern const u8 gText_0827D830[]; -extern const u8 gText_0827D872[]; -extern const u8 gText_0827D88F[]; -extern const u8 gText_0827D8B5[]; -extern const u8 gText_0827D8E4[]; -extern const u8 gText_0827D8FE[]; -extern const u8 gText_0827D926[]; -extern const u8 gText_0827D947[]; -extern const u8 gText_0827D961[]; -extern const u8 gText_0827D986[]; -extern const u8 gText_0827D9B1[]; -extern const u8 gText_0827D9D9[]; -extern const u8 gText_0827DA03[]; -extern const u8 gText_0827DA31[]; -extern const u8 gText_0827DA5B[]; -extern const u8 gText_0827DA85[]; -extern const u8 gText_0827DAB2[]; -extern const u8 gText_0827DADA[]; -extern const u8 gText_0827DB03[]; -extern const u8 gText_0827D830[]; -extern const u8 gText_0827D830[]; -extern const u8 gText_0827D830[]; -extern const u8 gText_0827DB1F[]; -extern const u8 gText_0827DB4E[]; +// sRoundResultTexts +extern const u8 gText_MonFailedToStandOutAtAll[]; +extern const u8 gText_MonDidntStandOutVeryMuch[]; +extern const u8 gText_MonCaughtALittleAttention[]; +extern const u8 gText_MonAttractedALotOfAttention[]; +extern const u8 gText_MonCommandedTotalAttention[]; +extern const u8 gText_MonHasntMadeItsAppeal[]; +extern const u8 gText_JudgesViewsOnMonHeldFirm[]; +extern const u8 gText_MonsXChangedPerceptions[]; +extern const u8 gText_EmptyContestString[]; +extern const u8 gText_MonsAppealEffectWoreOff[]; +extern const u8 gText_SpecialAppealsEffectWoreOff[]; +extern const u8 gText_EveryonesAppealsMadeToLookSame[]; +extern const u8 gText_CheapenedMonsAppeal[]; +extern const u8 gText_CheapenedMonsAppeal2[]; +extern const u8 gText_CheapenedAppealOfThoseAhead[]; +extern const u8 gText_CheapenedAppealOfThoseAhead2[]; +extern const u8 gText_StoleAttentionAwayFromMon[]; +extern const u8 gText_SeverelyCheapenedOtherAppeals[]; +extern const u8 gText_AnticipationSwelledForMonsAppealNext[]; +extern const u8 gText_CheapenedJudgesFavoriteAppeal[]; +extern const u8 gText_AppealsOfOthersCheapenedByHalf[]; +extern const u8 gText_StoodOutToMakeUpForBeingJammed[]; +extern const u8 gText_CantParticipateInAppealsAnyMore[]; +extern const u8 gText_TouchedJudgeForFantasticAppeal[]; +extern const u8 gText_AnticipationRoseForUpcomingAppeals[]; +extern const u8 gText_StoodOutAsMuchAsSpecialAppeals[]; +extern const u8 gText_StoodOutAsMuchAsMon[]; +extern const u8 gText_JammedAppealsMadeEvenLessNoticeable[]; +extern const u8 gText_EveryonesAppealsMadeSame[]; -extern const u8 gText_827DB75[]; -extern const u8 gText_827DBB0[]; -extern const u8 gText_827DBE0[]; -extern const u8 gText_827DC0F[]; -extern const u8 gText_827DC45[]; -extern const u8 gText_827DC7C[]; -extern const u8 gText_827DCB4[]; -extern const u8 gText_827DCE7[]; -extern const u8 gText_827DD12[]; -extern const u8 gText_827DD3D[]; -extern const u8 gText_827DD6F[]; -extern const u8 gText_827DD8E[]; -extern const u8 gText_827DDC7[]; -extern const u8 gText_827DDF2[]; -extern const u8 gText_827DE14[]; -extern const u8 gText_827DE44[]; -extern const u8 gText_827DE73[]; -extern const u8 gText_827DEA5[]; -extern const u8 gText_827DED9[]; -extern const u8 gText_827DF02[]; -extern const u8 gText_827DF3A[]; -extern const u8 gText_827DF63[]; -extern const u8 gText_827DF8C[]; -extern const u8 gText_827DFB8[]; -extern const u8 gText_827DFE2[]; -extern const u8 gText_827E00C[]; -extern const u8 gText_827E02F[]; -extern const u8 gText_827E05F[]; -extern const u8 gText_827E08B[]; -extern const u8 gText_827E0B5[]; -extern const u8 gText_827E0DD[]; -extern const u8 gText_827E107[]; -extern const u8 gText_827E143[]; -extern const u8 gText_827E17F[]; -extern const u8 gText_827E1BB[]; -extern const u8 gText_827E1F3[]; -extern const u8 gText_827E220[]; -extern const u8 gText_827E254[]; -extern const u8 gText_827E289[]; -extern const u8 gText_827E2C5[]; -extern const u8 gText_0827E2FE[]; -extern const u8 gText_0827E32E[]; -extern const u8 gText_0827E35B[]; -extern const u8 gText_0827E38D[]; -extern const u8 gText_0827E3C1[]; -extern const u8 gText_0827E3EB[]; -extern const u8 gText_0827E416[]; -extern const u8 gText_0827E448[]; -extern const u8 gText_0827E473[]; -extern const u8 gText_0827E4A6[]; -extern const u8 gText_0827E4D5[]; -extern const u8 gText_0827E504[]; -extern const u8 gText_0827E531[]; -extern const u8 gText_0827E55A[]; -extern const u8 gText_0827E5B2[]; -extern const u8 gText_0827E5D0[]; -extern const u8 gText_0827E606[]; -extern const u8 gText_0827E638[]; -extern const u8 gText_0827E658[]; -extern const u8 gText_0827E68B[]; -extern const u8 gText_0827E6C4[]; -extern const u8 gText_0827E7BA[]; +// sAppealResultTexts +extern const u8 gText_BecameMoreConsciousOfOtherMons[]; +extern const u8 gText_MonCantMakeAnAppealAfterThis[]; +extern const u8 gText_SettledDownJustLittleBit[]; +extern const u8 gText_BecameObliviousToOtherMons[]; +extern const u8 gText_BecameLessAwareOfOtherMons[]; +extern const u8 gText_StoppedCaringAboutOtherMons[]; +extern const u8 gText_TriedToStartleOtherMons[]; +extern const u8 gText_TriedToDazzleOthers[]; +extern const u8 gText_JudgeLookedAwayFromMon[]; +extern const u8 gText_TriedToUnnerveNextMon[]; +extern const u8 gText_MonBecameNervous[]; +extern const u8 gText_AppealTriedToUnnerveWaitingMons[]; +extern const u8 gText_TauntedMonsDoingWell[]; +extern const u8 gText_MonRegainedItsForm[]; +extern const u8 gText_TriedToJamMonDoingWell[]; +extern const u8 gText_StandoutMonHustledEvenMore[]; +extern const u8 gText_LargelyUnnoticedMonWorkedHard[]; +extern const u8 gText_WorkedAsMuchAsMonBefore[]; +extern const u8 gText_WorkedAsMuchAsPrecedingMon[]; +extern const u8 gText_MonsAppealWasDud[]; +extern const u8 gText_MonsAppealDidNotGoWell[]; +extern const u8 gText_MonsAppealDidNotGoWell2[]; +extern const u8 gText_MonsAppealDidNotGoWell3[]; +extern const u8 gText_MonsAppealDidNotWorkVeryWell[]; +extern const u8 gText_MonsAppealWentSlightlyWell[]; +extern const u8 gText_MonsAppealWentSlightlyWell2[]; +extern const u8 gText_MonsAppealWentPrettyWell[]; +extern const u8 gText_MonsAppealWentPrettyWell2[]; +extern const u8 gText_MonsAppealWentVeryWell[]; +extern const u8 gText_MonsAppealWentExcellently[]; +extern const u8 gText_MonsAppealWentExcellently2[]; +extern const u8 gText_SameTypeAsOneBeforeGood[]; +extern const u8 gText_NotSameTypeAsOneBeforeGood[]; +extern const u8 gText_StoodOutMuchMoreThanMonBefore[]; +extern const u8 gText_DidntDoAsWellAsMonBefore[]; +extern const u8 gText_MonsConditionRoseAboveUsual[]; +extern const u8 gText_MonsHotStatusMadeGreatAppeal[]; +extern const u8 gText_MovedUpInLineForNextAppeal[]; +extern const u8 gText_MovedBackInLineForNextAppeal[]; +extern const u8 gText_ScrambledUpOrderForNextTurn[]; +extern const u8 gText_JudgeLookedAtMonExpectantly[]; +extern const u8 gText_AppealComboWentOverWell[]; +extern const u8 gText_AppealComboWentOverVeryWell[]; +extern const u8 gText_AppealComboWentOverExcellently[]; +extern const u8 gText_MonManagedToAvertGaze[]; +extern const u8 gText_MonManagedToAvoidSeeingIt[]; +extern const u8 gText_MonIsntFazedByThatSortOfThing[]; +extern const u8 gText_MonBecameALittleDistracted[]; +extern const u8 gText_TriedToStartleOtherPokemon[]; +extern const u8 gText_MonLookedDownOutOfDistraction[]; +extern const u8 gText_MonTurnedBackOutOfDistraction[]; +extern const u8 gText_MonCouldntHelpUtteringCry[]; +extern const u8 gText_MonCouldntHelpLeapingUp[]; +extern const u8 gText_MonTrippedOutOfDistraction[]; +extern const u8 gText_ButItMessedUp2[]; +extern const u8 gText_ButItFailedToMakeTargetNervous[]; +extern const u8 gText_ButItFailedToMakeAnyoneNervous[]; +extern const u8 gText_ButItWasIgnored[]; +extern const u8 gText_CouldntImproveItsCondition[]; +extern const u8 gText_BadConditionResultedInWeakAppeal[]; +extern const u8 gText_MonWasUnaffected[]; +extern const u8 gText_AttractedCrowdsAttention[]; + +// sContestConditions +extern const u8 gText_Contest_Coolness[]; +extern const u8 gText_Contest_Beauty[]; +extern const u8 gText_Contest_Cuteness[]; +extern const u8 gText_Contest_Smartness[]; +extern const u8 gText_Contest_Toughness[]; -extern const u8 gText_0827E85F[]; -extern const u8 gText_0827E868[]; -extern const u8 gText_0827E86F[]; -extern const u8 gText_0827E878[]; -extern const u8 gText_0827E882[]; +// sInvalidContestMoveNames +extern const u8 gText_CoolMove[]; +extern const u8 gText_BeautyMove[]; +extern const u8 gText_CuteMove[]; +extern const u8 gText_SmartMove[]; +extern const u8 gText_ToughMove[]; +extern const u8 gText_3QuestionMarks[]; -extern const u8 gText_0827E894[]; -extern const u8 gText_0827E89E[]; -extern const u8 gText_0827E8AA[]; -extern const u8 gText_0827E8B4[]; -extern const u8 gText_0827E8BF[]; -extern const u8 gText_0827E8CA[]; +// Misc, used directly +extern const u8 gText_MonAppealedWithMove[]; +extern const u8 gText_MonCantAppealNextTurn[]; +extern const u8 gText_RepeatedAppeal[]; +extern const u8 gText_MonsXDidntGoOverWell[]; +extern const u8 gText_MonsXWentOverGreat[]; +extern const u8 gText_MonsXGotTheCrowdGoing[]; +extern const u8 gText_CrowdContinuesToWatchMon[]; +extern const u8 gText_MonsMoveIsIgnored[]; +extern const u8 gText_MonWasTooNervousToMove[]; +extern const u8 gText_MonWasWatchingOthers[]; +extern const u8 gText_AllOutOfAppealTime[]; +extern const u8 gText_Contest_Shyness[]; +extern const u8 gText_Contest_Anxiety[]; +extern const u8 gText_Contest_Laziness[]; +extern const u8 gText_Contest_Hesitancy[]; +extern const u8 gText_Contest_Fear[]; +extern const u8 gText_AppealNumWhichMoveWillBePlayed[]; +extern const u8 gText_AppealNumButItCantParticipate[]; const u8 *const gContestEffectDescriptionPointers[] = { - gContestEffect00hDescription, - gContestEffect01hDescription, - gContestEffect02hDescription, - gContestEffect03hDescription, - gContestEffect04hDescription, - gContestEffect05hDescription, - gContestEffect06hDescription, - gContestEffect07hDescription, - gContestEffect08hDescription, - gContestEffect09hDescription, - gContestEffect0AhDescription, - gContestEffect0BhDescription, - gContestEffect0ChDescription, - gContestEffect0DhDescription, - gContestEffect0EhDescription, - gContestEffect0FhDescription, - gContestEffect10hDescription, - gContestEffect11hDescription, - gContestEffect12hDescription, - gContestEffect13hDescription, - gContestEffect14hDescription, - gContestEffect15hDescription, - gContestEffect16hDescription, - gContestEffect17hDescription, - gContestEffect18hDescription, - gContestEffect19hDescription, - gContestEffect1AhDescription, - gContestEffect1BhDescription, - gContestEffect1ChDescription, - gContestEffect1DhDescription, - gContestEffect1EhDescription, - gContestEffect1FhDescription, - gContestEffect20hDescription, - gContestEffect21hDescription, - gContestEffect22hDescription, - gContestEffect23hDescription, - gContestEffect24hDescription, - gContestEffect25hDescription, - gContestEffect26hDescription, - gContestEffect27hDescription, - gContestEffect28hDescription, - gContestEffect29hDescription, - gContestEffect2AhDescription, - gContestEffect2BhDescription, - gContestEffect2ChDescription, - gContestEffect2DhDescription, - gContestEffect2EhDescription, - gContestEffect2FhDescription + [CONTEST_EFFECT_HIGHLY_APPEALING] = gText_HighlyAppealingMove, + [CONTEST_EFFECT_USER_MORE_EASILY_STARTLED] = gText_UserMoreEasilyStartled, + [CONTEST_EFFECT_GREAT_APPEAL_BUT_NO_MORE_MOVES] = gText_GreatAppealButNoMoreToEnd, + [CONTEST_EFFECT_REPETITION_NOT_BORING] = gText_UsedRepeatedlyWithoutBoringJudge, + [CONTEST_EFFECT_AVOID_STARTLE_ONCE] = gText_AvoidStartledByOthersOnce, + [CONTEST_EFFECT_AVOID_STARTLE] = gText_AvoidStartledByOthers, + [CONTEST_EFFECT_AVOID_STARTLE_SLIGHTLY] = gText_AvoidStartledByOthersLittle, + [CONTEST_EFFECT_USER_LESS_EASILY_STARTLED] = gText_UserLessLikelyStartled, + [CONTEST_EFFECT_STARTLE_FRONT_MON] = gText_SlightlyStartleFrontMon, + [CONTEST_EFFECT_SLIGHTLY_STARTLE_PREV_MONS] = gText_SlightlyStartleAppealed, + [CONTEST_EFFECT_STARTLE_PREV_MON] = gText_StartleAppealedBeforeUser, + [CONTEST_EFFECT_STARTLE_PREV_MONS] = gText_StartleAllAppealed, + [CONTEST_EFFECT_BADLY_STARTLE_FRONT_MON] = gText_BadlyStartleFrontMon, + [CONTEST_EFFECT_BADLY_STARTLE_PREV_MONS] = gText_BadlyStartleAppealed, + [CONTEST_EFFECT_STARTLE_PREV_MON_2] = gText_StartleAppealedBeforeUser2, + [CONTEST_EFFECT_STARTLE_PREV_MONS_2] = gText_StartleAllAppealed2, + [CONTEST_EFFECT_SHIFT_JUDGE_ATTENTION] = gText_ShiftJudgesAttentionFromOthers, + [CONTEST_EFFECT_STARTLE_MON_WITH_JUDGES_ATTENTION] = gText_StartleMonHasJudgesAttention, + [CONTEST_EFFECT_JAMS_OTHERS_BUT_MISS_ONE_TURN] = gText_JamOthersMissesTurn, + [CONTEST_EFFECT_STARTLE_MONS_SAME_TYPE_APPEAL] = gText_StartleMonsMadeSameTypeAppeal, + [CONTEST_EFFECT_STARTLE_MONS_COOL_APPEAL] = gText_BadlyStartleCoolAppeals, + [CONTEST_EFFECT_STARTLE_MONS_BEAUTY_APPEAL] = gText_BadlyStartleBeautyAppeals, + [CONTEST_EFFECT_STARTLE_MONS_CUTE_APPEAL] = gText_BadlyStartleCuteAppeals, + [CONTEST_EFFECT_STARTLE_MONS_SMART_APPEAL] = gText_BadlyStartleSmartAppeals, + [CONTEST_EFFECT_STARTLE_MONS_TOUGH_APPEAL] = gText_BadlyStartleToughAppeals, + [CONTEST_EFFECT_MAKE_FOLLOWING_MON_NERVOUS] = gText_MakeMonAfterUserNervous, + [CONTEST_EFFECT_MAKE_FOLLOWING_MONS_NERVOUS] = gText_MakeAllMonsAfterUserNervous, + [CONTEST_EFFECT_WORSEN_CONDITION_OF_PREV_MONS] = gText_WorsenConditionOfThoseMadeAppeals, + [CONTEST_EFFECT_BADLY_STARTLES_MONS_IN_GOOD_CONDITION] = gText_BadlyStartleMonsGoodCondition, + [CONTEST_EFFECT_BETTER_IF_FIRST] = gText_AppealGreatIfPerformedFirst, + [CONTEST_EFFECT_BETTER_IF_LAST] = gText_AppealGreatIfPerformedLast, + [CONTEST_EFFECT_APPEAL_AS_GOOD_AS_PREV_ONES] = gText_AppealAsGoodAsThoseBeforeIt, + [CONTEST_EFFECT_APPEAL_AS_GOOD_AS_PREV_ONE] = gText_AppealAsGoodAsOneBeforeIt, + [CONTEST_EFFECT_BETTER_WHEN_LATER] = gText_AppealBetterLaterItsPerformed, + [CONTEST_EFFECT_QUALITY_DEPENDS_ON_TIMING] = gText_AppealVariesDependingOnTiming, + [CONTEST_EFFECT_BETTER_IF_SAME_TYPE] = gText_WorksWellIfSameTypeAsBefore, + [CONTEST_EFFECT_BETTER_IF_DIFF_TYPE] = gText_WorksWellIfDifferentTypeAsBefore, + [CONTEST_EFFECT_AFFECTED_BY_PREV_APPEAL] = gText_AffectedByAppealInFront, + [CONTEST_EFFECT_IMPROVE_CONDITION_PREVENT_NERVOUSNESS] = gText_UpsConditionHelpsPreventNervousness, + [CONTEST_EFFECT_BETTER_WITH_GOOD_CONDITION] = gText_AppealWorksWellIfConditionGood, + [CONTEST_EFFECT_NEXT_APPEAL_EARLIER] = gText_NextAppealMadeEarlier, + [CONTEST_EFFECT_NEXT_APPEAL_LATER] = gText_NextAppealMadeLater, + [CONTEST_EFFECT_MAKE_SCRAMBLING_TURN_ORDER_EASIER] = gText_TurnOrderMoreEasilyScrambled, + [CONTEST_EFFECT_SCRAMBLE_NEXT_TURN_ORDER] = gText_ScrambleOrderOfNextAppeals, + [CONTEST_EFFECT_EXCITE_AUDIENCE_IN_ANY_CONTEST] = gText_AppealExcitesAudienceInAnyContest, + [CONTEST_EFFECT_BADLY_STARTLE_MONS_WITH_GOOD_APPEALS] = gText_BadlyStartlesMonsGoodAppeals, + [CONTEST_EFFECT_BETTER_WHEN_AUDIENCE_EXCITED] = gText_AppealBestMoreCrowdExcited, + [CONTEST_EFFECT_DONT_EXCITE_AUDIENCE] = gText_TemporarilyStopCrowdExcited }; // Unreferenced array of pointers to move names. // All of the moves except Conversion are combo starters, so this may have // been an early list of combo starters. -const u8 *const gUnknown_8587D10[] = +static const u8 *const sUnusedComboMoveNameTexts[] = { - gUnusedContestMoveName0, - gUnusedContestMoveName0, - gUnusedContestMoveName1, - gUnusedContestMoveName2, - gUnusedContestMoveName3, - gUnusedContestMoveName4, - gUnusedContestMoveName5, - gUnusedContestMoveName6, - gUnusedContestMoveName7, - gUnusedContestMoveName8, - gUnusedContestMoveName9, - gUnusedContestMoveName10, - gUnusedContestMoveName11, - gUnusedContestMoveName12 + gText_RainDance, + gText_RainDance, + gText_Rage, + gText_FocusEnergy, + gText_Hypnosis, + gText_Softboiled, + gText_HornAttack, + gText_SwordsDance, + gText_Conversion, + gText_SunnyDay, + gText_Rest2, + gText_Vicegrip, + gText_DefenseCurl, + gText_LockOn }; const u8 *const gContestMoveTypeTextPointers[] = { - gContestMoveTypeCoolText, - gContestMoveTypeBeautyText, - gContestMoveTypeCuteText, - gContestMoveTypeSmartText, - gContestMoveTypeToughText + [CONTEST_CATEGORY_COOL] = gContestMoveTypeCoolText, + [CONTEST_CATEGORY_BEAUTY] = gContestMoveTypeBeautyText, + [CONTEST_CATEGORY_CUTE] = gContestMoveTypeCuteText, + [CONTEST_CATEGORY_SMART] = gContestMoveTypeSmartText, + [CONTEST_CATEGORY_TOUGH] = gContestMoveTypeToughText }; -const u8 *const gUnknown_08587D5C[] = +static const u8 *const sUnusedAppealResultTexts[] = { - gText_0827D5C1, - gText_0827D5DC, - gText_0827D600, - gText_0827D612, - gText_0827D612, - gText_0827D62D, - gText_0827D654, - gText_0827D67E, - gText_0827D69C, - gText_0827D6BA, - gText_0827D6E5, - gText_0827D706, - gText_0827D71D + gText_ButAppealWasJammed, + gText_FollowedAnotherMonsLead, + gText_ButItMessedUp, + gText_WentBetterThanUsual, + gText_WentBetterThanUsual, + gText_JudgeLookedAwayForSomeReason, + gText_WorkedHardToBuildOnPastMistakes, + gText_CantMakeAnyMoreMoves, + gText_WorkedFrighteninglyWell, + gText_WorkedHardAsStandoutMon, + gText_JudgedLookedOnExpectantly, + gText_WorkedRatherWell, + gText_WorkedLittleBetterThanUsual }; -const u8 *const gUnknown_08587D90[] = +// Takes the .attentionLevel of a contestant as an index. Only 0-5 are used +static const u8 *const sRoundResultTexts[] = { - gText_0827D743, - gText_0827D764, - gText_0827D785, - gText_0827D7A5, - gText_0827D7C8, - gText_0827D7E8, - gText_0827D831, - gText_0827D855, - gText_0827D830, - gText_0827D872, - gText_0827D88F, - gText_0827D8B5, - gText_0827D8E4, - gText_0827D8FE, - gText_0827D926, - gText_0827D947, - gText_0827D961, - gText_0827D986, - gText_0827D9B1, - gText_0827D9D9, - gText_0827DA03, - gText_0827DA31, - gText_0827DA5B, - gText_0827DA85, - gText_0827DAB2, - gText_0827DADA, - gText_0827DB03, - gText_0827D830, - gText_0827D830, - gText_0827D830, - gText_0827DB1F, - gText_0827DB4E + gText_MonFailedToStandOutAtAll, + gText_MonDidntStandOutVeryMuch, + gText_MonCaughtALittleAttention, + gText_MonAttractedALotOfAttention, + gText_MonCommandedTotalAttention, + gText_MonHasntMadeItsAppeal, + gText_JudgesViewsOnMonHeldFirm, // here below unused + gText_MonsXChangedPerceptions, + gText_EmptyContestString, + gText_MonsAppealEffectWoreOff, + gText_SpecialAppealsEffectWoreOff, + gText_EveryonesAppealsMadeToLookSame, + gText_CheapenedMonsAppeal, + gText_CheapenedAppealOfThoseAhead, + gText_StoleAttentionAwayFromMon, + gText_CheapenedMonsAppeal2, + gText_SeverelyCheapenedOtherAppeals, + gText_AnticipationSwelledForMonsAppealNext, + gText_CheapenedAppealOfThoseAhead2, + gText_CheapenedJudgesFavoriteAppeal, + gText_AppealsOfOthersCheapenedByHalf, + gText_StoodOutToMakeUpForBeingJammed, + gText_CantParticipateInAppealsAnyMore, + gText_TouchedJudgeForFantasticAppeal, + gText_AnticipationRoseForUpcomingAppeals, + gText_StoodOutAsMuchAsSpecialAppeals, + gText_StoodOutAsMuchAsMon, + gText_EmptyContestString, + gText_EmptyContestString, + gText_EmptyContestString, + gText_JammedAppealsMadeEvenLessNoticeable, + gText_EveryonesAppealsMadeSame }; -const u8 *const gUnknown_08587E10[] = +static const u8 *const sAppealResultTexts[] = { - gText_827DB75, - gText_827DBB0, - gText_827DBE0, - gText_827DC0F, - gText_827DC45, - gText_827DC7C, - gText_827DCB4, - gText_827DCE7, - gText_827DD12, - gText_827DD3D, - gText_827DD6F, - gText_827DD8E, - gText_827DDC7, - gText_827DDF2, - gText_827DE14, - gText_827DE44, - gText_827DE73, - gText_827DEA5, - gText_827DED9, - gText_827DF02, - gText_827DF3A, - gText_827DF63, - gText_827DF8C, - gText_827DFB8, - gText_827DFE2, - gText_827E00C, - gText_827E02F, - gText_827E05F, - gText_827E08B, - gText_827E0B5, - gText_827E0DD, - gText_827E107, - gText_827E143, - gText_827E17F, - gText_827E1BB, - gText_827E1F3, - gText_827E220, - gText_827E254, - gText_827E289, - gText_827E2C5, - gText_0827E2FE, - gText_0827E32E, - gText_0827E35B, - gText_0827E38D, - gText_0827E3C1, - gText_0827E3EB, - gText_0827E416, - gText_0827E448, - gText_0827E473, - gText_0827E4A6, - gText_0827E4D5, - gText_0827E504, - gText_0827E531, - gText_0827E55A, - gText_0827E5B2, - gText_0827E5D0, - gText_0827E606, - gText_0827E638, - gText_0827E658, - gText_0827E68B, - gText_0827E6C4, - gText_0827E7BA + [CONTEST_STRING_MORE_CONSCIOUS] = gText_BecameMoreConsciousOfOtherMons, + [CONTEST_STRING_NO_APPEAL] = gText_MonCantMakeAnAppealAfterThis, + [CONTEST_STRING_SETTLE_DOWN] = gText_SettledDownJustLittleBit, + [CONTEST_STRING_OBLIVIOUS_TO_OTHERS] = gText_BecameObliviousToOtherMons, + [CONTEST_STRING_LESS_AWARE] = gText_BecameLessAwareOfOtherMons, + [CONTEST_STRING_STOPPED_CARING] = gText_StoppedCaringAboutOtherMons, + [CONTEST_STRING_STARTLE_ATTEMPT] = gText_TriedToStartleOtherMons, + [CONTEST_STRING_DAZZLE_ATTEMPT] = gText_TriedToDazzleOthers, + [CONTEST_STRING_JUDGE_LOOK_AWAY2] = gText_JudgeLookedAwayFromMon, + [CONTEST_STRING_UNNERVE_ATTEMPT] = gText_TriedToUnnerveNextMon, + [CONTEST_STRING_NERVOUS] = gText_MonBecameNervous, + [CONTEST_STRING_UNNERVE_WAITING] = gText_AppealTriedToUnnerveWaitingMons, + [CONTEST_STRING_TAUNT_WELL] = gText_TauntedMonsDoingWell, + [CONTEST_STRING_REGAINED_FORM] = gText_MonRegainedItsForm, + [CONTEST_STRING_JAM_WELL] = gText_TriedToJamMonDoingWell, + [CONTEST_STRING_HUSTLE_STANDOUT] = gText_StandoutMonHustledEvenMore, + [CONTEST_STRING_WORK_HARD_UNNOTICED] = gText_LargelyUnnoticedMonWorkedHard, + [CONTEST_STRING_WORK_BEFORE] = gText_WorkedAsMuchAsMonBefore, + [CONTEST_STRING_APPEAL_NOT_WELL] = gText_MonsAppealDidNotGoWell, + [CONTEST_STRING_WORK_PRECEDING] = gText_WorkedAsMuchAsPrecedingMon, + [CONTEST_STRING_APPEAL_NOT_WELL2] = gText_MonsAppealDidNotGoWell2, + [CONTEST_STRING_APPEAL_NOT_SHOWN_WELL] = gText_MonsAppealDidNotGoWell3, + [CONTEST_STRING_APPEAL_SLIGHTLY_WELL] = gText_MonsAppealWentSlightlyWell, + [CONTEST_STRING_APPEAL_PRETTY_WELL] = gText_MonsAppealWentPrettyWell, + [CONTEST_STRING_APPEAL_EXCELLENTLY] = gText_MonsAppealWentExcellently, + [CONTEST_STRING_APPEAL_DUD] = gText_MonsAppealWasDud, + [CONTEST_STRING_APPEAL_NOT_VERY_WELL] = gText_MonsAppealDidNotWorkVeryWell, + [CONTEST_STRING_APPEAL_SLIGHTLY_WELL2] = gText_MonsAppealWentSlightlyWell2, + [CONTEST_STRING_APPEAL_PRETTY_WELL2] = gText_MonsAppealWentPrettyWell2, + [CONTEST_STRING_APPEAL_VERY_WELL] = gText_MonsAppealWentVeryWell, + [CONTEST_STRING_APPEAL_EXCELLENTLY2] = gText_MonsAppealWentExcellently2, + [CONTEST_STRING_SAME_TYPE_GOOD] = gText_SameTypeAsOneBeforeGood, + [CONTEST_STRING_DIFF_TYPE_GOOD] = gText_NotSameTypeAsOneBeforeGood, + [CONTEST_STRING_STOOD_OUT_AS_MUCH] = gText_StoodOutMuchMoreThanMonBefore, + [CONTEST_STRING_NOT_AS_WELL] = gText_DidntDoAsWellAsMonBefore, + [CONTEST_STRING_CONDITION_ROSE] = gText_MonsConditionRoseAboveUsual, + [CONTEST_STRING_HOT_STATUS] = gText_MonsHotStatusMadeGreatAppeal, + [CONTEST_STRING_MOVE_UP_LINE] = gText_MovedUpInLineForNextAppeal, + [CONTEST_STRING_MOVE_BACK_LINE] = gText_MovedBackInLineForNextAppeal, + [CONTEST_STRING_SCRAMBLE_ORDER] = gText_ScrambledUpOrderForNextTurn, + [CONTEST_STRING_JUDGE_EXPECTANTLY2] = gText_JudgeLookedAtMonExpectantly, + [CONTEST_STRING_WENT_OVER_WELL] = gText_AppealComboWentOverWell, + [CONTEST_STRING_WENT_OVER_VERY_WELL] = gText_AppealComboWentOverVeryWell, + [CONTEST_STRING_APPEAL_COMBO_EXCELLENTLY] = gText_AppealComboWentOverExcellently, + [CONTEST_STRING_AVERT_GAZE] = gText_MonManagedToAvertGaze, + [CONTEST_STRING_AVOID_SEEING] = gText_MonManagedToAvoidSeeingIt, + [CONTEST_STRING_NOT_FAZED] = gText_MonIsntFazedByThatSortOfThing, + [CONTEST_STRING_LITTLE_DISTRACTED] = gText_MonBecameALittleDistracted, + [CONTEST_STRING_ATTEMPT_STARTLE] = gText_TriedToStartleOtherPokemon, + [CONTEST_STRING_LOOKED_DOWN] = gText_MonLookedDownOutOfDistraction, + [CONTEST_STRING_TURNED_BACK] = gText_MonTurnedBackOutOfDistraction, + [CONTEST_STRING_UTTER_CRY] = gText_MonCouldntHelpUtteringCry, + [CONTEST_STRING_LEAPT_UP] = gText_MonCouldntHelpLeapingUp, + [CONTEST_STRING_TRIPPED_OVER] = gText_MonTrippedOutOfDistraction, + [CONTEST_STRING_MESSED_UP2] = gText_ButItMessedUp2, + [CONTEST_STRING_FAILED_TARGET_NERVOUS] = gText_ButItFailedToMakeTargetNervous, + [CONTEST_STRING_FAILED_ANYONE_NERVOUS] = gText_ButItFailedToMakeAnyoneNervous, + [CONTEST_STRING_IGNORED] = gText_ButItWasIgnored, + [CONTEST_STRING_NO_CONDITION_IMPROVE] = gText_CouldntImproveItsCondition, + [CONTEST_STRING_BAD_CONDITION_WEAK_APPEAL] = gText_BadConditionResultedInWeakAppeal, + [CONTEST_STRING_UNAFFECTED] = gText_MonWasUnaffected, + [CONTEST_STRING_ATTRACTED_ATTENTION] = gText_AttractedCrowdsAttention }; -const u8 *const gUnknown_08587F08[] = +static const u8 *const sContestConditions[] = { - gText_0827E85F, - gText_0827E868, - gText_0827E86F, - gText_0827E878, - gText_0827E882 + [CONTEST_CATEGORY_COOL] = gText_Contest_Coolness, + [CONTEST_CATEGORY_BEAUTY] = gText_Contest_Beauty, + [CONTEST_CATEGORY_CUTE] = gText_Contest_Cuteness, + [CONTEST_CATEGORY_SMART] = gText_Contest_Smartness, + [CONTEST_CATEGORY_TOUGH] = gText_Contest_Toughness }; -const u8 *const gUnknown_08587F1C[] = +static const u8 *const sInvalidContestMoveNames[] = { - gText_0827E894, - gText_0827E89E, - gText_0827E8AA, - gText_0827E8B4, - gText_0827E8BF, - gText_0827E8CA + [CONTEST_CATEGORY_COOL] = gText_CoolMove, + [CONTEST_CATEGORY_BEAUTY] = gText_BeautyMove, + [CONTEST_CATEGORY_CUTE] = gText_CuteMove, + [CONTEST_CATEGORY_SMART] = gText_SmartMove, + [CONTEST_CATEGORY_TOUGH] = gText_ToughMove, + [CONTEST_CATEGORIES_COUNT] = gText_3QuestionMarks }; diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index 7f0887790..2419c2806 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -448,7 +448,7 @@ static bool32 TryWriteTrainerHill_r(struct EReaderTrainerHillSet *ttdata, struct AGB_ASSERT_EX(ttdata->id == 0, "cereader_tool.c", 452); memset(buffer2, 0, 0x1000); - buffer2->unkField_0 = ttdata->count; + buffer2->numTrainers = ttdata->count; buffer2->unused1 = sub_81D38D4(); buffer2->numFloors = (ttdata->count + 1) / 2; @@ -456,13 +456,13 @@ static bool32 TryWriteTrainerHill_r(struct EReaderTrainerHillSet *ttdata, struct { if (!(i & 1)) { - buffer2->floors[i / 2].unk0 = ttdata->unk_8[i].unk0; + buffer2->floors[i / 2].trainerNum1 = ttdata->unk_8[i].unk0; buffer2->floors[i / 2].display = ttdata->unk_8[i].unk14C; buffer2->floors[i / 2].trainers[0] = ttdata->unk_8[i].unk4; } else { - buffer2->floors[i / 2].unk1 = ttdata->unk_8[i].unk0; + buffer2->floors[i / 2].trainerNum2 = ttdata->unk_8[i].unk0; buffer2->floors[i / 2].trainers[1] = ttdata->unk_8[i].unk4; } } diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index b09a6f728..41b7a4dbf 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -33,6 +33,7 @@ #include "constants/map_types.h" #include "constants/maps.h" #include "constants/songs.h" +#include "constants/trainer_hill.h" static EWRAM_DATA u8 sWildEncounterImmunitySteps = 0; static EWRAM_DATA u16 sPreviousPlayerMetatileBehavior = 0; @@ -571,12 +572,12 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior) ScriptContext1_SetupScript(MauvilleCity_EventScript_RegisterWallyCall); return TRUE; } - if (ShouldDoWinonaCall() == TRUE) + if (ShouldDoScottFortreeCall() == TRUE) { - ScriptContext1_SetupScript(Route119_EventScript_1F49EC); + ScriptContext1_SetupScript(Route119_EventScript_ScottWonAtFortreeGymCall); return TRUE; } - if (ShouldDoScottCall() == TRUE) + if (ShouldDoScottBattleFrontierCall() == TRUE) { ScriptContext1_SetupScript(LittlerootTown_ProfessorBirchsLab_EventScript_ScottAboardSSTidalCall); return TRUE; @@ -597,7 +598,7 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior) return TRUE; if (CountSSTidalStep(1) == TRUE) { - ScriptContext1_SetupScript(SSTidalCorridor_EventScript_23C050); + ScriptContext1_SetupScript(SSTidalCorridor_EventScript_ReachedStepCount); return TRUE; } if (TryStartMatchCall()) @@ -792,20 +793,16 @@ static void SetupWarp(struct MapHeader *unused, s8 warpEventId, struct MapPositi if (trainerHillMapId) { - if (trainerHillMapId == sub_81D6490()) + if (trainerHillMapId == GetNumFloorsInTrainerHillChallenge()) { if (warpEventId == 0) - { warpEvent = &gMapHeader.events->warps[0]; - } else - { - warpEvent = sub_81D6120(); - } + warpEvent = SetWarpDestinationTrainerHill4F(); } - else if (trainerHillMapId == 5) + else if (trainerHillMapId == TRAINER_HILL_ROOF) { - warpEvent = sub_81D6134(warpEventId); + warpEvent = SetWarpDestinationTrainerHillFinalFloor(warpEventId); } else { diff --git a/src/field_special_scene.c b/src/field_special_scene.c index 231f4dd42..439b1855a 100644 --- a/src/field_special_scene.c +++ b/src/field_special_scene.c @@ -14,6 +14,8 @@ #include "sprite.h" #include "task.h" #include "constants/event_objects.h" +#include "constants/event_object_movement_constants.h" +#include "constants/field_specials.h" #include "constants/songs.h" #include "constants/vars.h" #include "constants/metatile_labels.h" @@ -31,8 +33,18 @@ enum //. rodata static const s8 gTruckCamera_HorizontalTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, -1, -1, -1, 0}; -const u8 gUnknown_0858E8AB[] = {0x18, 0xFE}; -const u8 gUnknown_0858E8AD[] = {0x17, 0xFE}; + +static const u8 sSSTidalSailEastMovementScript[] = +{ + MOVEMENT_ACTION_WALK_FAST_RIGHT, + MOVEMENT_ACTION_STEP_END +}; + +static const u8 sSSTidalSailWestMovementScript[] = +{ + MOVEMENT_ACTION_WALK_FAST_LEFT, + MOVEMENT_ACTION_STEP_END +}; // .text static void Task_Truck3(u8); @@ -256,7 +268,7 @@ bool8 sub_80FB59C(void) void Task_HandlePorthole(u8 taskId) { s16 *data = gTasks[taskId].data; - u16 *var = GetVarPointer(VAR_PORTHOLE_STATE); + u16 *cruiseState = GetVarPointer(VAR_SS_TIDAL_STATE); struct WarpData *location = &gSaveBlock1Ptr->location; switch (data[0]) @@ -268,40 +280,41 @@ void Task_HandlePorthole(u8 taskId) data[0] = EXECUTE_MOVEMENT; // execute movement before checking if should be exited. strange? } break; - case IDLE_CHECK: // idle and move. + case IDLE_CHECK: if (gMain.newKeys & A_BUTTON) data[1] = 1; - if (!ScriptMovement_IsObjectMovementFinished(0xFF, location->mapNum, location->mapGroup)) + if (!ScriptMovement_IsObjectMovementFinished(EVENT_OBJ_ID_PLAYER, location->mapNum, location->mapGroup)) return; if (CountSSTidalStep(1) == TRUE) { - if (*var == 2) - *var = 9; + if (*cruiseState == SS_TIDAL_DEPART_SLATEPORT) + *cruiseState = SS_TIDAL_EXIT_CURRENTS_RIGHT; else - *var = 10; - data[0] = 3; + *cruiseState = SS_TIDAL_EXIT_CURRENTS_LEFT; + data[0] = EXIT_PORTHOLE; return; } - data[0] = 2; - case EXECUTE_MOVEMENT: // execute movement. + data[0] = EXECUTE_MOVEMENT; + //fallthrough + case EXECUTE_MOVEMENT: if (data[1]) { - data[0] = EXIT_PORTHOLE; // exit porthole. + data[0] = EXIT_PORTHOLE; return; } - // run this once. - if (*var == 2) // which direction? + + if (*cruiseState == SS_TIDAL_DEPART_SLATEPORT) { - ScriptMovement_StartObjectMovementScript(0xFF, location->mapNum, location->mapGroup, gUnknown_0858E8AB); - data[0] = IDLE_CHECK; // run case 1. + ScriptMovement_StartObjectMovementScript(EVENT_OBJ_ID_PLAYER, location->mapNum, location->mapGroup, sSSTidalSailEastMovementScript); + data[0] = IDLE_CHECK; } else { - ScriptMovement_StartObjectMovementScript(0xFF, location->mapNum, location->mapGroup, gUnknown_0858E8AD); - data[0] = IDLE_CHECK; // run case 1. + ScriptMovement_StartObjectMovementScript(EVENT_OBJ_ID_PLAYER, location->mapNum, location->mapGroup, sSSTidalSailWestMovementScript); + data[0] = IDLE_CHECK; } break; - case EXIT_PORTHOLE: // exit porthole. + case EXIT_PORTHOLE: FlagClear(FLAG_DONT_TRANSITION_MUSIC); FlagClear(FLAG_HIDE_MAP_NAME_POPUP); SetWarpDestinationToDynamicWarp(0); @@ -311,32 +324,28 @@ void Task_HandlePorthole(u8 taskId) } } -void sub_80FB6EC(void) +static void ShowSSTidalWhileSailing(void) { u8 spriteId = AddPseudoEventObject(EVENT_OBJ_GFX_SS_TIDAL, SpriteCallbackDummy, 112, 80, 0); gSprites[spriteId].coordOffsetEnabled = FALSE; - if (VarGet(VAR_PORTHOLE_STATE) == 2) - { - StartSpriteAnim(&gSprites[spriteId], GetFaceDirectionAnimNum(4)); - } + if (VarGet(VAR_SS_TIDAL_STATE) == SS_TIDAL_DEPART_SLATEPORT) + StartSpriteAnim(&gSprites[spriteId], GetFaceDirectionAnimNum(DIR_EAST)); else - { - StartSpriteAnim(&gSprites[spriteId], GetFaceDirectionAnimNum(3)); - } + StartSpriteAnim(&gSprites[spriteId], GetFaceDirectionAnimNum(DIR_WEST)); } void sub_80FB768(void) { - sub_80FB6EC(); + ShowSSTidalWhileSailing(); gEventObjects[gPlayerAvatar.eventObjectId].invisible = TRUE; pal_fill_black(); CreateTask(Task_HandlePorthole, 80); ScriptContext2_Enable(); } -void sub_80FB7A4(void) +void LookThroughPorthole(void) { FlagSet(FLAG_SYS_CRUISE_MODE); FlagSet(FLAG_DONT_TRANSITION_MUSIC); diff --git a/src/field_specials.c b/src/field_specials.c index 0d9f495a9..57e0d087a 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -303,9 +303,10 @@ void ResetSSTidalFlag(void) FlagClear(FLAG_SYS_CRUISE_MODE); } +// Returns TRUE if the Cruise is over bool32 CountSSTidalStep(u16 delta) { - if (!FlagGet(FLAG_SYS_CRUISE_MODE) || (*GetVarPointer(VAR_CRUISE_STEP_COUNT) += delta) <= 0xcc) + if (!FlagGet(FLAG_SYS_CRUISE_MODE) || (*GetVarPointer(VAR_CRUISE_STEP_COUNT) += delta) < SS_TIDAL_MAX_STEPS) { return FALSE; } @@ -315,21 +316,21 @@ bool32 CountSSTidalStep(u16 delta) u8 GetSSTidalLocation(s8 *mapGroup, s8 *mapNum, s16 *x, s16 *y) { u16 *varCruiseStepCount = GetVarPointer(VAR_CRUISE_STEP_COUNT); - switch (*GetVarPointer(VAR_PORTHOLE_STATE)) + switch (*GetVarPointer(VAR_SS_TIDAL_STATE)) { - case 1: - case 8: + case SS_TIDAL_BOARD_SLATEPORT: + case SS_TIDAL_LAND_SLATEPORT: return SS_TIDAL_LOCATION_SLATEPORT; - case 3: - case 9: + case SS_TIDAL_HALFWAY_LILYCOVE: + case SS_TIDAL_EXIT_CURRENTS_RIGHT: return SS_TIDAL_LOCATION_ROUTE131; - case 4: - case 5: + case SS_TIDAL_LAND_LILYCOVE: + case SS_TIDAL_BOARD_LILYCOVE: return SS_TIDAL_LOCATION_LILYCOVE; - case 6: - case 10: + case SS_TIDAL_DEPART_LILYCOVE: + case SS_TIDAL_EXIT_CURRENTS_LEFT: return SS_TIDAL_LOCATION_ROUTE124; - case 2: + case SS_TIDAL_DEPART_SLATEPORT: if (*varCruiseStepCount < 60) { *mapNum = MAP_NUM(ROUTE134); @@ -346,7 +347,7 @@ u8 GetSSTidalLocation(s8 *mapGroup, s8 *mapNum, s16 *x, s16 *y) *x = *varCruiseStepCount - 140; } break; - case 7: + case SS_TIDAL_HALFWAY_SLATEPORT: if (*varCruiseStepCount < 66) { *mapNum = MAP_NUM(ROUTE132); @@ -395,9 +396,9 @@ bool32 ShouldDoWallyCall(void) return TRUE; } -bool32 ShouldDoWinonaCall(void) +bool32 ShouldDoScottFortreeCall(void) { - if (FlagGet(FLAG_REGISTER_WINONA_POKENAV)) + if (FlagGet(FLAG_SCOTT_CALL_FORTREE_GYM)) { switch (gMapHeader.mapType) { @@ -405,7 +406,7 @@ bool32 ShouldDoWinonaCall(void) case MAP_TYPE_CITY: case MAP_TYPE_ROUTE: case MAP_TYPE_OCEAN_ROUTE: - if (++(*GetVarPointer(VAR_WINONA_CALL_STEP_COUNTER)) < 10) + if (++(*GetVarPointer(VAR_SCOTT_FORTREE_CALL_STEP_COUNTER)) < 10) { return FALSE; } @@ -422,9 +423,9 @@ bool32 ShouldDoWinonaCall(void) return TRUE; } -bool32 ShouldDoScottCall(void) +bool32 ShouldDoScottBattleFrontierCall(void) { - if (FlagGet(FLAG_SCOTT_CALL_NATIONAL_DEX)) + if (FlagGet(FLAG_SCOTT_CALL_BATTLE_FRONTIER)) { switch (gMapHeader.mapType) { @@ -432,7 +433,7 @@ bool32 ShouldDoScottCall(void) case MAP_TYPE_CITY: case MAP_TYPE_ROUTE: case MAP_TYPE_OCEAN_ROUTE: - if (++(*GetVarPointer(VAR_SCOTT_CALL_STEP_COUNTER)) < 10) + if (++(*GetVarPointer(VAR_SCOTT_BF_CALL_STEP_COUNTER)) < 10) { return FALSE; } @@ -2082,78 +2083,78 @@ void ShowFrontierManiacMessage(void) { [FRONTIER_MANIAC_BATTLE_TOWER_SINGLES] = { - BattleFrontier_Lounge2_Text_260971, - BattleFrontier_Lounge2_Text_260A1E, - BattleFrontier_Lounge2_Text_260AE7 + BattleFrontier_Lounge2_Text_SalonMaidenIsThere, + BattleFrontier_Lounge2_Text_SalonMaidenSilverMons, + BattleFrontier_Lounge2_Text_SalonMaidenGoldMons }, [FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES] = { - BattleFrontier_Lounge2_Text_2619AC, - BattleFrontier_Lounge2_Text_261A91, - BattleFrontier_Lounge2_Text_261B0C + BattleFrontier_Lounge2_Text_DoubleBattleAdvice1, + BattleFrontier_Lounge2_Text_DoubleBattleAdvice2, + BattleFrontier_Lounge2_Text_DoubleBattleAdvice3 }, [FRONTIER_MANIAC_BATTLE_TOWER_MULTIS] = { - BattleFrontier_Lounge2_Text_261B95, - BattleFrontier_Lounge2_Text_261B95, - BattleFrontier_Lounge2_Text_261B95 + BattleFrontier_Lounge2_Text_MultiBattleAdvice, + BattleFrontier_Lounge2_Text_MultiBattleAdvice, + BattleFrontier_Lounge2_Text_MultiBattleAdvice }, - [FRONTIER_MANIAC_BATTLE_TOWER_LINK_MULTIS] = + [FRONTIER_MANIAC_BATTLE_TOWER_LINK] = { - BattleFrontier_Lounge2_Text_261C1A, - BattleFrontier_Lounge2_Text_261C1A, - BattleFrontier_Lounge2_Text_261C1A + BattleFrontier_Lounge2_Text_LinkMultiBattleAdvice, + BattleFrontier_Lounge2_Text_LinkMultiBattleAdvice, + BattleFrontier_Lounge2_Text_LinkMultiBattleAdvice }, [FRONTIER_MANIAC_BATTLE_DOME] = { - BattleFrontier_Lounge2_Text_260BC4, - BattleFrontier_Lounge2_Text_260C6D, - BattleFrontier_Lounge2_Text_260D3A + BattleFrontier_Lounge2_Text_DomeAceIsThere, + BattleFrontier_Lounge2_Text_DomeAceSilverMons, + BattleFrontier_Lounge2_Text_DomeAceGoldMons }, [FRONTIER_MANIAC_BATTLE_FACTORY] = { - BattleFrontier_Lounge2_Text_260E1E, - BattleFrontier_Lounge2_Text_260EC7, - BattleFrontier_Lounge2_Text_260F74 + BattleFrontier_Lounge2_Text_FactoryHeadIsThere, + BattleFrontier_Lounge2_Text_FactoryHeadSilverMons, + BattleFrontier_Lounge2_Text_FactoryHeadGoldMons }, [FRONTIER_MANIAC_BATTLE_PALACE] = { - BattleFrontier_Lounge2_Text_2614E6, - BattleFrontier_Lounge2_Text_261591, - BattleFrontier_Lounge2_Text_26166F + BattleFrontier_Lounge2_Text_PalaceMavenIsThere, + BattleFrontier_Lounge2_Text_PalaceMavenSilverMons, + BattleFrontier_Lounge2_Text_PalaceMavenGoldMons }, [FRONTIER_MANIAC_BATTLE_ARENA] = { - BattleFrontier_Lounge2_Text_261282, - BattleFrontier_Lounge2_Text_261329, - BattleFrontier_Lounge2_Text_261403 + BattleFrontier_Lounge2_Text_ArenaTycoonIsThere, + BattleFrontier_Lounge2_Text_ArenaTycoonSilverMons, + BattleFrontier_Lounge2_Text_ArenaTycoonGoldMons }, [FRONTIER_MANIAC_BATTLE_PIKE] = { - BattleFrontier_Lounge2_Text_261026, - BattleFrontier_Lounge2_Text_2610CC, - BattleFrontier_Lounge2_Text_261194 + BattleFrontier_Lounge2_Text_PikeQueenIsThere, + BattleFrontier_Lounge2_Text_PikeQueenSilverMons, + BattleFrontier_Lounge2_Text_PikeQueenGoldMons }, [FRONTIER_MANIAC_BATTLE_PYRAMID] = { - BattleFrontier_Lounge2_Text_26174D, - BattleFrontier_Lounge2_Text_2617F9, - BattleFrontier_Lounge2_Text_2618C4 + BattleFrontier_Lounge2_Text_PyramidKingIsThere, + BattleFrontier_Lounge2_Text_PyramidKingSilverMons, + BattleFrontier_Lounge2_Text_PyramidKingGoldMons }, }; static const u8 sFrontierManiacStreakThresholds[][FRONTIER_MANIAC_MESSAGE_COUNT - 1] = { - [FRONTIER_MANIAC_BATTLE_TOWER_SINGLES] = { 21, 56 }, - [FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES] = { 21, 35 }, - [FRONTIER_MANIAC_BATTLE_TOWER_MULTIS] = { 255, 255 }, - [FRONTIER_MANIAC_BATTLE_TOWER_LINK_MULTIS] = { 255, 255 }, - [FRONTIER_MANIAC_BATTLE_DOME] = { 2, 4 }, - [FRONTIER_MANIAC_BATTLE_FACTORY] = { 7, 21 }, - [FRONTIER_MANIAC_BATTLE_PALACE] = { 7, 21 }, - [FRONTIER_MANIAC_BATTLE_ARENA] = { 14, 28 }, - [FRONTIER_MANIAC_BATTLE_PIKE] = { 13, 112 }, //BUG: 112 (0x70) is probably a mistake; the Pike Queen is battled twice well before that - [FRONTIER_MANIAC_BATTLE_PYRAMID] = { 7, 56 } + [FRONTIER_MANIAC_BATTLE_TOWER_SINGLES] = { 21, 56 }, + [FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES] = { 21, 35 }, + [FRONTIER_MANIAC_BATTLE_TOWER_MULTIS] = { 255, 255 }, + [FRONTIER_MANIAC_BATTLE_TOWER_LINK] = { 255, 255 }, + [FRONTIER_MANIAC_BATTLE_DOME] = { 2, 4 }, + [FRONTIER_MANIAC_BATTLE_FACTORY] = { 7, 21 }, + [FRONTIER_MANIAC_BATTLE_PALACE] = { 7, 21 }, + [FRONTIER_MANIAC_BATTLE_ARENA] = { 14, 28 }, + [FRONTIER_MANIAC_BATTLE_PIKE] = { 13, 112 }, //BUG: 112 (0x70) is probably a mistake; the Pike Queen is battled twice well before that + [FRONTIER_MANIAC_BATTLE_PYRAMID] = { 7, 56 } }; u8 i; @@ -2165,7 +2166,7 @@ void ShowFrontierManiacMessage(void) case FRONTIER_MANIAC_BATTLE_TOWER_SINGLES: case FRONTIER_MANIAC_BATTLE_TOWER_DOUBLES: case FRONTIER_MANIAC_BATTLE_TOWER_MULTIS: - case FRONTIER_MANIAC_BATTLE_TOWER_LINK_MULTIS: + case FRONTIER_MANIAC_BATTLE_TOWER_LINK: if (gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_50] >= gSaveBlock2Ptr->frontier.towerWinStreaks[facility][FRONTIER_LVL_OPEN]) { @@ -2903,18 +2904,18 @@ void ShowFrontierGamblerLookingMessage(void) { static const u8 *const sFrontierGamblerLookingMessages[] = { - BattleFrontier_Lounge3_Text_262261, - BattleFrontier_Lounge3_Text_26230D, - BattleFrontier_Lounge3_Text_2623B9, - BattleFrontier_Lounge3_Text_262464, - BattleFrontier_Lounge3_Text_26250E, - BattleFrontier_Lounge3_Text_2625B8, - BattleFrontier_Lounge3_Text_26266A, - BattleFrontier_Lounge3_Text_26271C, - BattleFrontier_Lounge3_Text_2627C9, - BattleFrontier_Lounge3_Text_262876, - BattleFrontier_Lounge3_Text_26291A, - BattleFrontier_Lounge3_Text_2629BC, + BattleFrontier_Lounge3_Text_ChallengeBattleTowerSingle, + BattleFrontier_Lounge3_Text_ChallengeBattleTowerDouble, + BattleFrontier_Lounge3_Text_ChallengeBattleTowerMulti, + BattleFrontier_Lounge3_Text_ChallengeBattleDomeSingle, + BattleFrontier_Lounge3_Text_ChallengeBattleDomeDouble, + BattleFrontier_Lounge3_Text_ChallengeBattleFactorySingle, + BattleFrontier_Lounge3_Text_ChallengeBattleFactoryDouble, + BattleFrontier_Lounge3_Text_ChallengeBattlePalaceSingle, + BattleFrontier_Lounge3_Text_ChallengeBattlePalaceDouble, + BattleFrontier_Lounge3_Text_ChallengeBattleArena, + BattleFrontier_Lounge3_Text_ChallengeBattlePike, + BattleFrontier_Lounge3_Text_ChallengeBattlePyramid, }; u16 challenge = VarGet(VAR_FRONTIER_GAMBLER_CHALLENGE); @@ -2926,18 +2927,18 @@ void ShowFrontierGamblerGoMessage(void) { static const u8 *const sFrontierGamblerGoMessages[] = { - BattleFrontier_Lounge3_Text_262C04, - BattleFrontier_Lounge3_Text_262C90, - BattleFrontier_Lounge3_Text_262D1C, - BattleFrontier_Lounge3_Text_262DA7, - BattleFrontier_Lounge3_Text_262E34, - BattleFrontier_Lounge3_Text_262EC1, - BattleFrontier_Lounge3_Text_262F56, - BattleFrontier_Lounge3_Text_262FEB, - BattleFrontier_Lounge3_Text_263078, - BattleFrontier_Lounge3_Text_263105, - BattleFrontier_Lounge3_Text_26318C, - BattleFrontier_Lounge3_Text_263211, + BattleFrontier_Lounge3_Text_GetToBattleTowerSingle, + BattleFrontier_Lounge3_Text_GetToBattleTowerDouble, + BattleFrontier_Lounge3_Text_GetToBattleTowerMulti, + BattleFrontier_Lounge3_Text_GetToBattleDomeSingle, + BattleFrontier_Lounge3_Text_GetToBattleDomeDouble, + BattleFrontier_Lounge3_Text_GetToBattleFactorySingle, + BattleFrontier_Lounge3_Text_GetToBattleFactoryDouble, + BattleFrontier_Lounge3_Text_GetToBattlePalaceSingle, + BattleFrontier_Lounge3_Text_GetToBattlePalaceDouble, + BattleFrontier_Lounge3_Text_GetToBattleArena, + BattleFrontier_Lounge3_Text_GetToBattlePike, + BattleFrontier_Lounge3_Text_GetToBattlePyramid, }; ShowFieldMessage(sFrontierGamblerGoMessages[VarGet(VAR_FRONTIER_GAMBLER_SET_CHALLENGE)]); @@ -3212,31 +3213,31 @@ static void ShowBattleFrontierTutorMoveDescription(u8 menu, u16 selection) { static const u8 *const sBattleFrontier_TutorMoveDescriptions1[] = { - BattleFrontier_Lounge7_Text_265E30, - BattleFrontier_Lounge7_Text_265E5B, - BattleFrontier_Lounge7_Text_265E8A, - BattleFrontier_Lounge7_Text_265EC0, - BattleFrontier_Lounge7_Text_265EED, - BattleFrontier_Lounge7_Text_265F1C, - BattleFrontier_Lounge7_Text_265F47, - BattleFrontier_Lounge7_Text_265F77, - BattleFrontier_Lounge7_Text_265FAA, - BattleFrontier_Lounge7_Text_265FDD, + BattleFrontier_Lounge7_Text_SoftboiledDesc, + BattleFrontier_Lounge7_Text_SeismicTossDesc, + BattleFrontier_Lounge7_Text_DreamEaterDesc, + BattleFrontier_Lounge7_Text_MegaPunchDesc, + BattleFrontier_Lounge7_Text_MegaKickDesc, + BattleFrontier_Lounge7_Text_BodySlamDesc, + BattleFrontier_Lounge7_Text_RockSlideDesc, + BattleFrontier_Lounge7_Text_CounterDesc, + BattleFrontier_Lounge7_Text_ThunderWaveDesc, + BattleFrontier_Lounge7_Text_SwordsDanceDesc, gText_Exit, }; static const u8 *const sBattleFrontier_TutorMoveDescriptions2[] = { - BattleFrontier_Lounge7_Text_26600A, - BattleFrontier_Lounge7_Text_26603E, - BattleFrontier_Lounge7_Text_266070, - BattleFrontier_Lounge7_Text_2660A6, - BattleFrontier_Lounge7_Text_2660D0, - BattleFrontier_Lounge7_Text_2660FF, - BattleFrontier_Lounge7_Text_26612D, - BattleFrontier_Lounge7_Text_26615F, - BattleFrontier_Lounge7_Text_266185, - BattleFrontier_Lounge7_Text_2661B5, + BattleFrontier_Lounge7_Text_DefenseCurlDesc, + BattleFrontier_Lounge7_Text_SnoreDesc, + BattleFrontier_Lounge7_Text_MudSlapDesc, + BattleFrontier_Lounge7_Text_SwiftDesc, + BattleFrontier_Lounge7_Text_IcyWindDesc, + BattleFrontier_Lounge7_Text_EndureDesc, + BattleFrontier_Lounge7_Text_PsychUpDesc, + BattleFrontier_Lounge7_Text_IcePunchDesc, + BattleFrontier_Lounge7_Text_ThunderPunchDesc, + BattleFrontier_Lounge7_Text_FirePunchDesc, gText_Exit, }; diff --git a/src/fieldmap.c b/src/fieldmap.c index b2b80a2df..f595803ff 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -75,7 +75,7 @@ void InitBattlePyramidMap(bool8 setPlayerPosition) void InitTrainerHillMap(void) { CpuFastFill(0x03ff03ff, gBackupMapData, sizeof(gBackupMapData)); - sub_81D5FB4(gBackupMapData); + GenerateTrainerHillFloorLayout(gBackupMapData); } static void InitMapLayoutData(struct MapHeader *mapHeader) diff --git a/src/frontier_util.c b/src/frontier_util.c index 4a17159a6..baf830af9 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -680,38 +680,38 @@ const u16 gFrontierBannedSpecies[] = SPECIES_KYOGRE, SPECIES_GROUDON, SPECIES_RAYQUAZA, SPECIES_JIRACHI, SPECIES_DEOXYS, 0xFFFF }; -static const u8 *const gUnknown_08611CB0[][2] = -{ - {gText_BattleTower2, gUnknown_085ED164}, - {gText_BattleTower2, gUnknown_085ED170}, - {gText_BattleTower2, gUnknown_085ED17C}, - {gText_BattleDome, gUnknown_085ED164}, - {gText_BattlePalace, gUnknown_085ED164}, - {gText_BattleArena, gUnknown_085ED190}, - {gText_BattleFactory, gUnknown_085ED164}, - {gText_BattlePike, gUnknown_085ED190}, - {gText_BattlePyramid, gUnknown_085ED190}, - {gText_BattleTower2, gUnknown_085ED188}, +static const u8 *const sRecordsWindowChallengeTexts[][2] = +{ + [RANKING_HALL_BATTLE_TOWER_SINGLES] = {gText_BattleTower2, gText_FacilitySingle}, + [RANKING_HALL_BATTLE_TOWER_DOUBLES] = {gText_BattleTower2, gText_FacilityDouble}, + [RANKING_HALL_BATTLE_TOWER_MULTIS] = {gText_BattleTower2, gText_FacilityMulti}, + [RANKING_HALL_BATTLE_DOME] = {gText_BattleDome, gText_FacilitySingle}, + [RANKING_HALL_BATTLE_PALACE] = {gText_BattlePalace, gText_FacilitySingle}, + [RANKING_HALL_BATTLE_ARENA] = {gText_BattleArena, gText_Facility}, + [RANKING_HALL_BATTLE_FACTORY] = {gText_BattleFactory, gText_FacilitySingle}, + [RANKING_HALL_BATTLE_PIKE] = {gText_BattlePike, gText_Facility}, + [RANKING_HALL_BATTLE_PYRAMID] = {gText_BattlePyramid, gText_Facility}, + [RANKING_HALL_BATTLE_TOWER_LINK] = {gText_BattleTower2, gText_FacilityLink}, }; -static const u8 *const gLevelModeText[] = +static const u8 *const sLevelModeText[] = { gText_RecordsLv50, gText_RecordsOpenLevel, }; -static const u8 *const gHallFacilityToRecordsText[] = -{ - gText_FrontierFacilityWinStreak, - gText_FrontierFacilityWinStreak, - gText_FrontierFacilityWinStreak, - gText_FrontierFacilityClearStreak, - gText_FrontierFacilityWinStreak, - gText_FrontierFacilityKOsStreak, - gText_FrontierFacilityWinStreak, - gText_FrontierFacilityRoomsCleared, - gText_FrontierFacilityFloorsCleared, - gText_FrontierFacilityWinStreak, +static const u8 *const sHallFacilityToRecordsText[] = +{ + [RANKING_HALL_BATTLE_TOWER_SINGLES] = gText_FrontierFacilityWinStreak, + [RANKING_HALL_BATTLE_TOWER_DOUBLES] = gText_FrontierFacilityWinStreak, + [RANKING_HALL_BATTLE_TOWER_MULTIS] = gText_FrontierFacilityWinStreak, + [RANKING_HALL_BATTLE_DOME] = gText_FrontierFacilityClearStreak, + [RANKING_HALL_BATTLE_PALACE] = gText_FrontierFacilityWinStreak, + [RANKING_HALL_BATTLE_ARENA] = gText_FrontierFacilityKOsStreak, + [RANKING_HALL_BATTLE_FACTORY] = gText_FrontierFacilityWinStreak, + [RANKING_HALL_BATTLE_PIKE] = gText_FrontierFacilityRoomsCleared, + [RANKING_HALL_BATTLE_PYRAMID] = gText_FrontierFacilityFloorsCleared, + [RANKING_HALL_BATTLE_TOWER_LINK] = gText_FrontierFacilityWinStreak, }; static const u16 gFacilityToBrainTrainerId[] = @@ -2220,8 +2220,8 @@ static void Print1PRecord(s32 position, s32 x, s32 y, struct RankingHall1P *hall if (winStreak > 9999) winStreak = 9999; ConvertIntToDecimalStringN(gStringVar2, winStreak, STR_CONV_MODE_RIGHT_ALIGN, 4); - StringExpandPlaceholders(gStringVar4, gHallFacilityToRecordsText[hallFacilityId]); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, GetStringRightAlignXOffset(1, gHallFacilityToRecordsText[hallFacilityId], 0xC8), (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL); + StringExpandPlaceholders(gStringVar4, sHallFacilityToRecordsText[hallFacilityId]); + AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, GetStringRightAlignXOffset(1, sHallFacilityToRecordsText[hallFacilityId], 0xC8), (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL); } } @@ -2247,8 +2247,8 @@ static void Print2PRecord(s32 position, s32 x, s32 y, struct RankingHall2P *hall if (winStreak > 9999) winStreak = 9999; ConvertIntToDecimalStringN(gStringVar2, winStreak, STR_CONV_MODE_RIGHT_ALIGN, 4); - StringExpandPlaceholders(gStringVar4, gHallFacilityToRecordsText[9]); - AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, GetStringRightAlignXOffset(1, gHallFacilityToRecordsText[9], 0xC8), (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL); + StringExpandPlaceholders(gStringVar4, sHallFacilityToRecordsText[RANKING_HALL_BATTLE_TOWER_LINK]); + AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, GetStringRightAlignXOffset(1, sHallFacilityToRecordsText[RANKING_HALL_BATTLE_TOWER_LINK], 0xC8), (8 * (y + 5 * position)) + 1, TEXT_SPEED_FF, NULL); } } @@ -2327,12 +2327,12 @@ static void PrintHallRecords(s32 hallFacilityId, s32 lvlMode) struct RankingHall1P records1P[3]; struct RankingHall2P records2P[3]; - StringCopy(gStringVar1, gUnknown_08611CB0[hallFacilityId][0]); - StringExpandPlaceholders(gStringVar4, gUnknown_08611CB0[hallFacilityId][1]); + StringCopy(gStringVar1, sRecordsWindowChallengeTexts[hallFacilityId][0]); + StringExpandPlaceholders(gStringVar4, sRecordsWindowChallengeTexts[hallFacilityId][1]); AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); - x = GetStringRightAlignXOffset(1, gLevelModeText[lvlMode], 0xD0); - AddTextPrinterParameterized(gRecordsWindowId, 1, gLevelModeText[lvlMode], x, 1, TEXT_SPEED_FF, NULL); - if (hallFacilityId == HALL_FACILITIES_COUNT) + x = GetStringRightAlignXOffset(1, sLevelModeText[lvlMode], 0xD0); + AddTextPrinterParameterized(gRecordsWindowId, 1, sLevelModeText[lvlMode], x, 1, TEXT_SPEED_FF, NULL); + if (hallFacilityId == RANKING_HALL_BATTLE_TOWER_LINK) { gSaveBlock2Ptr->frontier.opponentName[0][PLAYER_NAME_LENGTH] = EOS; gSaveBlock2Ptr->frontier.opponentName[1][PLAYER_NAME_LENGTH] = EOS; diff --git a/src/overworld.c b/src/overworld.c index 42a39d03e..c2e3d2789 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -64,6 +64,7 @@ #include "constants/region_map_sections.h" #include "constants/songs.h" #include "constants/species.h" +#include "constants/trainer_hill.h" #include "constants/weather.h" #define PLAYER_TRADING_STATE_IDLE 0x80 @@ -854,7 +855,7 @@ static void mli0_load_map(u32 a1) if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_EMPTY_SQUARE) LoadBattlePyramidEventObjectTemplates(); else if (InTrainerHill()) - sub_81D5DF8(); + LoadTrainerHillEventObjectTemplates(); else LoadEventObjTemplatesFromHeader(); } @@ -1721,8 +1722,8 @@ void CB2_ContinueSavedGame(void) trainerHillMapId = GetCurrentTrainerHillMapId(); if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_EMPTY_SQUARE) LoadBattlePyramidFloorEventObjectScripts(); - else if (trainerHillMapId != 0 && trainerHillMapId != 6) - sub_81D5F48(); + else if (trainerHillMapId != 0 && trainerHillMapId != TRAINER_HILL_ENTRANCE) + LoadTrainerHillFloorEventObjectScripts(); else LoadSaveblockEventObjScripts(); diff --git a/src/strings.c b/src/strings.c index ef63b52c4..afa567b9f 100644 --- a/src/strings.c +++ b/src/strings.c @@ -1220,11 +1220,11 @@ const u8 gText_BattleArena[] = _("BATTLE ARENA"); const u8 gText_BattlePike[] = _("BATTLE PIKE"); const u8 gText_BattlePyramid[] = _("BATTLE PYRAMID"); -ALIGNED(4) const u8 gUnknown_085ED164[] = _("{STR_VAR_1} SINGLE"); -ALIGNED(4) const u8 gUnknown_085ED170[] = _("{STR_VAR_1} DOUBLE"); -ALIGNED(4) const u8 gUnknown_085ED17C[] = _("{STR_VAR_1} MULTI"); -ALIGNED(4) const u8 gUnknown_085ED188[] = _("{STR_VAR_1} LINK"); -ALIGNED(4) const u8 gUnknown_085ED190[] = _("{STR_VAR_1}"); +ALIGNED(4) const u8 gText_FacilitySingle[] = _("{STR_VAR_1} SINGLE"); +ALIGNED(4) const u8 gText_FacilityDouble[] = _("{STR_VAR_1} DOUBLE"); +ALIGNED(4) const u8 gText_FacilityMulti[] = _("{STR_VAR_1} MULTI"); +ALIGNED(4) const u8 gText_FacilityLink[] = _("{STR_VAR_1} LINK"); +ALIGNED(4) const u8 gText_Facility[] = _("{STR_VAR_1}"); const u8 gText_Give[] = _("Give"); const u8 gText_NoNeed[] = _("No need"); diff --git a/src/trainer_hill.c b/src/trainer_hill.c index af6b0621d..b84920a62 100644 --- a/src/trainer_hill.c +++ b/src/trainer_hill.c @@ -22,6 +22,7 @@ #include "trainer_hill.h" #include "window.h" #include "util.h" +#include "constants/battle_ai.h" #include "constants/event_object_movement_constants.h" #include "constants/event_objects.h" #include "constants/items.h" @@ -45,7 +46,7 @@ struct TrHillStruct2 { u8 floorId; struct TrHillTag tag; - struct TrHillFloor floors[4]; + struct TrHillFloor floors[NUM_TRAINER_HILL_FLOORS]; }; static EWRAM_DATA struct TrHillStruct2 *sHillData = NULL; @@ -54,30 +55,30 @@ EWRAM_DATA u32 *gTrainerHillVBlankCounter = NULL; // This file's functions. static void TrainerHillStartChallenge(void); -static void sub_81D58D8(void); -static void sub_81D5924(void); -static void sub_81D59D0(void); +static void GetOwnerState(void); +static void GiveChallengePrize(void); +static void CheckFinalTime(void); static void TrainerHillResumeTimer(void); static void TrainerHillSetPlayerLost(void); static void TrainerHillGetChallengeStatus(void); -static void sub_81D5B2C(void); -static void sub_81D5BBC(void); -static void sub_81D5C00(void); -static void GetInTrainerHill(void); -static void sub_81D62B4(void); -static void sub_81D64AC(void); -static void sub_81D64DC(void); -static void sub_81D64FC(void); -static void sub_81D6518(void); -static void sub_81D6568(void); +static void BufferChallengeTime(void); +static void GetAllFloorsUsed(void); +static void ClearVarResult(void); +static void IsTrainerHillChallengeActive(void); +static void ShowTrainerHillPostBattleText(void); +static void SetAllTrainerFlags(void); +static void GetGameSaved(void); +static void SetGameSaved(void); +static void ClearGameSaved(void); +static void GetChallengeWon(void); static void TrainerHillSetTag(void); static void SetUpDataStruct(void); static void FreeDataStruct(void); static void nullsub_2(void); static void SetTimerValue(u32 *dst, u32 val); static u32 GetTimerValue(u32 *src); -static void sub_81D642C(struct Pokemon *mon, u8 level); -static u16 sub_81D6640(void); +static void SetTrainerHillMonLevel(struct Pokemon *mon, u8 level); +static u16 GetPrizeItemId(void); // const data #include "data/battle_frontier/trainer_hill.h" @@ -86,7 +87,7 @@ struct { u8 trainerClass; u8 musicId; -} static const gUnknown_0862A3B4[] = +} static const sTrainerClassesAndMusic[] = { {TRAINER_CLASS_TEAM_AQUA, TRAINER_ENCOUNTER_MUSIC_AQUA}, {TRAINER_CLASS_AQUA_ADMIN, TRAINER_ENCOUNTER_MUSIC_AQUA}, @@ -144,63 +145,64 @@ struct {TRAINER_CLASS_SCHOOL_KID, TRAINER_ENCOUNTER_MUSIC_MALE}, }; -static const u16 gUnknown_0862A48C[] = {ITEM_RARE_CANDY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A498[] = {ITEM_LUXURY_BALL, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A4A4[] = {ITEM_MAX_REVIVE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A4B0[] = {ITEM_MAX_ETHER, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A4BC[] = {ITEM_ELIXIR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A4C8[] = {ITEM_TM05_ROAR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A4D4[] = {ITEM_TM36_SLUDGE_BOMB, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A4E0[] = {ITEM_TM06_TOXIC, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A4EC[] = {ITEM_TM11_SUNNY_DAY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A4F8[] = {ITEM_TM26_EARTHQUAKE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A504[] = {ITEM_RARE_CANDY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A510[] = {ITEM_LUXURY_BALL, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A51C[] = {ITEM_MAX_REVIVE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A528[] = {ITEM_MAX_ETHER, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A534[] = {ITEM_ELIXIR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A540[] = {ITEM_TM31_BRICK_BREAK, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A54C[] = {ITEM_TM41_TORMENT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A558[] = {ITEM_TM48_SKILL_SWAP, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A564[] = {ITEM_TM19_GIGA_DRAIN, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; -static const u16 gUnknown_0862A570[] = {ITEM_TM45_ATTRACT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; - -static const u16 *const gUnknown_0862A57C[] = -{ - gUnknown_0862A48C, - gUnknown_0862A498, - gUnknown_0862A4A4, - gUnknown_0862A4B0, - gUnknown_0862A4BC, - gUnknown_0862A4C8, - gUnknown_0862A4D4, - gUnknown_0862A4E0, - gUnknown_0862A4EC, - gUnknown_0862A4F8 +static const u16 sPrizeListRareCandy1[] = {ITEM_RARE_CANDY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListLuxuryBall1[] = {ITEM_LUXURY_BALL, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListMaxRevive1[] = {ITEM_MAX_REVIVE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListMaxEther1[] = {ITEM_MAX_ETHER, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListElixir1[] = {ITEM_ELIXIR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListRoar[] = {ITEM_TM05_ROAR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListSludgeBomb[] = {ITEM_TM36_SLUDGE_BOMB, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListToxic[] = {ITEM_TM06_TOXIC, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListSunnyDay[] = {ITEM_TM11_SUNNY_DAY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListEarthQuake[] = {ITEM_TM26_EARTHQUAKE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; + +static const u16 sPrizeListRareCandy2[] = {ITEM_RARE_CANDY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListLuxuryBall2[] = {ITEM_LUXURY_BALL, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListMaxRevive2[] = {ITEM_MAX_REVIVE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListMaxEther2[] = {ITEM_MAX_ETHER, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListElixir2[] = {ITEM_ELIXIR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListBrickBreak[] = {ITEM_TM31_BRICK_BREAK, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListTorment[] = {ITEM_TM41_TORMENT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListSkillSwap[] = {ITEM_TM48_SKILL_SWAP, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListGigaSwap[] = {ITEM_TM19_GIGA_DRAIN, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 sPrizeListAttract[] = {ITEM_TM45_ATTRACT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; + +static const u16 *const sPrizeLists1[NUM_TRAINER_HILL_PRIZE_LISTS] = +{ + sPrizeListRareCandy1, + sPrizeListLuxuryBall1, + sPrizeListMaxRevive1, + sPrizeListMaxEther1, + sPrizeListElixir1, + sPrizeListRoar, + sPrizeListSludgeBomb, + sPrizeListToxic, + sPrizeListSunnyDay, + sPrizeListEarthQuake }; -static const u16 *const gUnknown_0862A5A4[] = -{ - gUnknown_0862A504, - gUnknown_0862A510, - gUnknown_0862A51C, - gUnknown_0862A528, - gUnknown_0862A534, - gUnknown_0862A540, - gUnknown_0862A54C, - gUnknown_0862A558, - gUnknown_0862A564, - gUnknown_0862A570 +static const u16 *const sPrizeLists2[NUM_TRAINER_HILL_PRIZE_LISTS] = +{ + sPrizeListRareCandy2, + sPrizeListLuxuryBall2, + sPrizeListMaxRevive2, + sPrizeListMaxEther2, + sPrizeListElixir2, + sPrizeListBrickBreak, + sPrizeListTorment, + sPrizeListSkillSwap, + sPrizeListGigaSwap, + sPrizeListAttract }; -static const u16 *const *const gUnknown_0862A5CC[] = +static const u16 *const *const sPrizeListSets[] = { - gUnknown_0862A57C, - gUnknown_0862A5A4 + sPrizeLists1, + sPrizeLists2 }; -static const u16 gUnknown_0862A5D4[] = INCBIN_U16("graphics/pokenav/862A5D4.gbapal"); -static const u8 sRecordWinColors[] = {0, 2, 3}; +static const u16 sUnknown_0862A5D4[] = INCBIN_U16("graphics/pokenav/862A5D4.gbapal"); +static const u8 sRecordWinColors[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY}; static const struct TrHillTag *const sDataPerTag[] = { @@ -221,24 +223,24 @@ static const u8 *const sFloorStrings[] = static void (* const sHillFunctions[])(void) = { - TrainerHillStartChallenge, - sub_81D58D8, - sub_81D5924, - sub_81D59D0, - TrainerHillResumeTimer, - TrainerHillSetPlayerLost, - TrainerHillGetChallengeStatus, - sub_81D5B2C, - sub_81D5BBC, - sub_81D5C00, - GetInTrainerHill, - sub_81D62B4, - sub_81D64AC, - sub_81D64DC, - sub_81D64FC, - sub_81D6518, - sub_81D6568, - TrainerHillSetTag, + [TRAINER_HILL_FUNC_START] = TrainerHillStartChallenge, + [TRAINER_HILL_FUNC_GET_OWNER_STATE] = GetOwnerState, + [TRAINER_HILL_FUNC_GIVE_PRIZE] = GiveChallengePrize, + [TRAINER_HILL_FUNC_CHECK_FINAL_TIME] = CheckFinalTime, + [TRAINER_HILL_FUNC_RESUME_TIMER] = TrainerHillResumeTimer, + [TRAINER_HILL_FUNC_SET_LOST] = TrainerHillSetPlayerLost, + [TRAINER_HILL_FUNC_GET_CHALLENGE_STATUS] = TrainerHillGetChallengeStatus, + [TRAINER_HILL_FUNC_GET_CHALLENGE_TIME] = BufferChallengeTime, + [TRAINER_HILL_FUNC_GET_ALL_FLOORS_USED] = GetAllFloorsUsed, + [TRAINER_HILL_FUNC_CLEAR_RESULT] = ClearVarResult, + [TRAINER_HILL_FUNC_IN_CHALLENGE] = IsTrainerHillChallengeActive, + [TRAINER_HILL_FUNC_POST_BATTLE_TEXT] = ShowTrainerHillPostBattleText, + [TRAINER_HILL_FUNC_SET_ALL_TRAINER_FLAGS] = SetAllTrainerFlags, + [TRAINER_HILL_FUNC_GET_GAME_SAVED] = GetGameSaved, + [TRAINER_HILL_FUNC_SET_GAME_SAVED] = SetGameSaved, + [TRAINER_HILL_FUNC_CLEAR_GAME_SAVED] = ClearGameSaved, + [TRAINER_HILL_FUNC_GET_WON] = GetChallengeWon, + [TRAINER_HILL_FUNC_SET_TAG] = TrainerHillSetTag, }; static const u8 *const sTagMatchStrings[] = @@ -249,7 +251,7 @@ static const u8 *const sTagMatchStrings[] = gText_ExpertTagMatch, }; -static const struct EventObjectTemplate gUnknown_0862A670 = +static const struct EventObjectTemplate sTrainerEventObjectTemplate = { .graphicsId = EVENT_OBJ_GFX_RIVAL_BRENDAN_NORMAL, .elevation = 3, @@ -259,8 +261,18 @@ static const struct EventObjectTemplate gUnknown_0862A670 = .trainerType = 1, }; -static const u32 gUnknown_0862A688[] = {MAP_NUM(TRAINER_HILL_2F), MAP_NUM(TRAINER_HILL_3F), MAP_NUM(TRAINER_HILL_4F), MAP_NUM(TRAINER_HILL_ROOF)}; -static const u8 gUnknown_0862A698[][3] = {{0, 1, 2}, {3, 4, 5}}; +static const u32 sNextFloorMapNum[NUM_TRAINER_HILL_FLOORS] = +{ + MAP_NUM(TRAINER_HILL_2F), + MAP_NUM(TRAINER_HILL_3F), + MAP_NUM(TRAINER_HILL_4F), + MAP_NUM(TRAINER_HILL_ROOF) +}; +static const u8 sTrainerPartySlots[][PARTY_SIZE / 2] = +{ + {0, 1, 2}, + {3, 4, 5} +}; // code void CallTrainerHillFunction(void) @@ -274,8 +286,8 @@ void ResetTrainerHillResults(void) { s32 i; - gSaveBlock2Ptr->frontier.field_EF9_1 = 0; - gSaveBlock2Ptr->frontier.field_EF9_0 = 0; + gSaveBlock2Ptr->frontier.savedGame = 0; + gSaveBlock2Ptr->frontier.unk_EF9 = 0; gSaveBlock1Ptr->trainerHill.bestTime = 0; for (i = 0; i < 4; i++) SetTimerValue(&gSaveBlock1Ptr->trainerHillTimes[i], HILL_MAX_TIME); @@ -366,16 +378,16 @@ void CopyTrainerHillTrainerText(u8 which, u16 trainerId) switch (which) { - case 2: + case TRAINER_HILL_TEXT_INTRO: FrontierSpeechToString(sHillData->floors[floorId].trainers[id].speechBefore); break; - case 3: + case TRAINER_HILL_TEXT_PLAYER_LOST: FrontierSpeechToString(sHillData->floors[floorId].trainers[id].speechWin); break; - case 4: + case TRAINER_HILL_TEXT_PLAYER_WON: FrontierSpeechToString(sHillData->floors[floorId].trainers[id].speechLose); break; - case 5: + case TRAINER_HILL_TEXT_AFTER: FrontierSpeechToString(sHillData->floors[floorId].trainers[id].speechAfter); break; } @@ -391,42 +403,42 @@ static void TrainerHillStartChallenge(void) else gSaveBlock1Ptr->trainerHill.field_3D6E_0f = 0; - gSaveBlock1Ptr->trainerHill.field_3D6C = 0; + gSaveBlock1Ptr->trainerHill.unk_3D6C = 0; SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer); gSaveBlock1Ptr->trainerHill.timer = 0; - gSaveBlock1Ptr->trainerHill.field_3D6E_0c = 0; - gSaveBlock1Ptr->trainerHill.field_3D6E_0b = 0; + gSaveBlock1Ptr->trainerHill.spokeToOwner = 0; + gSaveBlock1Ptr->trainerHill.checkedFinalTime = 0; gSaveBlock1Ptr->trainerHill.maybeECardScanDuringChallenge = 0; - gSaveBlock2Ptr->frontier.field_EE0 = 0; + gSaveBlock2Ptr->frontier.trainerFlags = 0; gBattleOutcome = 0; - gSaveBlock1Ptr->trainerHill.field_3D6E_0a = 0; + gSaveBlock1Ptr->trainerHill.receivedPrize = 0; } -static void sub_81D58D8(void) +static void GetOwnerState(void) { ClearTrainerHillVBlankCounter(); gSpecialVar_Result = 0; - if (gSaveBlock1Ptr->trainerHill.field_3D6E_0c) + if (gSaveBlock1Ptr->trainerHill.spokeToOwner) gSpecialVar_Result++; - if (gSaveBlock1Ptr->trainerHill.field_3D6E_0a && gSaveBlock1Ptr->trainerHill.field_3D6E_0b) + if (gSaveBlock1Ptr->trainerHill.receivedPrize && gSaveBlock1Ptr->trainerHill.checkedFinalTime) gSpecialVar_Result++; - gSaveBlock1Ptr->trainerHill.field_3D6E_0c = 1; + gSaveBlock1Ptr->trainerHill.spokeToOwner = TRUE; } -static void sub_81D5924(void) +static void GiveChallengePrize(void) { - u16 itemId = sub_81D6640(); + u16 itemId = GetPrizeItemId(); - if (sHillData->tag.numFloors != 4 || gSaveBlock1Ptr->trainerHill.field_3D6E_0a) + if (sHillData->tag.numFloors != NUM_TRAINER_HILL_FLOORS || gSaveBlock1Ptr->trainerHill.receivedPrize) { gSpecialVar_Result = 2; } else if (AddBagItem(itemId, 1) == TRUE) { CopyItemName(itemId, gStringVar2); - gSaveBlock1Ptr->trainerHill.field_3D6E_0a = 1; - gSaveBlock2Ptr->frontier.field_EF9_0 = 0; + gSaveBlock1Ptr->trainerHill.receivedPrize = TRUE; + gSaveBlock2Ptr->frontier.unk_EF9 = 0; gSpecialVar_Result = 0; } else @@ -435,9 +447,11 @@ static void sub_81D5924(void) } } -static void sub_81D59D0(void) +// If bestTime > timer, the challenge was completed faster and its a new record +// Otherwise the owner says it was a slow time and to complete it faster next time +static void CheckFinalTime(void) { - if (gSaveBlock1Ptr->trainerHill.field_3D6E_0b) + if (gSaveBlock1Ptr->trainerHill.checkedFinalTime) { gSpecialVar_Result = 2; } @@ -452,12 +466,12 @@ static void sub_81D59D0(void) gSpecialVar_Result = 1; } - gSaveBlock1Ptr->trainerHill.field_3D6E_0b = 1; + gSaveBlock1Ptr->trainerHill.checkedFinalTime = TRUE; } static void TrainerHillResumeTimer(void) { - if (!gSaveBlock1Ptr->trainerHill.field_3D6E_0c) + if (!gSaveBlock1Ptr->trainerHill.spokeToOwner) { if (gSaveBlock1Ptr->trainerHill.timer >= HILL_MAX_TIME) gSaveBlock1Ptr->trainerHill.timer = HILL_MAX_TIME; @@ -468,7 +482,7 @@ static void TrainerHillResumeTimer(void) static void TrainerHillSetPlayerLost(void) { - gSaveBlock1Ptr->trainerHill.hasLost = 1; + gSaveBlock1Ptr->trainerHill.hasLost = TRUE; } static void TrainerHillGetChallengeStatus(void) @@ -476,7 +490,7 @@ static void TrainerHillGetChallengeStatus(void) if (gSaveBlock1Ptr->trainerHill.hasLost) { // The player lost their last match. - gSaveBlock1Ptr->trainerHill.hasLost = 0; + gSaveBlock1Ptr->trainerHill.hasLost = FALSE; gSpecialVar_Result = TRAINER_HILL_PLAYER_STATUS_LOST; } else if (gSaveBlock1Ptr->trainerHill.maybeECardScanDuringChallenge) @@ -492,7 +506,7 @@ static void TrainerHillGetChallengeStatus(void) } } -static void sub_81D5B2C(void) +static void BufferChallengeTime(void) { s32 total, minutes, secondsWhole, secondsFraction; @@ -511,23 +525,27 @@ static void sub_81D5B2C(void) ConvertIntToDecimalStringN(gStringVar3, secondsFraction, STR_CONV_MODE_LEADING_ZEROS, 2); } -static void sub_81D5BBC(void) +// Returns TRUE if all 4 floors are used +// Returns FALSE otherwise, and buffers the number of floors used +// The only time fewer than all 4 floors are used is for the JP-exclusive E-Reader and Default modes +static void GetAllFloorsUsed(void) { SetUpDataStruct(); - if (sHillData->tag.numFloors != 4) + if (sHillData->tag.numFloors != NUM_TRAINER_HILL_FLOORS) { ConvertIntToDecimalStringN(gStringVar1, sHillData->tag.numFloors, STR_CONV_MODE_LEFT_ALIGN, 1); - gSpecialVar_Result = 0; + gSpecialVar_Result = FALSE; } else { - gSpecialVar_Result = 1; + gSpecialVar_Result = TRUE; } FreeDataStruct(); } -static void sub_81D5C00(void) +// May have been dummied. Every time this is called a conditional for var result occurs afterwards +static void ClearVarResult(void) { SetUpDataStruct(); gSpecialVar_Result = 0; @@ -538,7 +556,7 @@ bool8 InTrainerHillChallenge(void) { if (VarGet(VAR_TRAINER_HILL_IS_ACTIVE) == 0) return FALSE; - else if (gSaveBlock1Ptr->trainerHill.field_3D6E_0c) + else if (gSaveBlock1Ptr->trainerHill.spokeToOwner) return FALSE; else if (GetCurrentTrainerHillMapId() != 0) return TRUE; @@ -546,12 +564,12 @@ bool8 InTrainerHillChallenge(void) return FALSE; } -static void GetInTrainerHill(void) +static void IsTrainerHillChallengeActive(void) { if (!InTrainerHillChallenge()) - gSpecialVar_Result = 0; + gSpecialVar_Result = FALSE; else - gSpecialVar_Result = 1; + gSpecialVar_Result = TRUE; } void nullsub_129(void) @@ -611,12 +629,12 @@ static void SetTimerValue(u32 *dst, u32 val) *dst = val; } -void sub_81D5DF8(void) +void LoadTrainerHillEventObjectTemplates(void) { u8 i, floorId; struct EventObjectTemplate *eventTemplates = gSaveBlock1Ptr->eventObjectTemplates; - if (!sub_81D5F48()) + if (!LoadTrainerHillFloorEventObjectScripts()) return; SetUpDataStruct(); @@ -629,7 +647,7 @@ void sub_81D5DF8(void) { u8 bits; - eventTemplates[i] = gUnknown_0862A670; + eventTemplates[i] = sTrainerEventObjectTemplate; eventTemplates[i].localId = i + 1; eventTemplates[i].graphicsId = FacilityClassToGraphicsId(sHillData->floors[floorId].trainers[i].facilityClass); eventTemplates[i].x = sHillData->floors[floorId].display.coords[i] & 0xF; @@ -637,16 +655,17 @@ void sub_81D5DF8(void) bits = i << 2; eventTemplates[i].movementType = ((sHillData->floors[floorId].display.direction >> bits) & 0xF) + MOVEMENT_TYPE_FACE_UP; eventTemplates[i].trainerRange_berryTreeId = (sHillData->floors[floorId].display.range >> bits) & 0xF; - eventTemplates[i].script = EventScript_2C83F0; + eventTemplates[i].script = TrainerHill_EventScript_TrainerBattle; gSaveBlock2Ptr->frontier.trainerIds[i] = i + 1; } FreeDataStruct(); } -bool32 sub_81D5F48(void) +bool32 LoadTrainerHillFloorEventObjectScripts(void) { SetUpDataStruct(); + // Something may have been dummied here FreeDataStruct(); return TRUE; } @@ -657,8 +676,8 @@ static u32 sub_81D5F58(u8 floorId, u32 bit, u32 arg2, u32 arg3) { u32 var0, var1, var2, var3; - var0 = (sHillData->floors[floorId].unk3A0[arg2] >> (15 - bit)) & 1; - var1 = sHillData->floors[floorId].data[arg2 * arg3 + bit]; + var0 = (sHillData->floors[floorId].display.unk3A0[arg2] >> (15 - bit)) & 1; + var1 = sHillData->floors[floorId].display.data[arg2 * arg3 + bit]; var3 = 0x200; var2 = 0x3000; @@ -716,20 +735,20 @@ static u32 sub_81D5F58(u8 floorId, u32 bit, u32 arg2, u32 arg3) } #endif // NONMATCHING -void sub_81D5FB4(u16 *mapArg) +void GenerateTrainerHillFloorLayout(u16 *mapArg) { s32 i, j; u16 *src, *dst; u8 mapId = GetCurrentTrainerHillMapId(); - if (mapId == 6) + if (mapId == TRAINER_HILL_ENTRANCE) { InitMapFromSavedGame(); return; } SetUpDataStruct(); - if (mapId == 5) + if (mapId == TRAINER_HILL_ROOF) { InitMapFromSavedGame(); FreeDataStruct(); @@ -766,9 +785,9 @@ bool32 InTrainerHill(void) bool32 ret; if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_1F - || gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_2F - || gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_3F - || gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_4F) + || gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_2F + || gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_3F + || gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_4F) ret = TRUE; else ret = FALSE; @@ -778,58 +797,61 @@ bool32 InTrainerHill(void) u8 GetCurrentTrainerHillMapId(void) { - u8 ret; + u8 mapId; if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_1F) - ret = 1; + mapId = TRAINER_HILL_1F; else if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_2F) - ret = 2; + mapId = TRAINER_HILL_2F; else if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_3F) - ret = 3; + mapId = TRAINER_HILL_3F; else if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_4F) - ret = 4; + mapId = TRAINER_HILL_4F; else if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_ROOF) - ret = 5; + mapId = TRAINER_HILL_ROOF; else if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_ENTRANCE) - ret = 6; + mapId = TRAINER_HILL_ENTRANCE; else - ret = 0; + mapId = 0; - return ret; + return mapId; } -static bool32 sub_81D6100(void) +// Unused +static bool32 OnTrainerHillRoof(void) { - bool32 ret; + bool32 onRoof; if (gMapHeader.mapLayoutId == LAYOUT_TRAINER_HILL_ROOF) - ret = TRUE; + onRoof = TRUE; else - ret = FALSE; + onRoof = FALSE; - return ret; + return onRoof; } -const struct WarpEvent* sub_81D6120(void) +const struct WarpEvent* SetWarpDestinationTrainerHill4F(void) { const struct MapHeader *header = Overworld_GetMapHeaderByGroupAndId(MAP_GROUP(TRAINER_HILL_4F), MAP_NUM(TRAINER_HILL_4F)); return &header->events->warps[1]; } -const struct WarpEvent* sub_81D6134(u8 warpEventId) +// For warping from the roof in challenges where the 4F is not the final challenge floor +// This would only occur in the JP-exclusive Default and E-Reader challenges +const struct WarpEvent* SetWarpDestinationTrainerHillFinalFloor(u8 warpEventId) { - u8 id; + u8 numFloors; const struct MapHeader *header; if (warpEventId == 1) return &gMapHeader.events->warps[1]; - id = sub_81D6490(); - if (id == 0 || id >= 5) - id = 4; + numFloors = GetNumFloorsInTrainerHillChallenge(); + if (numFloors == 0 || numFloors > NUM_TRAINER_HILL_FLOORS) + numFloors = NUM_TRAINER_HILL_FLOORS; - header = Overworld_GetMapHeaderByGroupAndId(MAP_GROUP(TRAINER_HILL_4F), gUnknown_0862A688[id - 1]); + header = Overworld_GetMapHeaderByGroupAndId(MAP_GROUP(TRAINER_HILL_4F), sNextFloorMapNum[numFloors - 1]); return &header->events->warps[0]; } @@ -843,7 +865,7 @@ bool8 GetHillTrainerFlag(u8 eventObjectId) u32 floorId = GetFloorId() * 2; u8 bitId = gEventObjects[eventObjectId].localId - 1 + floorId; - return gSaveBlock2Ptr->frontier.field_EE0 & gBitTable[bitId]; + return gSaveBlock2Ptr->frontier.trainerFlags & gBitTable[bitId]; } void SetHillTrainerFlag(void) @@ -855,7 +877,7 @@ void SetHillTrainerFlag(void) { if (gSaveBlock2Ptr->frontier.trainerIds[i] == gTrainerBattleOpponent_A) { - gSaveBlock2Ptr->frontier.field_EE0 |= gBitTable[floorId + i]; + gSaveBlock2Ptr->frontier.trainerFlags |= gBitTable[floorId + i]; break; } } @@ -866,7 +888,7 @@ void SetHillTrainerFlag(void) { if (gSaveBlock2Ptr->frontier.trainerIds[i] == gTrainerBattleOpponent_B) { - gSaveBlock2Ptr->frontier.field_EE0 |= gBitTable[floorId + i]; + gSaveBlock2Ptr->frontier.trainerFlags |= gBitTable[floorId + i]; break; } } @@ -875,19 +897,19 @@ void SetHillTrainerFlag(void) const u8 *GetTrainerHillTrainerScript(void) { - return EventScript_2C83F0; + return TrainerHill_EventScript_TrainerBattle; } -static void sub_81D62B4(void) +static void ShowTrainerHillPostBattleText(void) { - CopyTrainerHillTrainerText(5, gSpecialVar_LastTalked); + CopyTrainerHillTrainerText(TRAINER_HILL_TEXT_AFTER, gSpecialVar_LastTalked); sub_80982B8(); } -static void sub_81D62CC(u16 trainerId, u8 firstMonId) +static void CreateNPCTrainerHillParty(u16 trainerId, u8 firstMonId) { u8 trId, level; - s32 i, floorId, arrId; + s32 i, floorId, partySlot; if (trainerId == 0 || trainerId > 2) return; @@ -896,13 +918,13 @@ static void sub_81D62CC(u16 trainerId, u8 firstMonId) SetUpDataStruct(); level = GetHighestLevelInPlayerParty(); floorId = GetFloorId(); - for (i = firstMonId, arrId = 0; i < firstMonId + 3; i++, arrId++) + for (i = firstMonId, partySlot = 0; i < firstMonId + 3; i++, partySlot++) { - u8 id = gUnknown_0862A698[trId][arrId]; + u8 id = sTrainerPartySlots[trId][partySlot]; struct Pokemon *mon = &gEnemyParty[i]; CreateBattleTowerMon(mon, &sHillData->floors[floorId].trainers[trId].mons[id]); - sub_81D642C(mon, level); + SetTrainerHillMonLevel(mon, level); } FreeDataStruct(); @@ -911,22 +933,22 @@ static void sub_81D62CC(u16 trainerId, u8 firstMonId) void FillHillTrainerParty(void) { ZeroEnemyPartyMons(); - sub_81D62CC(gTrainerBattleOpponent_A, 0); + CreateNPCTrainerHillParty(gTrainerBattleOpponent_A, 0); } void FillHillTrainersParties(void) { ZeroEnemyPartyMons(); - sub_81D62CC(gTrainerBattleOpponent_A, 0); - sub_81D62CC(gTrainerBattleOpponent_B, 3); + CreateNPCTrainerHillParty(gTrainerBattleOpponent_A, 0); + CreateNPCTrainerHillParty(gTrainerBattleOpponent_B, 3); } // This function is unused, but my best guess is // it was supposed to return AI scripts for trainer // hill trainers. -u32 sub_81D63C4(void) +u32 GetTrainerHillAIFlags(void) { - return 7; + return (AI_SCRIPT_CHECK_BAD_MOVE | AI_SCRIPT_TRY_TO_FAINT | AI_SCRIPT_CHECK_VIABILITY); } u8 GetTrainerEncounterMusicIdInTrainerHill(u16 trainerId) @@ -939,16 +961,16 @@ u8 GetTrainerEncounterMusicIdInTrainerHill(u16 trainerId) facilityClass = sHillData->floors[sHillData->floorId].trainers[trId].facilityClass; FreeDataStruct(); - for (i = 0; i < ARRAY_COUNT(gUnknown_0862A3B4); i++) + for (i = 0; i < ARRAY_COUNT(sTrainerClassesAndMusic); i++) { - if (gUnknown_0862A3B4[i].trainerClass == gFacilityClassToTrainerClass[facilityClass]) - return gUnknown_0862A3B4[i].musicId; + if (sTrainerClassesAndMusic[i].trainerClass == gFacilityClassToTrainerClass[facilityClass]) + return sTrainerClassesAndMusic[i].musicId; } return 0; } -static void sub_81D642C(struct Pokemon *mon, u8 level) +static void SetTrainerHillMonLevel(struct Pokemon *mon, u8 level) { u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL); u32 exp = gExperienceTables[gBaseStats[species].growthRate][level]; @@ -958,61 +980,63 @@ static void sub_81D642C(struct Pokemon *mon, u8 level) CalculateMonStats(mon); } -u8 sub_81D6490(void) +u8 GetNumFloorsInTrainerHillChallenge(void) { - u8 ret; + u8 floors; SetUpDataStruct(); - ret = sHillData->tag.numFloors; + floors = sHillData->tag.numFloors; FreeDataStruct(); - return ret; + return floors; } -static void sub_81D64AC(void) +static void SetAllTrainerFlags(void) { - gSaveBlock2Ptr->frontier.field_EE0 = 0xFF; + gSaveBlock2Ptr->frontier.trainerFlags = 0xFF; } +// Palette never loaded, sub_81D6534 always FALSE void sub_81D64C0(void) { if (sub_81D6534() == TRUE) - LoadPalette(gUnknown_0862A5D4, 0x70, 0x20); + LoadPalette(sUnknown_0862A5D4, 0x70, 0x20); } -static void sub_81D64DC(void) +static void GetGameSaved(void) { - gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_EF9_1; + gSpecialVar_Result = gSaveBlock2Ptr->frontier.savedGame; } -static void sub_81D64FC(void) +static void SetGameSaved(void) { - gSaveBlock2Ptr->frontier.field_EF9_1 = 1; + gSaveBlock2Ptr->frontier.savedGame = TRUE; } -static void sub_81D6518(void) +static void ClearGameSaved(void) { - gSaveBlock2Ptr->frontier.field_EF9_1 = 0; + gSaveBlock2Ptr->frontier.savedGame = FALSE; } +// Always FALSE bool32 sub_81D6534(void) { - if (!InTrainerHillChallenge() || GetCurrentTrainerHillMapId() == 6) + if (!InTrainerHillChallenge() || GetCurrentTrainerHillMapId() == TRAINER_HILL_ENTRANCE) return FALSE; - sub_81D5C00(); + ClearVarResult(); if (gSpecialVar_Result == 0) return FALSE; else return TRUE; } -static void sub_81D6568(void) +static void GetChallengeWon(void) { if (gSaveBlock1Ptr->trainerHill.hasLost) - gSpecialVar_Result = 0; + gSpecialVar_Result = FALSE; else - gSpecialVar_Result = 1; + gSpecialVar_Result = TRUE; } static void TrainerHillSetTag(void) @@ -1021,49 +1045,50 @@ static void TrainerHillSetTag(void) gSaveBlock1Ptr->trainerHill.bestTime = gSaveBlock1Ptr->trainerHillTimes[gSpecialVar_0x8005]; } -static u8 sub_81D65E8(u8 arg0) +static u8 GetPrizeListId(bool8 maxTrainers) { - u8 var, i, modBy; + u8 prizeListId, i, modBy; - var = 0; - for (i = 0; i < 4; i++) + prizeListId = 0; + for (i = 0; i < NUM_TRAINER_HILL_FLOORS; i++) { - var ^= sHillData->floors[i].unk0 & 0x1F; - var ^= sHillData->floors[i].unk1 & 0x1F; + prizeListId ^= sHillData->floors[i].trainerNum1 & 0x1F; + prizeListId ^= sHillData->floors[i].trainerNum2 & 0x1F; } - if (arg0) - modBy = 10; + // Not possible to win TMs with fewer than 8 trainers + if (maxTrainers) + modBy = NUM_TRAINER_HILL_PRIZE_LISTS; else - modBy = 5; + modBy = NUM_TRAINER_HILL_PRIZE_LISTS / 2; - var %= modBy; - return var; + prizeListId %= modBy; + return prizeListId; } -static u16 sub_81D6640(void) +static u16 GetPrizeItemId(void) { u8 i; - const u16 *ptr; - s32 var = 0, var2, minutes, id; + const u16 *prizeList; + s32 var = 0, prizeListSetId, minutes, id; - for (i = 0; i < 4; i++) + for (i = 0; i < NUM_TRAINER_HILL_FLOORS; i++) { - var += sHillData->floors[i].unk0; - var += sHillData->floors[i].unk1; + var += sHillData->floors[i].trainerNum1; + var += sHillData->floors[i].trainerNum2; } - var2 = var / 256; - var2 %= 2; - if (FlagGet(FLAG_SYS_GAME_CLEAR) && sHillData->tag.unkField_0 == 8) - i = sub_81D65E8(1); + prizeListSetId = var / 256; + prizeListSetId %= 2; + if (FlagGet(FLAG_SYS_GAME_CLEAR) && sHillData->tag.numTrainers == NUM_TRAINER_HILL_TRAINERS) + i = GetPrizeListId(TRUE); else - i = sub_81D65E8(0); + i = GetPrizeListId(FALSE); if (gSaveBlock1Ptr->trainerHill.tag == HILL_TAG_EXPERT) - i = (i + 1) % 10; + i = (i + 1) % NUM_TRAINER_HILL_PRIZE_LISTS; - ptr = gUnknown_0862A5CC[var2][i]; + prizeList = sPrizeListSets[prizeListSetId][i]; minutes = (signed)(gSaveBlock1Ptr->trainerHill.timer) / (60 * 60); if (minutes < 12) id = 0; @@ -1078,5 +1103,5 @@ static u16 sub_81D6640(void) else id = 5; - return ptr[id]; + return prizeList[id]; } @@ -762,7 +762,7 @@ void ClearTVShowData(void) ClearPokemonNews(); } -u8 special_0x44(void) +u8 GetRandomActiveShowIdx(void) { u8 i; u8 j; @@ -771,10 +771,8 @@ u8 special_0x44(void) for (i = 5; i < ARRAY_COUNT(gSaveBlock1Ptr->tvShows) - 1; i ++) { - if (gSaveBlock1Ptr->tvShows[i].common.kind == 0) - { + if (gSaveBlock1Ptr->tvShows[i].common.kind == TVSHOW_OFF_AIR) break; - } } j = Random() % i; selIdx = j; @@ -783,44 +781,38 @@ u8 special_0x44(void) if (GetTVChannelByShowType(gSaveBlock1Ptr->tvShows[j].common.kind) != 4) { if (gSaveBlock1Ptr->tvShows[j].common.active == TRUE) - { return j; - } } else { show = &gSaveBlock1Ptr->tvShows[j]; if (show->massOutbreak.daysLeft == 0 && show->massOutbreak.active == TRUE) - { return j; - } } + if (j == 0) - { j = ARRAY_COUNT(gSaveBlock1Ptr->tvShows) - 2; - } else - { j --; - } + } while (j != selIdx); return 0xFF; } u8 FindAnyTVShowOnTheAir(void) { - u8 response; + u8 show; - response = special_0x44(); - if (response == 0xFF) + show = GetRandomActiveShowIdx(); + if (show == 0xFF) { return 0xFF; } - if (gSaveBlock1Ptr->outbreakPokemonSpecies != SPECIES_NONE && gSaveBlock1Ptr->tvShows[response].common.kind == TVSHOW_MASS_OUTBREAK) + if (gSaveBlock1Ptr->outbreakPokemonSpecies != SPECIES_NONE && gSaveBlock1Ptr->tvShows[show].common.kind == TVSHOW_MASS_OUTBREAK) { return FindFirstActiveTVShowThatIsNotAMassOutbreak(); } - return response; + return show; } void UpdateTVScreensOnMap(int width, int height) @@ -876,7 +868,7 @@ void TurnOnTVScreen(void) DrawWholeMapView(); } -u8 special_0x45(void) +u8 GetSelectedTVShow(void) { return gSaveBlock1Ptr->tvShows[gSpecialVar_0x8004].common.kind; } @@ -887,7 +879,7 @@ u8 FindFirstActiveTVShowThatIsNotAMassOutbreak(void) for (i = 0; i < ARRAY_COUNT(gSaveBlock1Ptr->tvShows) - 1; i ++) { - if (gSaveBlock1Ptr->tvShows[i].common.kind != 0 && gSaveBlock1Ptr->tvShows[i].common.kind != TVSHOW_MASS_OUTBREAK && gSaveBlock1Ptr->tvShows[i].common.active == TRUE) + if (gSaveBlock1Ptr->tvShows[i].common.kind != TVSHOW_OFF_AIR && gSaveBlock1Ptr->tvShows[i].common.kind != TVSHOW_MASS_OUTBREAK && gSaveBlock1Ptr->tvShows[i].common.active == TRUE) { return i; } @@ -895,7 +887,7 @@ u8 FindFirstActiveTVShowThatIsNotAMassOutbreak(void) return 0xFF; } -u8 special_0x4a(void) +u8 GetNextActiveShowIfMassOutbreak(void) { TVShow *tvShow; @@ -3149,7 +3141,7 @@ static void InterviewBefore_FanClubSpecial(void) } } -bool8 sub_80EF88C(u8 monIdx) +static bool8 IsPartyMonNicknamedOrNotEnglish(u8 monIdx) { struct Pokemon *pokemon; u8 language; @@ -3164,9 +3156,9 @@ bool8 sub_80EF88C(u8 monIdx) return TRUE; } -bool8 sub_80EF8F8(void) +bool8 IsLeadMonNicknamedOrNotEnglish(void) { - return sub_80EF88C(GetLeadMonIndex()); + return IsPartyMonNicknamedOrNotEnglish(GetLeadMonIndex()); } void DeleteTVShowInArrayByIdx(TVShow *shows, u8 idx) |