Document and clean up trainer hill

This commit is contained in:
DizzyEggg 2019-01-13 20:50:08 +01:00
parent c0bc01d301
commit edddd847c5
16 changed files with 244 additions and 215 deletions

View File

@ -2292,93 +2292,3 @@ gUnknown_086285E4:: @ 86285E4
gUnknown_086294CC:: @ 86294CC
.incbin "data/pokenav/unk_struct_4.bin"
gUnknown_0862A3B4:: @ 862A3B4
.byte 0x03, 0x06, 0x00, 0x00, 0x0B, 0x06, 0x00, 0x00, 0x0D, 0x06, 0x00, 0x00, 0x0F, 0x01, 0x00, 0x00, 0x2B, 0x04, 0x00, 0x00, 0x2D, 0x01, 0x00, 0x00, 0x24, 0x09, 0x00, 0x00, 0x29, 0x04, 0x00, 0x00, 0x05, 0x05, 0x00, 0x00, 0x18, 0x04, 0x00, 0x00, 0x2F, 0x00, 0x00, 0x00, 0x2E, 0x09, 0x00, 0x00, 0x11, 0x0C, 0x00, 0x00, 0x10, 0x0B, 0x00, 0x00, 0x1E, 0x0D, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x17, 0x03, 0x00, 0x00, 0x0C, 0x04, 0x00, 0x00, 0x38, 0x04, 0x00, 0x00, 0x1C, 0x03, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x19, 0x0B, 0x00, 0x00, 0x09, 0x07, 0x00, 0x00, 0x31, 0x07, 0x00, 0x00, 0x35, 0x07, 0x00, 0x00, 0x36, 0x01, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x2A, 0x03, 0x00, 0x00, 0x16, 0x0D, 0x00, 0x00, 0x0E, 0x03, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x2C, 0x01, 0x00, 0x00, 0x1B, 0x02, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x07, 0x03, 0x00, 0x00, 0x34, 0x05, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x37, 0x02, 0x00, 0x00, 0x1D, 0x04, 0x00, 0x00, 0x22, 0x09, 0x00, 0x00, 0x1F, 0x01, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x0A, 0x04, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x05, 0x00, 0x00, 0x27, 0x0B, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, 0x39, 0x08, 0x00, 0x00, 0x02, 0x0B, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00
gUnknown_0862A48C:: @ 862A48C
.2byte 0x44, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A498:: @ 862A498
.2byte 0xB, 0x22, 0x14, 0x18, 0x51, 3
gUnknown_0862A4A4:: @ 862A4A4
.2byte 0x19, 0x22, 0x14, 0x18, 0x51, 3
gUnknown_0862A4B0:: @ 862A4B0
.2byte 0x23, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A4BC:: @ 862A4BC
.2byte 0x24, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A4C8:: @ 862A4C8
.2byte 0x125, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A4D4:: @ 862A4D4
.2byte 0x144, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A4E0:: @ 862A4E0
.2byte 0x126, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A4EC:: @ 862A4EC
.2byte 0x12B, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A4F8:: @ 862A4F8
.2byte 0x13A, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A504:: @ 862A504
.2byte 0x44, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A510:: @ 862A510
.2byte 0xB, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A51C:: @ 862A51C
.2byte 0x19, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A528:: @ 862A528
.2byte 0x23, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A534:: @ 862A534
.2byte 0x24, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A540:: @ 862A540
.2byte 0x13F, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A54C:: @ 862A54C
.2byte 0x149, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A558:: @ 862A558
.2byte 0x150, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A564:: @ 862A564
.2byte 0x133, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A570:: @ 862A570
.2byte 0x14D, 0x22, 0x14, 0x18, 0x51, 0x3
gUnknown_0862A57C:: @ 862A57C
.4byte gUnknown_0862A48C
.4byte gUnknown_0862A498
.4byte gUnknown_0862A4A4
.4byte gUnknown_0862A4B0
.4byte gUnknown_0862A4BC
.4byte gUnknown_0862A4C8
.4byte gUnknown_0862A4D4
.4byte gUnknown_0862A4E0
.4byte gUnknown_0862A4EC
.4byte gUnknown_0862A4F8
gUnknown_0862A5A4:: @ 862A5A4
.4byte gUnknown_0862A504
.4byte gUnknown_0862A510
.4byte gUnknown_0862A51C
.4byte gUnknown_0862A528
.4byte gUnknown_0862A534
.4byte gUnknown_0862A540
.4byte gUnknown_0862A54C
.4byte gUnknown_0862A558
.4byte gUnknown_0862A564
.4byte gUnknown_0862A570
gUnknown_0862A5CC:: @ 862A5CC
.4byte gUnknown_0862A57C
.4byte gUnknown_0862A5A4

View File

@ -584,4 +584,7 @@ extern const u8 EventScript_275A86[];
extern const u8 EventScript_275ADF[];
extern const u8 EventScript_275B38[];
// trainer hill
extern const u8 EventScript_2C83F0[];
#endif // GUARD_EVENT_SCRIPTS_H

View File

