summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGriffinR <griffin.richards@comcast.net>2019-11-13 16:31:01 -0500
committerhuderlem <huderlem@gmail.com>2019-11-16 13:02:35 -0600
commit3bbdee61b823d7a6c54792062b7fd27e8c574f00 (patch)
tree1c97f296a9b7abe635c495274142a9b497699760 /src
parent5e01871f8b00d6b0ef4921a35e0b2bf18c7b4183 (diff)
Clean up Trainer Hill doc
Diffstat (limited to 'src')
-rw-r--r--src/data/battle_frontier/trainer_hill.h26
-rwxr-xr-xsrc/ereader_helpers.c2
-rw-r--r--src/trainer_hill.c13
3 files changed, 21 insertions, 20 deletions
diff --git a/src/data/battle_frontier/trainer_hill.h b/src/data/battle_frontier/trainer_hill.h
index fe98477b9..f38cfcc38 100644
--- a/src/data/battle_frontier/trainer_hill.h
+++ b/src/data/battle_frontier/trainer_hill.h
@@ -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
};
diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c
index 229c214ad..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->trainerType = ttdata->count;
+ buffer2->numTrainers = ttdata->count;
buffer2->unused1 = sub_81D38D4();
buffer2->numFloors = (ttdata->count + 1) / 2;
diff --git a/src/trainer_hill.c b/src/trainer_hill.c
index 40b5750f4..b3463b0b0 100644
--- a/src/trainer_hill.c
+++ b/src/trainer_hill.c
@@ -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);