Battle tower - ewram variables

This commit is contained in:
DizzyEggg 2018-10-26 23:54:41 +02:00
parent 1efdaebe23
commit dc273cc19d
7 changed files with 128 additions and 140 deletions

View File

@ -1,10 +1,6 @@
#ifndef GUARD_BATTLE_TOWER_H #ifndef GUARD_BATTLE_TOWER_H
#define GUARD_BATTLE_TOWER_H #define GUARD_BATTLE_TOWER_H
#define BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID 300
#define BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID 400
#define BATTLE_TOWER_EREADER_TRAINER_ID 500
struct RSBattleTowerRecord struct RSBattleTowerRecord
{ {
/*0x00*/ u8 lvlMode; // 0 = level 50, 1 = level 100 /*0x00*/ u8 lvlMode; // 0 = level 50, 1 = level 100

View File

@ -4,12 +4,15 @@
#include "constants/opponents.h" #include "constants/opponents.h"
// Special Trainer Ids. // Special Trainer Ids.
#define TRAINER_FRONTIER_BRAIN 1022 #define TRAINER_RECORD_MIXING_FRIEND 300
#define TRAINER_PLAYER 1023 #define TRAINER_RECORD_MIXING_APPRENTICE 400
#define TRAINER_SECRET_BASE 1024 #define TRAINER_EREADER 500
#define TRAINER_LINK_OPPONENT 2048 #define TRAINER_FRONTIER_BRAIN 1022
#define TRAINER_OPPONENT_C00 3072 #define TRAINER_PLAYER 1023
#define TRAINER_STEVEN_PARTNER 3075 #define TRAINER_SECRET_BASE 1024
#define TRAINER_LINK_OPPONENT 2048
#define TRAINER_OPPONENT_C00 3072
#define TRAINER_STEVEN_PARTNER 3075
#define TRAINER_PIC_HIKER 0 #define TRAINER_PIC_HIKER 0
#define TRAINER_PIC_AQUA_GRUNT_M 1 #define TRAINER_PIC_AQUA_GRUNT_M 1

View File

@ -344,8 +344,6 @@ extern struct Unk030062ECStruct *gUnknown_030062EC;
extern struct Unk030062F0Struct *gUnknown_030062F0; extern struct Unk030062F0Struct *gUnknown_030062F0;
extern void (*gUnknown_030062F4)(void); extern void (*gUnknown_030062F4)(void);
extern void CalcApprenticeChecksum(struct Apprentice *);
// This file's functions. // This file's functions.
static u16 sub_819FF98(u8 arg0); static u16 sub_819FF98(u8 arg0);
static bool8 sub_81A0194(u8 arg0, u16 moveId); static bool8 sub_81A0194(u8 arg0, u16 moveId);

View File

@ -52,6 +52,7 @@
#include "international_string_util.h" #include "international_string_util.h"
#include "pokeball.h" #include "pokeball.h"
#include "party_menu.h" #include "party_menu.h"
#include "battle_tower.h"
struct UnknownPokemonStruct4 struct UnknownPokemonStruct4
{ {
@ -106,9 +107,6 @@ extern const u8 gText_Confusion[];
extern const u8 gText_Love[]; extern const u8 gText_Love[];
// functions // functions
extern void GetFrontierTrainerName(u8* dst, u16 trainerId); // battle tower
extern void sub_8166188(void); // battle tower, sets link battle mons level but why?
extern void GetBattleTowerTrainerLanguage(u8* dst, u16 trainerId); // battle tower, gets language
extern void sub_81B9150(void); extern void sub_81B9150(void);
extern void sub_80B3AF8(u8 taskId); // cable club extern void sub_80B3AF8(u8 taskId); // cable club
extern void sub_81A56B4(void); // battle frontier 2 extern void sub_81A56B4(void); // battle frontier 2

View File

@ -18,6 +18,8 @@
#include "recorded_battle.h" #include "recorded_battle.h"
#include "international_string_util.h" #include "international_string_util.h"
#include "battle_frontier_2.h" #include "battle_frontier_2.h"
#include "battle_tower.h"
#include "data2.h"
struct BattleWindowText struct BattleWindowText
{ {
@ -35,7 +37,6 @@ struct BattleWindowText
extern u8 gUnknown_0203C7B4; extern u8 gUnknown_0203C7B4;
extern const u8 gMoveNames[MOVES_COUNT][13];
extern const u8 gTrainerClassNames[][13]; extern const u8 gTrainerClassNames[][13];
extern const u16 gUnknown_08D85620[]; extern const u16 gUnknown_08D85620[];
@ -46,14 +47,10 @@ extern const u8 gText_PkmnTransferredSomeonesPC[];
extern const u8 gText_PkmnTransferredLanettesPC[]; extern const u8 gText_PkmnTransferredLanettesPC[];
extern u8 GetFrontierBrainTrainerClass(void); // battle_frontier_2 extern u8 GetFrontierBrainTrainerClass(void); // battle_frontier_2
extern u8 GetFrontierOpponentClass(u16 trainerId); // battle_tower
extern u8 GetTrainerHillOpponentClass(u16 trainerId); // pokenav extern u8 GetTrainerHillOpponentClass(u16 trainerId); // pokenav
extern u8 GetEreaderTrainerClassId(void); // battle_tower
extern void CopyFrontierBrainTrainerName(u8 *txtPtr); // battle_frontier_2 extern void CopyFrontierBrainTrainerName(u8 *txtPtr); // battle_frontier_2
extern void GetTrainerHillTrainerName(u8 *txtPtr, u16 trainerId); // pokenav extern void GetTrainerHillTrainerName(u8 *txtPtr, u16 trainerId); // pokenav
extern void GetEreaderTrainerName(u8 *txtPtr);
extern void CopyTrainerHillTrainerText(u8 arg0, u16 trainerId); // pokenav extern void CopyTrainerHillTrainerText(u8 arg0, u16 trainerId); // pokenav
extern void GetFrontierTrainerName(u8 *dst, u16 trainerId);
// this file's functions // this file's functions
static void ChooseMoveUsedParticle(u8 *textPtr); static void ChooseMoveUsedParticle(u8 *textPtr);

View File

@ -60,9 +60,23 @@ struct
const u8 *const *strings; const u8 *const *strings;
} extern const gUnknown_085DD500[50]; } extern const gUnknown_085DD500[50];
struct
{
u16 species;
u8 fixedIV;
u8 level;
u8 nature;
u8 evs[6];
u16 moves[4];
} extern const sStevenMons[3];
extern const u8 MossdeepCity_SpaceCenter_2F_EventScript_224157[]; extern const u8 MossdeepCity_SpaceCenter_2F_EventScript_224157[];
extern const u8 MossdeepCity_SpaceCenter_2F_EventScript_224166[]; extern const u8 MossdeepCity_SpaceCenter_2F_EventScript_224166[];
// EWRAM vars.
EWRAM_DATA const struct BattleFrontierTrainer *gFacilityTrainers = NULL;
EWRAM_DATA const struct FacilityMon *gFacilityTrainerMons = NULL;
// This file's functions. // This file's functions.
static void sub_8161F94(void); static void sub_8161F94(void);
static void sub_8162054(void); static void sub_8162054(void);
@ -88,8 +102,8 @@ static void CopyEReaderTrainerFarewellMessage(void);
static void ClearBattleTowerRecord(struct EmeraldBattleTowerRecord *record); static void ClearBattleTowerRecord(struct EmeraldBattleTowerRecord *record);
static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount); static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount);
static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount); static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount);
static void sub_81635D4(u16 trainerId, u8 firstMonId); static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId);
static void sub_816379C(u16 trainerId, u8 firstMonId); static void FillFactoryTentTrainerParty(u16 trainerId, u8 firstMonId);
static u8 GetFrontierTrainerFixedIvs(u16 trainerId); static u8 GetFrontierTrainerFixedIvs(u16 trainerId);
static void FillPartnerParty(u16 trainerId); static void FillPartnerParty(u16 trainerId);
static void SetEReaderTrainerChecksum(struct BattleTowerEReaderTrainer *ereaderTrainer); static void SetEReaderTrainerChecksum(struct BattleTowerEReaderTrainer *ereaderTrainer);
@ -260,7 +274,7 @@ static void sub_81620F4(void)
static void sub_81621C0(void) static void sub_81621C0(void)
{ {
if (gTrainerBattleOpponent_A == BATTLE_TOWER_EREADER_TRAINER_ID) if (gTrainerBattleOpponent_A == TRAINER_EREADER)
ClearEReaderTrainer(&gSaveBlock2Ptr->frontier.ereaderTrainer); ClearEReaderTrainer(&gSaveBlock2Ptr->frontier.ereaderTrainer);
if (gSaveBlock2Ptr->frontier.field_D04 < 9999) if (gSaveBlock2Ptr->frontier.field_D04 < 9999)
@ -308,7 +322,7 @@ static bool8 ChooseSpecialBattleTowerTrainer(void)
&& recordHasData && recordHasData
&& gSaveBlock2Ptr->frontier.towerRecords[i].checksum == checksum) && gSaveBlock2Ptr->frontier.towerRecords[i].checksum == checksum)
{ {
trainerIds[idsCount] = i + BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID; trainerIds[idsCount] = i + TRAINER_RECORD_MIXING_FRIEND;
idsCount++; idsCount++;
} }
} }
@ -322,7 +336,7 @@ static bool8 ChooseSpecialBattleTowerTrainer(void)
&& gUnknown_085DF9EC[gSaveBlock2Ptr->apprentices[i].field_1] == winStreak && gUnknown_085DF9EC[gSaveBlock2Ptr->apprentices[i].field_1] == winStreak
&& gSaveBlock2Ptr->apprentices[i].lvlMode - 1 == lvlMode) && gSaveBlock2Ptr->apprentices[i].lvlMode - 1 == lvlMode)
{ {
trainerIds[idsCount] = i + BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID; trainerIds[idsCount] = i + TRAINER_RECORD_MIXING_APPRENTICE;
idsCount++; idsCount++;
} }
} }
@ -505,7 +519,7 @@ void SetBattleFacilityTrainerGfxId(u16 trainerId, u8 tempVarId)
u8 trainerObjectGfxId; u8 trainerObjectGfxId;
SetFacilityPtrsGetLevel(); SetFacilityPtrsGetLevel();
if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID) if (trainerId == TRAINER_EREADER)
{ {
facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass; facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass;
} }
@ -514,17 +528,17 @@ void SetBattleFacilityTrainerGfxId(u16 trainerId, u8 tempVarId)
SetFrontierBrainTrainerGfxId(); SetFrontierBrainTrainerGfxId();
return; return;
} }
else if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{ {
facilityClass = gFacilityTrainers[trainerId].facilityClass; facilityClass = gFacilityTrainers[trainerId].facilityClass;
} }
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
facilityClass = gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass; facilityClass = gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].facilityClass;
} }
else else
{ {
facilityClass = gApprentices[gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].id].facilityClass; facilityClass = gApprentices[gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].id].facilityClass;
} }
// Search male classes. // Search male classes.
@ -592,7 +606,7 @@ void SetBattleFacilityTrainerGfxId(u16 trainerId, u8 tempVarId)
void SetEReaderTrainerGfxId(void) void SetEReaderTrainerGfxId(void)
{ {
SetBattleFacilityTrainerGfxId(BATTLE_TOWER_EREADER_TRAINER_ID, 0); SetBattleFacilityTrainerGfxId(TRAINER_EREADER, 0);
} }
u8 GetBattleFacilityTrainerGfxId(u16 trainerId) u8 GetBattleFacilityTrainerGfxId(u16 trainerId)
@ -602,21 +616,21 @@ u8 GetBattleFacilityTrainerGfxId(u16 trainerId)
u8 trainerObjectGfxId; u8 trainerObjectGfxId;
SetFacilityPtrsGetLevel(); SetFacilityPtrsGetLevel();
if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID) if (trainerId == TRAINER_EREADER)
{ {
facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass; facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass;
} }
else if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{ {
facilityClass = gFacilityTrainers[trainerId].facilityClass; facilityClass = gFacilityTrainers[trainerId].facilityClass;
} }
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
facilityClass = gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass; facilityClass = gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].facilityClass;
} }
else else
{ {
facilityClass = gApprentices[gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].id].facilityClass; facilityClass = gApprentices[gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].id].facilityClass;
} }
// Search male classes. // Search male classes.
@ -740,7 +754,7 @@ u8 GetFrontierTrainerFrontSpriteId(u16 trainerId)
{ {
SetFacilityPtrsGetLevel(); SetFacilityPtrsGetLevel();
if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID) if (trainerId == TRAINER_EREADER)
{ {
return gFacilityClassToPicIndex[gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass]; return gFacilityClassToPicIndex[gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass];
} }
@ -748,23 +762,23 @@ u8 GetFrontierTrainerFrontSpriteId(u16 trainerId)
{ {
return GetFrontierBrainTrainerPicIndex(); return GetFrontierBrainTrainerPicIndex();
} }
else if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{ {
return gFacilityClassToPicIndex[gFacilityTrainers[trainerId].facilityClass]; return gFacilityClassToPicIndex[gFacilityTrainers[trainerId].facilityClass];
} }
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
return gFacilityClassToPicIndex[sub_818649C()]; return gFacilityClassToPicIndex[sub_818649C()];
else else
return gFacilityClassToPicIndex[gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass]; return gFacilityClassToPicIndex[gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].facilityClass];
} }
else else
{ {
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
return gFacilityClassToPicIndex[gApprentices[sub_81864A8()].facilityClass]; return gFacilityClassToPicIndex[gApprentices[sub_81864A8()].facilityClass];
else else
return gFacilityClassToPicIndex[gApprentices[gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].id].facilityClass]; return gFacilityClassToPicIndex[gApprentices[gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].id].facilityClass];
} }
} }
@ -773,7 +787,7 @@ u8 GetFrontierOpponentClass(u16 trainerId)
u8 trainerClass = 0; u8 trainerClass = 0;
SetFacilityPtrsGetLevel(); SetFacilityPtrsGetLevel();
if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID) if (trainerId == TRAINER_EREADER)
{ {
trainerClass = gFacilityClassToTrainerClass[gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass]; trainerClass = gFacilityClassToTrainerClass[gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass];
} }
@ -785,11 +799,11 @@ u8 GetFrontierOpponentClass(u16 trainerId)
{ {
trainerClass = gTrainers[TRAINER_STEVEN].trainerClass; trainerClass = gTrainers[TRAINER_STEVEN].trainerClass;
} }
else if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{ {
trainerClass = gFacilityClassToTrainerClass[gFacilityTrainers[trainerId].facilityClass]; trainerClass = gFacilityClassToTrainerClass[gFacilityTrainers[trainerId].facilityClass];
} }
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
{ {
@ -797,7 +811,7 @@ u8 GetFrontierOpponentClass(u16 trainerId)
} }
else else
{ {
trainerClass = gFacilityClassToTrainerClass[gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass]; trainerClass = gFacilityClassToTrainerClass[gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].facilityClass];
asm(""); asm("");
} }
} }
@ -809,7 +823,7 @@ u8 GetFrontierOpponentClass(u16 trainerId)
} }
else else
{ {
trainerClass = gFacilityClassToTrainerClass[gApprentices[gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].id].facilityClass]; trainerClass = gFacilityClassToTrainerClass[gApprentices[gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].id].facilityClass];
asm(""); asm("");
} }
} }
@ -822,27 +836,27 @@ static u8 GetFrontierTrainerFacilityClass(u16 trainerId)
u8 facilityClass; u8 facilityClass;
SetFacilityPtrsGetLevel(); SetFacilityPtrsGetLevel();
if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID) if (trainerId == TRAINER_EREADER)
{ {
facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass; facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass;
} }
else if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{ {
facilityClass = gFacilityTrainers[trainerId].facilityClass; facilityClass = gFacilityTrainers[trainerId].facilityClass;
} }
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
facilityClass = sub_818649C(); facilityClass = sub_818649C();
else else
facilityClass = gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass; facilityClass = gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].facilityClass;
} }
else else
{ {
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
facilityClass = gApprentices[sub_81864A8()].facilityClass; facilityClass = gApprentices[sub_81864A8()].facilityClass;
else else
facilityClass = gApprentices[gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].id].facilityClass; facilityClass = gApprentices[gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].id].facilityClass;
} }
return facilityClass; return facilityClass;
@ -853,7 +867,7 @@ void GetFrontierTrainerName(u8 *dst, u16 trainerId)
s32 i = 0; s32 i = 0;
SetFacilityPtrsGetLevel(); SetFacilityPtrsGetLevel();
if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID) if (trainerId == TRAINER_EREADER)
{ {
for (i = 0; i < PLAYER_NAME_LENGTH; i++) for (i = 0; i < PLAYER_NAME_LENGTH; i++)
dst[i] = gSaveBlock2Ptr->frontier.ereaderTrainer.name[i]; dst[i] = gSaveBlock2Ptr->frontier.ereaderTrainer.name[i];
@ -868,12 +882,12 @@ void GetFrontierTrainerName(u8 *dst, u16 trainerId)
for (i = 0; i < PLAYER_NAME_LENGTH; i++) for (i = 0; i < PLAYER_NAME_LENGTH; i++)
dst[i] = gTrainers[TRAINER_STEVEN].trainerName[i]; dst[i] = gTrainers[TRAINER_STEVEN].trainerName[i];
} }
else if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{ {
for (i = 0; i < PLAYER_NAME_LENGTH; i++) for (i = 0; i < PLAYER_NAME_LENGTH; i++)
dst[i] = gFacilityTrainers[trainerId].trainerName[i]; dst[i] = gFacilityTrainers[trainerId].trainerName[i];
} }
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
{ {
@ -882,7 +896,7 @@ void GetFrontierTrainerName(u8 *dst, u16 trainerId)
} }
else else
{ {
struct EmeraldBattleTowerRecord *record = &gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID]; struct EmeraldBattleTowerRecord *record = &gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND];
TVShowConvertInternationalString(dst, record->name, record->language); TVShowConvertInternationalString(dst, record->name, record->language);
return; return;
} }
@ -898,7 +912,7 @@ void GetFrontierTrainerName(u8 *dst, u16 trainerId)
} }
else else
{ {
struct Apprentice *apprentice = &gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID]; struct Apprentice *apprentice = &gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE];
id = apprentice->id; id = apprentice->id;
language = apprentice->language; language = apprentice->language;
} }
@ -915,7 +929,7 @@ static bool8 IsFrontierTrainerFemale(u16 trainerId)
u8 facilityClass; u8 facilityClass;
SetFacilityPtrsGetLevel(); SetFacilityPtrsGetLevel();
if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID) if (trainerId == TRAINER_EREADER)
{ {
facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass; facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass;
} }
@ -923,17 +937,17 @@ static bool8 IsFrontierTrainerFemale(u16 trainerId)
{ {
return IsFrontierBrainFemale(); return IsFrontierBrainFemale();
} }
else if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{ {
facilityClass = gFacilityTrainers[trainerId].facilityClass; facilityClass = gFacilityTrainers[trainerId].facilityClass;
} }
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
facilityClass = gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass; facilityClass = gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].facilityClass;
} }
else else
{ {
facilityClass = gApprentices[gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].id].facilityClass; facilityClass = gApprentices[gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].id].facilityClass;
} }
// Search female classes. // Search female classes.
@ -978,13 +992,13 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
const u16 *bfMonPool = NULL; const u16 *bfMonPool = NULL;
u32 otID = 0; u32 otID = 0;
if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{ {
// Normal battle frontier trainer. // Normal battle frontier trainer.
fixedIV = GetFrontierTrainerFixedIvs(trainerId); fixedIV = GetFrontierTrainerFixedIvs(trainerId);
bfMonPool = gFacilityTrainers[gTrainerBattleOpponent_A].bfMonPool; bfMonPool = gFacilityTrainers[gTrainerBattleOpponent_A].bfMonPool;
} }
else if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID) else if (trainerId == TRAINER_EREADER)
{ {
for (i = firstMonId; i < firstMonId + 3; i++) for (i = firstMonId; i < firstMonId + 3; i++)
sub_806819C(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]); sub_806819C(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]);
@ -995,15 +1009,15 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
CreateFrontierBrainPokemon(); CreateFrontierBrainPokemon();
return; return;
} }
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
// Record mixed player. // Record mixed player.
for (j = 0, i = firstMonId; i < firstMonId + monCount; j++, i++) for (j = 0, i = firstMonId; i < firstMonId + monCount; j++, i++)
{ {
if (gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[j].species != 0 if (gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[j].species != 0
&& gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[j].level <= level) && gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[j].level <= level)
{ {
sub_8068338(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[j], FALSE); sub_8068338(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[j], FALSE);
} }
} }
return; return;
@ -1012,7 +1026,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
{ {
// Apprentice. // Apprentice.
for (i = firstMonId; i < firstMonId + 3; i++) for (i = firstMonId; i < firstMonId + 3; i++)
CreateApprenticeMon(&gEnemyParty[i], &gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID], i - firstMonId); CreateApprenticeMon(&gEnemyParty[i], &gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE], i - firstMonId);
return; return;
} }
@ -1144,16 +1158,16 @@ u16 RandomizeFacilityTrainerMonId(u16 trainerId)
return monPoolId; return monPoolId;
} }
static void sub_8163590(void) static void FillFactoryTrainerParty(void)
{ {
ZeroEnemyPartyMons(); ZeroEnemyPartyMons();
if (gSaveBlock2Ptr->frontier.lvlMode != FRONTIER_LVL_TENT) if (gSaveBlock2Ptr->frontier.lvlMode != FRONTIER_LVL_TENT)
sub_81635D4(gTrainerBattleOpponent_A, 0); FillFactoryFrontierTrainerParty(gTrainerBattleOpponent_A, 0);
else else
sub_816379C(gTrainerBattleOpponent_A, 0); FillFactoryTentTrainerParty(gTrainerBattleOpponent_A, 0);
} }
static void sub_81635D4(u16 trainerId, u8 firstMonId) static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId)
{ {
u8 i, j; u8 i, j;
u8 friendship; u8 friendship;
@ -1161,7 +1175,7 @@ static void sub_81635D4(u16 trainerId, u8 firstMonId)
u8 fixedIV; u8 fixedIV;
u32 otID; u32 otID;
if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{ {
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; // Unused variable. u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; // Unused variable.
u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
@ -1171,7 +1185,7 @@ static void sub_81635D4(u16 trainerId, u8 firstMonId)
else else
fixedIV = sub_81A6CA8(challengeNum, 1); fixedIV = sub_81A6CA8(challengeNum, 1);
} }
else if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID) else if (trainerId == TRAINER_EREADER)
{ {
for (i = firstMonId; i < firstMonId + 3; i++) for (i = firstMonId; i < firstMonId + 3; i++)
sub_806819C(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]); sub_806819C(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]);
@ -1210,7 +1224,7 @@ static void sub_81635D4(u16 trainerId, u8 firstMonId)
} }
} }
static void sub_816379C(u16 trainerId, u8 firstMonId) static void FillFactoryTentTrainerParty(u16 trainerId, u8 firstMonId)
{ {
u8 i, j; u8 i, j;
u8 friendship; u8 friendship;
@ -1269,14 +1283,14 @@ static void sub_8163914(void)
else else
trainerId = gTrainerBattleOpponent_A; trainerId = gTrainerBattleOpponent_A;
if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID) if (trainerId == TRAINER_EREADER)
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.greeting); FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.greeting);
else if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
FrontierSpeechToString(gFacilityTrainers[trainerId].speechBefore); FrontierSpeechToString(gFacilityTrainers[trainerId].speechBefore);
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].greeting); FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].greeting);
else else
CopyFriendsApprenticeChallengeText(trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID); CopyFriendsApprenticeChallengeText(trainerId - TRAINER_RECORD_MIXING_APPRENTICE);
} }
static void HandleSpecialTrainerBattleEnd(void) static void HandleSpecialTrainerBattleEnd(void)
@ -1419,7 +1433,7 @@ void DoSpecialTrainerBattle(void)
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_FACTORY; gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_FACTORY;
if (VarGet(VAR_FRONTIER_BATTLE_MODE) == FRONTIER_MODE_DOUBLES) if (VarGet(VAR_FRONTIER_BATTLE_MODE) == FRONTIER_MODE_DOUBLES)
gBattleTypeFlags |= BATTLE_TYPE_DOUBLE; gBattleTypeFlags |= BATTLE_TYPE_DOUBLE;
sub_8163590(); FillFactoryTrainerParty();
CreateTask(Task_StartBattleAfterTransition, 1); CreateTask(Task_StartBattleAfterTransition, 1);
PlayMapChosenOrBattleBGM(0); PlayMapChosenOrBattleBGM(0);
BattleTransition_StartOnField(sub_80B100C(6)); BattleTransition_StartOnField(sub_80B100C(6));
@ -1552,7 +1566,7 @@ static void sub_81640E0(u16 trainerId)
count = 0; count = 0;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
u16 apprenticeSpecies = gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].party[i].species; u16 apprenticeSpecies = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].party[i].species;
if (apprenticeSpecies != species1 && apprenticeSpecies != species2) if (apprenticeSpecies != species1 && apprenticeSpecies != species2)
{ {
validSpecies[count] = i; validSpecies[count] = i;
@ -1578,10 +1592,10 @@ static void sub_8164188(u16 trainerId)
count = 0; count = 0;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
if (gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[i].species != species1 if (gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[i].species != species1
&& gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[i].species != species2 && gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[i].species != species2
&& gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[i].level <= GetFrontierEnemyMonLevel(lvlMode) && gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[i].level <= GetFrontierEnemyMonLevel(lvlMode)
&& gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[i].species != 0) && gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[i].species != 0)
{ {
validSpecies[count] = i; validSpecies[count] = i;
count++; count++;
@ -1684,7 +1698,7 @@ static void sub_81642A0(void)
} }
if (k > 2) if (k > 2)
{ {
spArray[r10] = i + BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID; spArray[r10] = i + TRAINER_RECORD_MIXING_APPRENTICE;
r10++; r10++;
} }
} }
@ -1727,7 +1741,7 @@ static void sub_81642A0(void)
} }
if (k > 1) if (k > 1)
{ {
spArray[r10] = i + BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID; spArray[r10] = i + TRAINER_RECORD_MIXING_FRIEND;
r10++; r10++;
} }
} }
@ -1747,28 +1761,28 @@ static void sub_81646BC(u16 trainerId, u16 monPoolId)
u16 species = 0; u16 species = 0;
SetFacilityPtrsGetLevel(); SetFacilityPtrsGetLevel();
if (trainerId != BATTLE_TOWER_EREADER_TRAINER_ID) if (trainerId != TRAINER_EREADER)
{ {
if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{ {
move = gFacilityTrainerMons[monPoolId].moves[0]; move = gFacilityTrainerMons[monPoolId].moves[0];
species = gFacilityTrainerMons[monPoolId].species; species = gFacilityTrainerMons[monPoolId].species;
} }
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
move = gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[gUnknown_03006298[gSpecialVar_0x8005 + 1]].moves[0]; move = gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[gUnknown_03006298[gSpecialVar_0x8005 + 1]].moves[0];
species = gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[gUnknown_03006298[gSpecialVar_0x8005 + 1]].species; species = gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[gUnknown_03006298[gSpecialVar_0x8005 + 1]].species;
} }
else else
{ {
s32 i; s32 i;
move = gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].party[gUnknown_03006298[gSpecialVar_0x8005 - 1]].moves[0]; move = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].party[gUnknown_03006298[gSpecialVar_0x8005 - 1]].moves[0];
species = gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].party[gUnknown_03006298[gSpecialVar_0x8005 - 1]].species; species = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].party[gUnknown_03006298[gSpecialVar_0x8005 - 1]].species;
for (i = 0; i < PLAYER_NAME_LENGTH; i++) for (i = 0; i < PLAYER_NAME_LENGTH; i++)
gStringVar3[i] = gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].playerName[i]; gStringVar3[i] = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].playerName[i];
gStringVar3[i] = EOS; gStringVar3[i] = EOS;
ConvertInternationalString(gStringVar3, gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].language); ConvertInternationalString(gStringVar3, gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].language);
} }
} }
@ -1794,13 +1808,13 @@ static void sub_8164828(void)
switch (gSpecialVar_0x8005) switch (gSpecialVar_0x8005)
{ {
case 0: case 0:
if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID) if (trainerId == TRAINER_EREADER)
return; return;
if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{ {
GetFrontierTrainerName(gStringVar1, trainerId); GetFrontierTrainerName(gStringVar1, trainerId);
} }
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
GetFrontierTrainerName(gStringVar1, trainerId); GetFrontierTrainerName(gStringVar1, trainerId);
} }
@ -1808,10 +1822,10 @@ static void sub_8164828(void)
{ {
s32 i; s32 i;
for (i = 0; i < PLAYER_NAME_LENGTH; i++) for (i = 0; i < PLAYER_NAME_LENGTH; i++)
gStringVar1[i] = gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].playerName[i]; gStringVar1[i] = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].playerName[i];
gStringVar1[i] = EOS; gStringVar1[i] = EOS;
ConvertInternationalString(gStringVar1, gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].language); ConvertInternationalString(gStringVar1, gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].language);
ConvertIntToDecimalStringN(gStringVar2, gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].number, STR_CONV_MODE_LEFT_ALIGN, 3); ConvertIntToDecimalStringN(gStringVar2, gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].number, STR_CONV_MODE_LEFT_ALIGN, 3);
GetFrontierTrainerName(gStringVar3, trainerId); GetFrontierTrainerName(gStringVar3, trainerId);
} }
break; break;
@ -1825,12 +1839,12 @@ static void sub_8164828(void)
break; break;
case 3: case 3:
gPartnerTrainerId = trainerId; gPartnerTrainerId = trainerId;
if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{ {
gSaveBlock2Ptr->frontier.field_CB4[18] = gSaveBlock2Ptr->frontier.field_CB4[8 + k * 2]; gSaveBlock2Ptr->frontier.field_CB4[18] = gSaveBlock2Ptr->frontier.field_CB4[8 + k * 2];
gSaveBlock2Ptr->frontier.field_CB4[19] = gSaveBlock2Ptr->frontier.field_CB4[9 + k * 2]; gSaveBlock2Ptr->frontier.field_CB4[19] = gSaveBlock2Ptr->frontier.field_CB4[9 + k * 2];
} }
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
gSaveBlock2Ptr->frontier.field_CB4[18] = gUnknown_03006298[2]; gSaveBlock2Ptr->frontier.field_CB4[18] = gUnknown_03006298[2];
gSaveBlock2Ptr->frontier.field_CB4[19] = gUnknown_03006298[3]; gSaveBlock2Ptr->frontier.field_CB4[19] = gUnknown_03006298[3];
@ -1864,20 +1878,20 @@ static void sub_8164828(void)
break; break;
} }
if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID) if (trainerId == TRAINER_EREADER)
return; return;
if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{ {
ShowFieldMessage(gUnknown_085DD500[arrId].strings[gSpecialVar_0x8005]); ShowFieldMessage(gUnknown_085DD500[arrId].strings[gSpecialVar_0x8005]);
} }
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
ShowFieldMessage(gUnknown_085DD500[arrId].strings[gSpecialVar_0x8005]); ShowFieldMessage(gUnknown_085DD500[arrId].strings[gSpecialVar_0x8005]);
} }
else else
{ {
u8 id = gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].id; u8 id = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].id;
ShowFieldMessage(gUnknown_085DD690[id][gSpecialVar_0x8005]); ShowFieldMessage(gUnknown_085DD690[id][gSpecialVar_0x8005]);
} }
} }
@ -2264,18 +2278,6 @@ void sub_81653CC(void)
} }
} }
struct StevenMon
{
u16 species;
u8 fixedIV;
u8 level;
u8 nature;
u8 evs[6];
u16 moves[4];
};
extern const struct StevenMon sStevenMons[3];
#define STEVEN_OTID 61226 #define STEVEN_OTID 61226
static void FillPartnerParty(u16 trainerId) static void FillPartnerParty(u16 trainerId)
@ -2312,12 +2314,12 @@ static void FillPartnerParty(u16 trainerId)
CalculateMonStats(&gPlayerParty[3 + i]); CalculateMonStats(&gPlayerParty[3 + i]);
} }
} }
else if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID) else if (trainerId == TRAINER_EREADER)
{ {
// Scrapped, lol. // Scrapped, lol.
trainerName[0] = gGameLanguage; trainerName[0] = gGameLanguage;
} }
else if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{ {
level = SetFacilityPtrsGetLevel(); level = SetFacilityPtrsGetLevel();
ivs = GetFrontierTrainerFixedIvs(trainerId); ivs = GetFrontierTrainerFixedIvs(trainerId);
@ -2348,9 +2350,9 @@ static void FillPartnerParty(u16 trainerId)
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j); SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j);
} }
} }
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
trainerId -= BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID; trainerId -= TRAINER_RECORD_MIXING_FRIEND;
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
struct EmeraldBattleTowerRecord *record = &gSaveBlock2Ptr->frontier.towerRecords[trainerId]; struct EmeraldBattleTowerRecord *record = &gSaveBlock2Ptr->frontier.towerRecords[trainerId];
@ -2371,17 +2373,17 @@ static void FillPartnerParty(u16 trainerId)
} }
sub_8068338(&gPlayerParty[3 + i], &monData, TRUE); sub_8068338(&gPlayerParty[3 + i], &monData, TRUE);
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_NAME, trainerName); SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_NAME, trainerName);
j = IsFrontierTrainerFemale(trainerId + BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID); j = IsFrontierTrainerFemale(trainerId + TRAINER_RECORD_MIXING_FRIEND);
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j); SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j);
} }
} }
else else
{ {
trainerId -= BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID; trainerId -= TRAINER_RECORD_MIXING_APPRENTICE;
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
CreateApprenticeMon(&gPlayerParty[3 + i], &gSaveBlock2Ptr->apprentices[trainerId], gSaveBlock2Ptr->frontier.field_CB4[18 + i]); CreateApprenticeMon(&gPlayerParty[3 + i], &gSaveBlock2Ptr->apprentices[trainerId], gSaveBlock2Ptr->frontier.field_CB4[18 + i]);
j = IsFrontierTrainerFemale(trainerId + BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID); j = IsFrontierTrainerFemale(trainerId + TRAINER_RECORD_MIXING_APPRENTICE);
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j); SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j);
} }
} }
@ -2513,27 +2515,27 @@ static void ValidateApprenticesChecksums(void)
void GetBattleTowerTrainerLanguage(u8 *dst, u16 trainerId) void GetBattleTowerTrainerLanguage(u8 *dst, u16 trainerId)
{ {
if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID) if (trainerId == TRAINER_EREADER)
{ {
*dst = gGameLanguage; *dst = gGameLanguage;
} }
else if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{ {
*dst = gGameLanguage; *dst = gGameLanguage;
} }
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
*dst = sub_81864B4(); *dst = sub_81864B4();
else else
*dst = gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].language; *dst = gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].language;
} }
else else
{ {
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
*dst = sub_81864C0(); *dst = sub_81864C0();
else else
*dst = gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].language; *dst = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].language;
} }
} }

View File

@ -470,13 +470,7 @@ gUnknown_0203ABB5: @ 203ABB5
.include "src/learn_move.o" .include "src/learn_move.o"
.include "src/decoration_inventory.o" .include "src/decoration_inventory.o"
.include "src/roamer.o" .include "src/roamer.o"
.include "src/battle_tower.o"
gFacilityTrainers: @ 203BC88
.space 0x4
gFacilityTrainerMons: @ 203BC8C
.space 0x4
.include "src/use_pokeblock.o" .include "src/use_pokeblock.o"
.include "src/player_pc.o" .include "src/player_pc.o"
.include "src/intro.o" .include "src/intro.o"