@ -3,7 +3,6 @@
#include "player_pc.h"
#include "list_menu.h"
bool8 sub_81D5C18(void);
bool8 sub_81D20BC(void *arg0);
bool8 sub_81D312C(void *arg0);
void sub_81D1ED4(void *arg0);
@ -14,28 +13,21 @@ void sub_81D3464(void *arg0);
void sub_81D3480(void *arg0, u8 arg1);
void sub_81D2754(void *arg0, void *arg1);
void sub_81D1F84(void *arg0, void *arg1, void *arg2);
const u8 *sub_81D62AC(void);
u8 sub_81D1C84(u8);
u8 sub_81D1DC0(struct PlayerPCItemPageStruct *);
void sub_81D1E90(struct PlayerPCItemPageStruct *);
void sub_81D1EC0(void);
void sub_81D1D04(u8);
bool8 sub_81D1C44(u8);
void sub_81D5FB4(u16*);
bool8 sub_81D4A58(struct EventObject*);
void sub_81D2BF4(u8 *);
u16 sub_81D2C3C(void);
void sub_81D2C50(void);
u8 sub_81D28C8(const struct ListMenuItem *items, u16 numChoices);
void sub_81D2824(u16);
bool32 InTrainerHill(void);
bool8 EventObjectIsFarawayIslandMew(struct EventObject *);
u32 sub_81D427C(void);
void sub_81D4998(void);
u8 GetCurrentTrainerHillMapId(void);
u8 sub_81D6490(void);
const struct WarpEvent *sub_81D6120(void);
const struct WarpEvent *sub_81D6134(u8);
void sub_81D3640(u16 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5);
void sub_81D3784(u16 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4);

View File

@ -1235,6 +1235,9 @@ extern const u8 gText_NormalTagMatch[];
extern const u8 gText_VarietyTagMatch[];
extern const u8 gText_UniqueTagMatch[];
extern const u8 gText_ExpertTagMatch[];
extern const u8 gText_TimeBoard[];
extern const u8 gText_TimeCleared[];
extern const u8 gText_XMinYDotZSec[];
extern const u8 gText_TrainerHill1F[];
extern const u8 gText_TrainerHill2F[];
extern const u8 gText_TrainerHill3F[];

View File

@ -3,4 +3,34 @@
extern u32 *gUnknown_0203CF5C;
void CallTrainerHillFunction(void);
void ResetTrainerHillResults(void);
u8 GetTrainerHillOpponentClass(u16 trainerId);
void GetTrainerHillTrainerName(u8 *dst, u16 trainerId);
u8 GetTrainerHillTrainerFrontSpriteId(u16 trainerId);
void InitTrainerHillBattleStruct(void);
void FreeTrainerHillBattleStruct(void);
void CopyTrainerHillTrainerText(u8 which, u16 trainerId);
bool8 sub_81D5C18(void);
void nullsub_129(void);
void PrintOnTrainerHillRecordsWindow(void);
void sub_81D5DF8(void);
bool32 sub_81D5F48(void);
void sub_81D5FB4(u16 *mapArg);
bool32 InTrainerHill(void);
u8 GetCurrentTrainerHillMapId(void);
const struct WarpEvent* sub_81D6120(void);
const struct WarpEvent* sub_81D6134(u8 warpEventId);
u16 LocalIdToHillTrainerId(u8 localId);
bool8 GetHillTrainerFlag(u8 eventObjectId);
void SetHillTrainerFlag(void);
const u8 *sub_81D62AC(void);
void FillHillTrainerParty(void);
void FillHillTrainersParties(void);
u32 sub_81D63C4(void);
u8 GetTrainerEncounterMusicIdInTrainerHill(u16 trainerId);
u8 sub_81D6490(void);
void sub_81D64C0(void);
bool32 sub_81D6534(void);
#endif // GUARD_TRAINER_HILL_H

View File

@ -16,6 +16,7 @@
#include "string_util.h"
#include "strings.h"
#include "text.h"
#include "trainer_hill.h"
#include "window.h"
#include "constants/battle_string_ids.h"
#include "constants/items.h"
@ -41,10 +42,6 @@ extern u8 gUnknown_0203C7B4;
extern const u8 gTrainerClassNames[][13];
extern const u16 gUnknown_08D85620[];
extern u8 GetTrainerHillOpponentClass(u16 trainerId); // pokenav
extern void GetTrainerHillTrainerName(u8 *txtPtr, u16 trainerId); // pokenav
extern void CopyTrainerHillTrainerText(u8 arg0, u16 trainerId); // pokenav
// this file's functions
static void ChooseMoveUsedParticle(u8 *textPtr);
static void ChooseTypeOfMoveUsedString(u8 *dst);

View File

