Clean up Trainer Hill doc

This commit is contained in:
GriffinR 2019-11-13 16:31:01 -05:00 committed by huderlem
parent 5e01871f8b
commit 3bbdee61b8
6 changed files with 28 additions and 25 deletions

View File

@ -220,7 +220,8 @@ TrainerHill_Entrance_Movement_PushPlayerBackFromCounter: @ 8268381
walk_down
step_end
TrainerHill_Entrance_Movement_268383: @ 8268383
@ Unused
TrainerHill_Entrance_Movement_FaceUp: @ 8268383
face_up
step_end

View File

@ -8,7 +8,8 @@
#define TRAINER_HILL_ROOF 5
#define TRAINER_HILL_ENTRANCE 6
#define NUM_TRAINER_HILL_FLOORS 4
#define NUM_TRAINER_HILL_FLOORS 4
#define NUM_TRAINER_HILL_FLOORS_JP 2
#define NUM_TRAINER_HILL_PRIZE_LISTS 10
@ -36,8 +37,8 @@
#define TRAINER_HILL_TEXT_PLAYER_WON 4
#define TRAINER_HILL_TEXT_AFTER 5
#define HILL_TRAINER_TYPE_EREADER 4
#define HILL_TRAINER_TYPE_NPC 8
#define NUM_TRAINER_HILL_TRAINERS (NUM_TRAINER_HILL_FLOORS * 2)
#define NUM_TRAINER_HILL_TRAINERS_JP (NUM_TRAINER_HILL_FLOORS_JP * 2)
// Values returned by TrainerHillGetChallengeStatus
#define TRAINER_HILL_PLAYER_STATUS_LOST 0

View File

@ -40,7 +40,7 @@ struct TrHillFloor
struct TrHillTag
{
u8 trainerType;
u8 numTrainers;
u8 unused1;
u8 numFloors;
u32 checksum;

View File

@ -1,14 +1,14 @@
#define TRAINER_HILL_OTID 0x10000000
static const struct TrHillTag sDataTagEReader = {
.trainerType = HILL_TRAINER_TYPE_EREADER,
static const struct TrHillTag sDataTagJPDefault = {
.numTrainers = NUM_TRAINER_HILL_TRAINERS_JP,
.unused1 = 1,
.numFloors = 2,
.numFloors = NUM_TRAINER_HILL_FLOORS_JP,
.checksum = 0x0
};
// In the JP Version of Trainer Hill, if there was an odd number of E-Reader trainers then one would be paired with an NPC
static const struct TrHillFloor sDataTagEReader_Floors[] = {
static const struct TrHillFloor sDataTagJPDefault_Floors[] = {
[0] = {
.trainerNum1 = 0,
.trainerNum2 = 0,
@ -383,9 +383,9 @@ static const struct TrHillFloor sDataTagEReader_Floors[] = {
static const struct TrHillTag sDataTagNormal =
{
.trainerType = HILL_TRAINER_TYPE_NPC,
.numTrainers = NUM_TRAINER_HILL_TRAINERS,
.unused1 = 2,
.numFloors = 4,
.numFloors = NUM_TRAINER_HILL_FLOORS,
.checksum = 0x00051E05
};
@ -1603,9 +1603,9 @@ static const struct TrHillFloor sDataTagNormal_Floors[] =
static const struct TrHillTag sDataTagVariety =
{
.trainerType = HILL_TRAINER_TYPE_NPC,
.numTrainers = NUM_TRAINER_HILL_TRAINERS,
.unused1 = 1,
.numFloors = 4,
.numFloors = NUM_TRAINER_HILL_FLOORS,
.checksum = 0x00054C15
};
@ -2829,9 +2829,9 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = {
static const struct TrHillTag sDataTagUnique =
{
.trainerType = HILL_TRAINER_TYPE_NPC,
.numTrainers = NUM_TRAINER_HILL_TRAINERS,
.unused1 = 3,
.numFloors = 4,
.numFloors = NUM_TRAINER_HILL_FLOORS,
.checksum = 0x000652F3
};
@ -4040,9 +4040,9 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = {
static const struct TrHillTag sDataTagExpert =
{
.trainerType = HILL_TRAINER_TYPE_NPC,
.numTrainers = NUM_TRAINER_HILL_TRAINERS,
.unused1 = 1,
.numFloors = 4,
.numFloors = NUM_TRAINER_HILL_FLOORS,
.checksum = 0x00061F3F
};

View File

@ -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->trainerType = ttdata->count;
buffer2->numTrainers = ttdata->count;
buffer2->unused1 = sub_81D38D4();
buffer2->numFloors = (ttdata->count + 1) / 2;

View File

@ -286,7 +286,7 @@ void ResetTrainerHillResults(void)
{
s32 i;
gSaveBlock2Ptr->frontier.savedGame = FALSE;
gSaveBlock2Ptr->frontier.savedGame = 0;
gSaveBlock2Ptr->frontier.neverRead = 0;
gSaveBlock1Ptr->trainerHill.bestTime = 0;
for (i = 0; i < 4; i++)
@ -528,6 +528,7 @@ static void BufferChallengeTime(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();
@ -838,7 +839,7 @@ const struct WarpEvent* SetWarpDestinationTrainerHill4F(void)
}
// For warping from the roof in challenges where the 4F is not the final challenge floor
// This would only occur in an E-Reader challenge, which is exclusive to JP Emerald
// This would only occur in the JP-exclusive Default and E-Reader challenges
const struct WarpEvent* SetWarpDestinationTrainerHillFinalFloor(u8 warpEventId)
{
u8 numFloors;
@ -1045,7 +1046,7 @@ static void TrainerHillSetTag(void)
gSaveBlock1Ptr->trainerHill.bestTime = gSaveBlock1Ptr->trainerHillTimes[gSpecialVar_0x8005];
}
static u8 GetPrizeListId(bool8 npcChallenge)
static u8 GetPrizeListId(bool8 maxTrainers)
{
u8 prizeListId, i, modBy;
@ -1056,8 +1057,8 @@ static u8 GetPrizeListId(bool8 npcChallenge)
prizeListId ^= sHillData->floors[i].trainerNum2 & 0x1F;
}
// Not possible to win TMs from E-Reader challenges
if (npcChallenge)
// Not possible to win TMs with fewer than 8 trainers
if (maxTrainers)
modBy = NUM_TRAINER_HILL_PRIZE_LISTS;
else
modBy = NUM_TRAINER_HILL_PRIZE_LISTS / 2;
@ -1080,7 +1081,7 @@ static u16 GetPrizeItemId(void)
prizeListSetId = var / 256;
prizeListSetId %= 2;
if (FlagGet(FLAG_SYS_GAME_CLEAR) && sHillData->tag.trainerType == HILL_TRAINER_TYPE_NPC)
if (FlagGet(FLAG_SYS_GAME_CLEAR) && sHillData->tag.numTrainers == NUM_TRAINER_HILL_TRAINERS)
i = GetPrizeListId(TRUE);
else
i = GetPrizeListId(FALSE);