Document Trainer Hill
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
#define TRAINER_HILL_OTID 0x10000000
|
||||
|
||||
static const struct TrHillTag gUnknown_0862609C = {
|
||||
.unkField_0 = 4,
|
||||
static const struct TrHillTag sDataTagEReader = {
|
||||
.trainerType = HILL_TRAINER_TYPE_EREADER,
|
||||
.unused1 = 1,
|
||||
.numFloors = 2,
|
||||
.checksum = 0x0
|
||||
};
|
||||
|
||||
static const struct TrHillFloor gUnknown_0862609C_floors[] = {
|
||||
// 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[] = {
|
||||
[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,
|
||||
.trainerType = HILL_TRAINER_TYPE_NPC,
|
||||
.unused1 = 2,
|
||||
.numFloors = 4,
|
||||
.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,
|
||||
.trainerType = HILL_TRAINER_TYPE_NPC,
|
||||
.unused1 = 1,
|
||||
.numFloors = 4,
|
||||
.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,
|
||||
.trainerType = HILL_TRAINER_TYPE_NPC,
|
||||
.unused1 = 3,
|
||||
.numFloors = 4,
|
||||
.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,
|
||||
.trainerType = HILL_TRAINER_TYPE_NPC,
|
||||
.unused1 = 1,
|
||||
.numFloors = 4,
|
||||
.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] =
|
||||
|
||||
@@ -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->trainerType = 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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 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 *const gUnknown_0862A57C[] =
|
||||
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] =
|
||||
{
|
||||
gUnknown_0862A48C,
|
||||
gUnknown_0862A498,
|
||||
gUnknown_0862A4A4,
|
||||
gUnknown_0862A4B0,
|
||||
gUnknown_0862A4BC,
|
||||
gUnknown_0862A4C8,
|
||||
gUnknown_0862A4D4,
|
||||
gUnknown_0862A4E0,
|
||||
gUnknown_0862A4EC,
|
||||
gUnknown_0862A4F8
|
||||
sPrizeListRareCandy1,
|
||||
sPrizeListLuxuryBall1,
|
||||
sPrizeListMaxRevive1,
|
||||
sPrizeListMaxEther1,
|
||||
sPrizeListElixir1,
|
||||
sPrizeListRoar,
|
||||
sPrizeListSludgeBomb,
|
||||
sPrizeListToxic,
|
||||
sPrizeListSunnyDay,
|
||||
sPrizeListEarthQuake
|
||||
};
|
||||
|
||||
static const u16 *const gUnknown_0862A5A4[] =
|
||||
static const u16 *const sPrizeLists2[NUM_TRAINER_HILL_PRIZE_LISTS] =
|
||||
{
|
||||
gUnknown_0862A504,
|
||||
gUnknown_0862A510,
|
||||
gUnknown_0862A51C,
|
||||
gUnknown_0862A528,
|
||||
gUnknown_0862A534,
|
||||
gUnknown_0862A540,
|
||||
gUnknown_0862A54C,
|
||||
gUnknown_0862A558,
|
||||
gUnknown_0862A564,
|
||||
gUnknown_0862A570
|
||||
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 = FALSE;
|
||||
gSaveBlock2Ptr->frontier.neverRead = 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.neverRead = 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.neverRead = 0;
|
||||
gSpecialVar_Result = 0;
|
||||
}
|
||||
else
|
||||
@@ -435,9 +447,12 @@ static void sub_81D5924(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81D59D0(void)
|
||||
// Either the bestTime and Timer field names are incorrect or something weird is going on
|
||||
// Because when gSpecialVar_Result == 0 after this call the player is complimented on their fast time
|
||||
// And when gSpecialVar_Result == 1 theyre told that they werent very quick
|
||||
static void CheckFinalTime(void)
|
||||
{
|
||||
if (gSaveBlock1Ptr->trainerHill.field_3D6E_0b)
|
||||
if (gSaveBlock1Ptr->trainerHill.checkedFinalTime)
|
||||
{
|
||||
gSpecialVar_Result = 2;
|
||||
}
|
||||
@@ -452,12 +467,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 +483,7 @@ static void TrainerHillResumeTimer(void)
|
||||
|
||||
static void TrainerHillSetPlayerLost(void)
|
||||
{
|
||||
gSaveBlock1Ptr->trainerHill.hasLost = 1;
|
||||
gSaveBlock1Ptr->trainerHill.hasLost = TRUE;
|
||||
}
|
||||
|
||||
static void TrainerHillGetChallengeStatus(void)
|
||||
@@ -476,7 +491,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 +507,7 @@ static void TrainerHillGetChallengeStatus(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81D5B2C(void)
|
||||
static void BufferChallengeTime(void)
|
||||
{
|
||||
s32 total, minutes, secondsWhole, secondsFraction;
|
||||
|
||||
@@ -511,23 +526,26 @@ 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
|
||||
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 an E-Reader challenge, which is exclusive to JP Emerald
|
||||
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 npcChallenge)
|
||||
{
|
||||
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 from E-Reader challenges
|
||||
if (npcChallenge)
|
||||
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.trainerType == HILL_TRAINER_TYPE_NPC)
|
||||
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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user