@ -29,6 +29,7 @@
#include "field_message_box.h"
#include "sound.h"
#include "strings.h"
#include "trainer_hill.h"
#include "secret_base.h"
#include "string_util.h"
#include "overworld.h"
@ -61,18 +62,9 @@ struct TrainerBattleParameter
u8 ptrType;
};
extern bool32 InTrainerHill(void);
extern void ClearPoisonStepCounter(void);
extern void sub_808BCF4(void);
extern void sub_80AF6F0(void);
extern u16 sub_81D6180(u8 localId);
extern bool8 GetTrainerHillTrainerFlag(u8 eventObjId);
extern bool8 sub_81D5C18(void);
extern void sub_81D639C(void);
extern void sub_81D6384(void);
extern void sub_81D61E8(void);
extern void sub_80982B8(void);
extern void CopyTrainerHillTrainerText(u8 a0, u16 arg1);
// this file's functions
static void DoBattlePikeWildBattle(void);
@ -1148,12 +1140,12 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
{
TrainerBattleLoadArgs(sOrdinaryBattleParams, data);
SetMapVarsToTrainer();
gTrainerBattleOpponent_A = sub_81D6180(gSpecialVar_LastTalked);
gTrainerBattleOpponent_A = LocalIdToHillTrainerId(gSpecialVar_LastTalked);
}
else
{
TrainerBattleLoadArgs(sTrainerBOrdinaryBattleParams, data);
gTrainerBattleOpponent_B = sub_81D6180(gSpecialVar_LastTalked);
gTrainerBattleOpponent_B = LocalIdToHillTrainerId(gSpecialVar_LastTalked);
}
return EventScript_TryDoNormalTrainerBattle;
default:
@ -1215,7 +1207,7 @@ bool8 GetTrainerFlag(void)
if (InBattlePyramid())
return GetBattlePyramidTrainerFlag(gSelectedEventObject);
else if (InTrainerHill())
return GetTrainerHillTrainerFlag(gSelectedEventObject);
return GetHillTrainerFlag(gSelectedEventObject);
else
return FlagGet(GetTrainerAFlag());
}
@ -1281,11 +1273,11 @@ void BattleSetup_StartTrainerBattle(void)
gBattleTypeFlags |= BATTLE_TYPE_TRAINER_HILL;
if (gNoOfApproachingTrainers == 2)
sub_81D639C();
FillHillTrainersParties();
else
sub_81D6384();
FillHillTrainerParty();
sub_81D61E8();
SetHillTrainerFlag();
}
sNoOfPossibleTrainerRetScripts = gNoOfApproachingTrainers;
@ -1367,9 +1359,9 @@ void ShowTrainerIntroSpeech(void)
else if (sub_81D5C18())
{
if (gNoOfApproachingTrainers == 0 || gNoOfApproachingTrainers == 1)
CopyTrainerHillTrainerText(2, sub_81D6180(gSpecialVar_LastTalked));
CopyTrainerHillTrainerText(2, LocalIdToHillTrainerId(gSpecialVar_LastTalked));
else
CopyTrainerHillTrainerText(2, sub_81D6180(gEventObjects[gApproachingTrainers[gApproachingTrainerId].eventObjectId].localId));
CopyTrainerHillTrainerText(2, LocalIdToHillTrainerId(gEventObjects[gApproachingTrainers[gApproachingTrainerId].eventObjectId].localId));
sub_80982B8();
}

View File

@ -3,21 +3,19 @@
#include "battle_controllers.h"
#include "alloc.h"
#include "pokemon.h"
#include "trainer_hill.h"
#include "party_menu.h"
#include "event_data.h"
#include "constants/abilities.h"
#include "random.h"
#include "battle_scripts.h"
extern void sub_81D55D0(void);
extern void sub_81D5694(void);
void AllocateBattleResources(void)
{
gBattleResources = gBattleResources; // something dumb needed to match
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL)
sub_81D55D0();
InitTrainerHillBattleStruct();
gBattleStruct = AllocZeroed(sizeof(*gBattleStruct));
@ -47,7 +45,7 @@ void AllocateBattleResources(void)
void FreeBattleResources(void)
{
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL)
sub_81D5694();
FreeTrainerHillBattleStruct();
if (gBattleResources != NULL)
{

View File

@ -25,6 +25,7 @@
#include "sound.h"
#include "start_menu.h"
#include "trainer_see.h"
#include "trainer_hill.h"
#include "wild_encounter.h"
#include "constants/bg_event_constants.h"
#include "constants/event_objects.h"

View File

@ -13,6 +13,7 @@
#include "string_util.h"
#include "strings.h"
#include "task.h"
#include "trainer_hill.h"
#include "constants/species.h"
static bool32 IsMonValidSpecies(struct Pokemon *pokemon)

View File

@ -11,6 +11,7 @@
#include "pokenav.h"
#include "script.h"
#include "secret_base.h"
#include "trainer_hill.h"
#include "tv.h"
#include "constants/rgb.h"

View File

@ -17,6 +17,7 @@
#include "easy_chat.h"
#include "event_data.h"
#include "money.h"
#include "trainer_hill.h"
#include "tv.h"
#include "coins.h"
#include "text.h"
@ -49,7 +50,6 @@ extern void copy_strings_to_sav1(void);
extern void InitMatchCallCounters(void);
extern void sub_801AFD8(void);
extern void sub_800E5AC(void);
extern void sub_81D54BC(void);
extern void ResetContestLinkResults(void);
extern void ResetPokeJumpResults(void);
extern void SetBerryPowder(u32* powder, u32 newValue);
@ -212,7 +212,7 @@ void NewGameInitData(void)
InitMatchCallCounters();
sub_801AFD8();
sub_800E5AC();
sub_81D54BC();
ResetTrainerHillResults();
ResetContestLinkResults();
}

View File

@ -19,7 +19,6 @@
#include "field_tasks.h"
#include "field_weather.h"
#include "fieldmap.h"
// #include "fldeff_flash.h"
#include "gpu_regs.h"
#include "heal_location.h"
#include "link.h"
@ -50,6 +49,7 @@
#include "task.h"
// #include "tileset_anim.h"
#include "time_events.h"
#include "trainer_hill.h"
#include "tv.h"
#include "scanline_effect.h"
#include "wild_encounter.h"
@ -106,7 +106,6 @@ extern void apply_map_tileset2_palette(const struct MapLayout *);
extern void copy_map_tileset2_to_vram_2(const struct MapLayout *);
extern void RestartWildEncounterImmunitySteps(void);
extern void ShowMapNamePopup(void);
extern bool32 InTrainerHill(void);
extern bool32 sub_808651C(void);
extern bool8 sub_80AF6A4(void);
extern bool8 sub_80E909C(void);
@ -129,14 +128,11 @@ extern void WriteFlashScanlineEffectBuffer(u8);
extern void sub_81AA2F8(void);
extern void InitMatchCallCounters(void);
extern void sub_80EDB44(void);
extern void sub_81D64C0(void);
extern void InitFieldMessageBox(void);
extern void copy_map_tileset1_to_vram(const struct MapLayout *);
extern void copy_map_tileset2_to_vram(const struct MapLayout *);
extern void FieldUpdateBgTilemapScroll(void);
extern void TransferTilesetAnimsBuffer(void);
extern bool32 sub_81D5F48(void);
extern u8 GetCurrentTrainerHillMapId(void);
extern bool8 warp0_in_pokecenter(void);
extern void ResetAllPicSprites(void);
extern void FieldEffectActiveListClear(void);

View File

@ -22,7 +22,6 @@
#include "pokemon_animation.h"
#include "pokemon_summary_screen.h"
#include "pokemon_storage_system.h"
#include "pokenav.h"
#include "random.h"
#include "recorded_battle.h"
#include "rtc.h"
@ -31,6 +30,7 @@
#include "strings.h"
#include "task.h"
#include "text.h"
#include "trainer_hill.h"
#include "util.h"
#include "constants/abilities.h"
#include "constants/battle_frontier.h"
@ -74,7 +74,6 @@ extern const u8 gTrainerClassNames[][13];
extern u16 get_unknown_box_id(void);
extern void set_unknown_box_id(u8);
extern bool8 sub_806F104(void);
extern u8 sub_81D63C8(u16 trainerOpponentId);
// this file's functions
static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon);
@ -6083,7 +6082,7 @@ u8 GetTrainerEncounterMusicId(u16 trainerOpponentId)
if (InBattlePyramid())
return GetTrainerEncounterMusicIdInBattlePyramind(trainerOpponentId);
else if (sub_81D5C18())
return sub_81D63C8(trainerOpponentId);
return GetTrainerEncounterMusicIdInTrainerHill(trainerOpponentId);
else
return TRAINER_ENCOUNTER_MUSIC(trainerOpponentId);
}

View File

@ -4,6 +4,7 @@
#include "battle_tower.h"
#include "battle_setup.h"
#include "event_data.h"
#include "event_scripts.h"
#include "fieldmap.h"
#include "field_message_box.h"
#include "international_string_util.h"
@ -22,7 +23,11 @@
#include "util.h"
#include "constants/event_object_movement_constants.h"
#include "constants/event_objects.h"
#include "constants/items.h"
#include "constants/maps.h"
#include "constants/trainers.h"
extern bool32 sub_81D3B34(void);
#define HILL_TAG_NORMAL 0
#define HILL_TAG_VARIETY 1
@ -69,6 +74,8 @@ struct TrHillTag
u8 unkField_2;
u8 unused3;
u8 unused4;
u8 unused5;
u8 unused6;
struct TrHillFloor floors[4];
};
@ -84,55 +91,155 @@ static EWRAM_DATA struct TrHillRoomTrainers *sRoomTrainers = NULL;
EWRAM_DATA u32 *gUnknown_0203CF5C = NULL;
// This file's functions.
void sub_81D581C(void);
void sub_81D58D8(void);
void sub_81D5924(void);
void sub_81D59D0(void);
void sub_81D5A70(void);
void sub_81D5AB4(void);
void sub_81D5AD0(void);
void sub_81D5B2C(void);
void sub_81D5BBC(void);
void sub_81D5C00(void);
void sub_81D5C5C(void);
void sub_81D62B4(void);
void sub_81D64AC(void);
void sub_81D64DC(void);
void sub_81D64FC(void);
void sub_81D6518(void);
void sub_81D6568(void);
void sub_81D65A0(void);
void SetUpDataStruct(void);
void FreeDataStruct(void);
bool32 sub_81D5F48(void);
void nullsub_2(void);
void SetTimerValue(u32 *dst, u32 val);
bool32 sub_81D3B34(void);
u16 sub_81D6640(void);
u32 GetTimerValue(u32 *src);
u8 GetCurrentTrainerHillMapId(void);
u8 sub_81D6490(void);
void sub_81D642C(struct Pokemon *mon, u8 level);
bool32 sub_81D6534(void);
static void sub_81D581C(void);
static void sub_81D58D8(void);
static void sub_81D5924(void);
static void sub_81D59D0(void);
static void sub_81D5A70(void);
static void sub_81D5AB4(void);
static void sub_81D5AD0(void);
static void sub_81D5B2C(void);
static void sub_81D5BBC(void);
static void sub_81D5C00(void);
static void sub_81D5C5C(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 sub_81D65A0(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);
// const data
extern const u8 gText_TimeBoard[];
extern const u8 gText_TimeCleared[];
extern const u8 gText_XMinYDotZSec[];
// I will decompile these soon, no worries :)
extern const struct TrHillTag gUnknown_08626814;
extern const struct TrHillTag gUnknown_086276FC;
extern const struct TrHillTag gUnknown_086285E4;
extern const struct TrHillTag gUnknown_086294CC;
extern const u16 *const *const gUnknown_0862A5CC[];
struct
{
u8 trainerClass;
u8 musicId;
} extern const gUnknown_0862A3B4[0x36];
} static const gUnknown_0862A3B4[] =
{
{TRAINER_CLASS_TEAM_AQUA, TRAINER_ENCOUNTER_MUSIC_AQUA},
{TRAINER_CLASS_AQUA_ADMIN, TRAINER_ENCOUNTER_MUSIC_AQUA},
{TRAINER_CLASS_AQUA_LEADER, TRAINER_ENCOUNTER_MUSIC_AQUA},
{TRAINER_CLASS_AROMA_LADY, TRAINER_ENCOUNTER_MUSIC_FEMALE},
{TRAINER_CLASS_BATTLE_GIRL, TRAINER_ENCOUNTER_MUSIC_INTENSE},
{TRAINER_CLASS_SWIMMER_F, TRAINER_ENCOUNTER_MUSIC_FEMALE},
{TRAINER_CLASS_POKEFAN, TRAINER_ENCOUNTER_MUSIC_TWINS},
{TRAINER_CLASS_DRAGON_TAMER, TRAINER_ENCOUNTER_MUSIC_INTENSE},
{TRAINER_CLASS_COOLTRAINER, TRAINER_ENCOUNTER_MUSIC_COOL},
{TRAINER_CLASS_GUITARIST, TRAINER_ENCOUNTER_MUSIC_INTENSE},
{TRAINER_CLASS_SAILOR, TRAINER_ENCOUNTER_MUSIC_MALE},
{TRAINER_CLASS_TWINS, TRAINER_ENCOUNTER_MUSIC_TWINS},
{TRAINER_CLASS_INTERVIEWER, TRAINER_ENCOUNTER_MUSIC_INTERVIEWER},
{TRAINER_CLASS_RUIN_MANIAC, TRAINER_ENCOUNTER_MUSIC_HIKER},
{TRAINER_CLASS_GENTLEMAN, TRAINER_ENCOUNTER_MUSIC_RICH},
{TRAINER_CLASS_SWIMMER_M, TRAINER_ENCOUNTER_MUSIC_FEMALE},
{TRAINER_CLASS_POKEMANIAC, TRAINER_ENCOUNTER_MUSIC_SUSPICIOUS},
{TRAINER_CLASS_BLACK_BELT, TRAINER_ENCOUNTER_MUSIC_INTENSE},
{TRAINER_CLASS_OLD_COUPLE, TRAINER_ENCOUNTER_MUSIC_INTENSE},
{TRAINER_CLASS_BUG_MANIAC, TRAINER_ENCOUNTER_MUSIC_SUSPICIOUS},
{TRAINER_CLASS_CAMPER, TRAINER_ENCOUNTER_MUSIC_MALE},
{TRAINER_CLASS_KINDLER, TRAINER_ENCOUNTER_MUSIC_HIKER},
{TRAINER_CLASS_TEAM_MAGMA, TRAINER_ENCOUNTER_MUSIC_MAGMA},
{TRAINER_CLASS_MAGMA_ADMIN, TRAINER_ENCOUNTER_MUSIC_MAGMA},
{TRAINER_CLASS_MAGMA_LEADER, TRAINER_ENCOUNTER_MUSIC_MAGMA},
{TRAINER_CLASS_LASS, TRAINER_ENCOUNTER_MUSIC_FEMALE},
{TRAINER_CLASS_BUG_CATCHER, TRAINER_ENCOUNTER_MUSIC_MALE},
{TRAINER_CLASS_NINJA_BOY, TRAINER_ENCOUNTER_MUSIC_SUSPICIOUS},
{TRAINER_CLASS_RICH_BOY, TRAINER_ENCOUNTER_MUSIC_RICH},
{TRAINER_CLASS_HEX_MANIAC, TRAINER_ENCOUNTER_MUSIC_SUSPICIOUS},
{TRAINER_CLASS_BEAUTY, TRAINER_ENCOUNTER_MUSIC_FEMALE},
{TRAINER_CLASS_LADY, TRAINER_ENCOUNTER_MUSIC_FEMALE},
{TRAINER_CLASS_PARASOL_LADY, TRAINER_ENCOUNTER_MUSIC_FEMALE},
{TRAINER_CLASS_PICNICKER, TRAINER_ENCOUNTER_MUSIC_GIRL},
{TRAINER_CLASS_PKMN_BREEDER, TRAINER_ENCOUNTER_MUSIC_FEMALE},
{TRAINER_CLASS_COLLECTOR, TRAINER_ENCOUNTER_MUSIC_SUSPICIOUS},
{TRAINER_CLASS_PKMN_RANGER, TRAINER_ENCOUNTER_MUSIC_COOL},
{TRAINER_CLASS_PKMN_TRAINER_3, TRAINER_ENCOUNTER_MUSIC_MALE},
{TRAINER_CLASS_YOUNG_COUPLE, TRAINER_ENCOUNTER_MUSIC_GIRL},
{TRAINER_CLASS_PSYCHIC, TRAINER_ENCOUNTER_MUSIC_INTENSE},
{TRAINER_CLASS_SR_AND_JR, TRAINER_ENCOUNTER_MUSIC_TWINS},
{TRAINER_CLASS_ELITE_FOUR, TRAINER_ENCOUNTER_MUSIC_FEMALE},
{TRAINER_CLASS_YOUNGSTER, TRAINER_ENCOUNTER_MUSIC_MALE},
{TRAINER_CLASS_EXPERT, TRAINER_ENCOUNTER_MUSIC_INTENSE},
{TRAINER_CLASS_TRIATHLETE, TRAINER_ENCOUNTER_MUSIC_MALE},
{TRAINER_CLASS_BIRD_KEEPER, TRAINER_ENCOUNTER_MUSIC_COOL},
{TRAINER_CLASS_FISHERMAN, TRAINER_ENCOUNTER_MUSIC_HIKER},
{TRAINER_CLASS_CHAMPION, TRAINER_ENCOUNTER_MUSIC_MALE},
{TRAINER_CLASS_TUBER_M, TRAINER_ENCOUNTER_MUSIC_MALE},
{TRAINER_CLASS_TUBER_F, TRAINER_ENCOUNTER_MUSIC_GIRL},
{TRAINER_CLASS_SIS_AND_BRO, TRAINER_ENCOUNTER_MUSIC_SWIMMER},
{TRAINER_CLASS_HIKER, TRAINER_ENCOUNTER_MUSIC_HIKER},
{TRAINER_CLASS_LEADER, TRAINER_ENCOUNTER_MUSIC_FEMALE},
{TRAINER_CLASS_SCHOOL_KID, TRAINER_ENCOUNTER_MUSIC_MALE},
};
extern const u8 EventScript_2C83F0[];
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 *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 *const gUnknown_0862A5CC[] =
{
gUnknown_0862A57C,
gUnknown_0862A5A4
};
static const u16 gUnknown_0862A5D4[] = INCBIN_U16("graphics/pokenav/862A5D4.gbapal");
static const u8 sRecordWinColors[] = {0, 2, 3};
@ -197,6 +304,7 @@ static const struct EventObjectTemplate gUnknown_0862A670 =
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}};
// code
void CallTrainerHillFunction(void)
{
SetUpDataStruct();
@ -204,7 +312,7 @@ void CallTrainerHillFunction(void)
FreeDataStruct();
}
void sub_81D54BC(void)
void ResetTrainerHillResults(void)
{
s32 i;
@ -215,7 +323,7 @@ void sub_81D54BC(void)
SetTimerValue(&gSaveBlock1Ptr->trainerHillTimes[i], HILL_MAX_TIME);
}
u8 GetFloorId(void)
static u8 GetFloorId(void)
{
return gMapHeader.mapLayoutId - 159;
}
@ -248,7 +356,7 @@ u8 GetTrainerHillTrainerFrontSpriteId(u16 trainerId)
return gFacilityClassToPicIndex[facilityClass];
}
void sub_81D55D0(void)
void InitTrainerHillBattleStruct(void)
{
s32 i, j;
@ -267,13 +375,13 @@ void sub_81D55D0(void)
FreeDataStruct();
}
void sub_81D5694(void)
void FreeTrainerHillBattleStruct(void)
{
if (sRoomTrainers != NULL)
FREE_AND_SET_NULL(sRoomTrainers);
}
void SetUpDataStruct(void)
static void SetUpDataStruct(void)
{
if (sHillData == NULL)
{
@ -284,7 +392,7 @@ void SetUpDataStruct(void)
}
}
void FreeDataStruct(void)
static void FreeDataStruct(void)
{
if (sHillData != NULL)
FREE_AND_SET_NULL(sHillData);
@ -317,7 +425,7 @@ void CopyTrainerHillTrainerText(u8 which, u16 trainerId)
FreeDataStruct();
}
void sub_81D581C(void)
static void sub_81D581C(void)
{
nullsub_2();
if (!sub_81D3B34())
@ -336,7 +444,7 @@ void sub_81D581C(void)
gSaveBlock1Ptr->trainerHill.field_3D6E_0a = 0;
}
void sub_81D58D8(void)
static void sub_81D58D8(void)
{
sub_80008E8();
gSpecialVar_Result = 0;
@ -348,7 +456,7 @@ void sub_81D58D8(void)
gSaveBlock1Ptr->trainerHill.field_3D6E_0c = 1;
}
void sub_81D5924(void)
static void sub_81D5924(void)
{
u16 itemId = sub_81D6640();
@ -369,7 +477,7 @@ void sub_81D5924(void)
}
}
void sub_81D59D0(void)
static void sub_81D59D0(void)
{
if (gSaveBlock1Ptr->trainerHill.field_3D6E_0b)
{
@ -389,7 +497,7 @@ void sub_81D59D0(void)
gSaveBlock1Ptr->trainerHill.field_3D6E_0b = 1;
}
void sub_81D5A70(void)
static void sub_81D5A70(void)
{
if (!gSaveBlock1Ptr->trainerHill.field_3D6E_0c)
{
@ -400,12 +508,12 @@ void sub_81D5A70(void)
}
}
void sub_81D5AB4(void)
static void sub_81D5AB4(void)
{
gSaveBlock1Ptr->trainerHill.field_3D6E_0d = 1;
}
void sub_81D5AD0(void)
static void sub_81D5AD0(void)
{
if (gSaveBlock1Ptr->trainerHill.field_3D6E_0d)
{
@ -423,7 +531,7 @@ void sub_81D5AD0(void)
}
}
void sub_81D5B2C(void)
static void sub_81D5B2C(void)
{
s32 total, minutes, secondsWhole, secondsFraction;
@ -442,7 +550,7 @@ void sub_81D5B2C(void)
ConvertIntToDecimalStringN(gStringVar3, secondsFraction, STR_CONV_MODE_LEADING_ZEROS, 2);
}
void sub_81D5BBC(void)
static void sub_81D5BBC(void)
{
SetUpDataStruct();
if (sHillData->tag.unkField_2 != 4)
@ -458,7 +566,7 @@ void sub_81D5BBC(void)
FreeDataStruct();
}
void sub_81D5C00(void)
static void sub_81D5C00(void)
{
SetUpDataStruct();
gSpecialVar_Result = 0;
@ -477,7 +585,7 @@ bool8 sub_81D5C18(void)
return FALSE;
}
void sub_81D5C5C(void)
static void sub_81D5C5C(void)
{
if (!sub_81D5C18())
gSpecialVar_Result = 0;
@ -490,7 +598,7 @@ void nullsub_129(void)
}
void nullsub_2(void)
static void nullsub_2(void)
{
}
@ -532,12 +640,12 @@ void PrintOnTrainerHillRecordsWindow(void)
// Leftover from Fire Red / Leaf Green as in these games,
// the timer had to be xored by the encryption key in Sav2.
u32 GetTimerValue(u32 *src)
static u32 GetTimerValue(u32 *src)
{
return *src;
}
void SetTimerValue(u32 *dst, u32 val)
static void SetTimerValue(u32 *dst, u32 val)
{
*dst = val;
}
@ -584,7 +692,7 @@ bool32 sub_81D5F48(void)
// Functionally equivalent.
#ifdef NONMATCHING
u32 sub_81D5F58(u8 floorId, u32 bit, u32 arg2, u32 arg3)
static u32 sub_81D5F58(u8 floorId, u32 bit, u32 arg2, u32 arg3)
{
u32 var0, var1, var2, var3;
@ -597,7 +705,7 @@ u32 sub_81D5F58(u8 floorId, u32 bit, u32 arg2, u32 arg3)
}
#else
NAKED
u32 sub_81D5F58(u8 floorId, u32 bit, u32 arg2, u32 arg3)
static u32 sub_81D5F58(u8 floorId, u32 bit, u32 arg2, u32 arg3)
{
asm_unified("\n\
push {r4,r5,lr}\n\
@ -729,7 +837,7 @@ u8 GetCurrentTrainerHillMapId(void)
return ret;
}
bool32 sub_81D6100(void)
static bool32 sub_81D6100(void)
{
bool32 ret;
@ -764,12 +872,12 @@ const struct WarpEvent* sub_81D6134(u8 warpEventId)
return &header->events->warps[0];
}
u16 sub_81D6180(u8 localId)
u16 LocalIdToHillTrainerId(u8 localId)
{
return gSaveBlock2Ptr->frontier.field_CB4[localId - 1];
}
bool8 GetTrainerHillTrainerFlag(u8 eventObjectId)
bool8 GetHillTrainerFlag(u8 eventObjectId)
{
u32 floorId = GetFloorId() * 2;
u8 bitId = gEventObjects[eventObjectId].localId - 1 + floorId;
@ -777,7 +885,7 @@ bool8 GetTrainerHillTrainerFlag(u8 eventObjectId)
return gSaveBlock2Ptr->frontier.field_EE0 & gBitTable[bitId];
}
void sub_81D61E8(void)
void SetHillTrainerFlag(void)
{
u8 i;
u8 floorId = GetFloorId() * 2;
@ -809,13 +917,13 @@ const u8 *sub_81D62AC(void)
return EventScript_2C83F0;
}
void sub_81D62B4(void)
static void sub_81D62B4(void)
{
CopyTrainerHillTrainerText(5, gSpecialVar_LastTalked);
sub_80982B8();
}
void sub_81D62CC(u16 trainerId, u8 firstMonId)
static void sub_81D62CC(u16 trainerId, u8 firstMonId)
{
u8 trId, level;
s32 i, floorId, arrId;
@ -839,13 +947,13 @@ void sub_81D62CC(u16 trainerId, u8 firstMonId)
FreeDataStruct();
}
void sub_81D6384(void)
void FillHillTrainerParty(void)
{
ZeroEnemyPartyMons();
sub_81D62CC(gTrainerBattleOpponent_A, 0);
}
void sub_81D639C(void)
void FillHillTrainersParties(void)
{
ZeroEnemyPartyMons();
sub_81D62CC(gTrainerBattleOpponent_A, 0);
@ -860,7 +968,7 @@ u32 sub_81D63C4(void)
return 7;
}
u8 sub_81D63C8(u16 trainerId)
u8 GetTrainerEncounterMusicIdInTrainerHill(u16 trainerId)
{
s32 i;
u8 trId, facilityClass;
@ -879,7 +987,7 @@ u8 sub_81D63C8(u16 trainerId)
return 0;
}
void sub_81D642C(struct Pokemon *mon, u8 level)
static void sub_81D642C(struct Pokemon *mon, u8 level)
{
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
u32 exp = gExperienceTables[gBaseStats[species].growthRate][level];
@ -900,7 +1008,7 @@ u8 sub_81D6490(void)
return ret;
}
void sub_81D64AC(void)
static void sub_81D64AC(void)
{
gSaveBlock2Ptr->frontier.field_EE0 = 0xFF;
}
@ -911,17 +1019,17 @@ void sub_81D64C0(void)
LoadPalette(gUnknown_0862A5D4, 0x70, 0x20);
}
void sub_81D64DC(void)
static void sub_81D64DC(void)
{
gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_EF9_1;
}
void sub_81D64FC(void)
static void sub_81D64FC(void)
{
gSaveBlock2Ptr->frontier.field_EF9_1 = 1;
}
void sub_81D6518(void)
static void sub_81D6518(void)
{
gSaveBlock2Ptr->frontier.field_EF9_1 = 0;
}
@ -938,7 +1046,7 @@ bool32 sub_81D6534(void)
return TRUE;
}
void sub_81D6568(void)
static void sub_81D6568(void)
{
if (gSaveBlock1Ptr->trainerHill.field_3D6E_0d)
gSpecialVar_Result = 0;
@ -946,13 +1054,13 @@ void sub_81D6568(void)
gSpecialVar_Result = 1;
}
void sub_81D65A0(void)
static void sub_81D65A0(void)
{
gSaveBlock1Ptr->trainerHill.tag = gSpecialVar_0x8005;
gSaveBlock1Ptr->trainerHill.field_3D68 = gSaveBlock1Ptr->trainerHillTimes[gSpecialVar_0x8005];
}
u8 sub_81D65E8(u8 arg0)
static u8 sub_81D65E8(u8 arg0)
{
u8 var, i, modBy;
@ -972,7 +1080,7 @@ u8 sub_81D65E8(u8 arg0)
return var;
}
u16 sub_81D6640(void)
static u16 sub_81D6640(void)
{
u8 i;
const u16 *ptr;

View File

@ -6,18 +6,16 @@
#include "field_effect.h"
#include "field_player_avatar.h"
#include "pokemon.h"
#include "pokenav.h"
#include "script.h"
#include "script_movement.h"
#include "sprite.h"
#include "task.h"
#include "trainer_see.h"
#include "trainer_hill.h"
#include "util.h"
#include "battle_pyramid.h"
#include "constants/field_effects.h"
extern bool32 InTrainerHill(void);
extern bool8 GetTrainerHillTrainerFlag(u8 eventObjectId);
extern void sub_809BE48(u16 npcId);
// this file's functions
@ -240,7 +238,7 @@ static u8 CheckTrainer(u8 eventObjectId)
}
else if (InTrainerHill() == TRUE)
{
if (GetTrainerHillTrainerFlag(eventObjectId))
if (GetHillTrainerFlag(eventObjectId))
return 0;
}
else