More battle tower.

This commit is contained in:
DizzyEggg 2018-10-21 00:06:42 +02:00
parent f4e55999a5
commit 16026fe91d
18 changed files with 1126 additions and 2660 deletions

View File

@ -6195,8 +6195,8 @@ _081A4D90:
.pool
thumb_func_end CopyFrontierBrainTrainerName
thumb_func_start sub_81A4DB8
sub_81A4DB8: @ 81A4DB8
thumb_func_start IsFrontierBrainFemale
IsFrontierBrainFemale: @ 81A4DB8
push {lr}
ldr r0, =0x000040cf
bl VarGet
@ -6209,10 +6209,10 @@ sub_81A4DB8: @ 81A4DB8
pop {r1}
bx r1
.pool
thumb_func_end sub_81A4DB8
thumb_func_end IsFrontierBrainFemale
thumb_func_start sub_81A4DD8
sub_81A4DD8: @ 81A4DD8
thumb_func_start SetFrontierBrainTrainerGfxId
SetFrontierBrainTrainerGfxId: @ 81A4DD8
push {lr}
ldr r0, =0x000040cf
bl VarGet
@ -6227,10 +6227,10 @@ sub_81A4DD8: @ 81A4DD8
pop {r0}
bx r0
.pool
thumb_func_end sub_81A4DD8
thumb_func_end SetFrontierBrainTrainerGfxId
thumb_func_start sub_81A4E04
sub_81A4E04: @ 81A4E04
thumb_func_start CreateFrontierBrainPokemon
CreateFrontierBrainPokemon: @ 81A4E04
push {r4-r7,lr}
mov r7, r10
mov r6, r9
@ -6460,7 +6460,7 @@ _081A4FD0:
pop {r0}
bx r0
.pool
thumb_func_end sub_81A4E04
thumb_func_end CreateFrontierBrainPokemon
thumb_func_start sub_81A4FF0
sub_81A4FF0: @ 81A4FF0
@ -8755,7 +8755,7 @@ sub_81A63B8: @ 81A63B8
ldr r0, =gTrainerBattleOpponent_A
ldrh r0, [r0]
movs r1, 0
bl sub_8162614
bl SetBattleFacilityTrainerGfxId
pop {r0}
bx r0
.pool
@ -12662,7 +12662,7 @@ _081A831A:
str r0, [r1]
ldrh r0, [r5]
movs r1, 0
bl sub_8162614
bl SetBattleFacilityTrainerGfxId
ldr r0, =gSaveBlock2Ptr
ldr r1, [r0]
ldr r0, =0x00000cb2
@ -12747,7 +12747,7 @@ _081A83EE:
strh r4, [r5]
ldrh r0, [r5]
movs r1, 0
bl sub_8162614
bl SetBattleFacilityTrainerGfxId
ldr r3, =gSaveBlock2Ptr
ldr r1, [r3]
ldr r0, =0x00000cb2
@ -12808,7 +12808,7 @@ _081A8466:
strh r4, [r5]
ldrh r0, [r5]
movs r1, 0x1
bl sub_8162614
bl SetBattleFacilityTrainerGfxId
ldr r0, =gSaveBlock2Ptr
ldr r1, [r0]
ldr r0, =0x00000cb2
@ -17319,7 +17319,7 @@ _081AA8DC:
lsrs r7, r0, 16
adds r4, r7, 0
adds r0, r4, 0
bl sub_81627A4
bl GetBattleFacilityTrainerGfxId
strb r0, [r5, 0x1]
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]

File diff suppressed because it is too large Load Diff

View File

@ -21,16 +21,16 @@
@ 85D97BC
.include "data/battle_frontier/battle_frontier_mons.inc"
gUnknown_085DCEDC:: @ 85DCEDC
gTowerMaleFacilityClasses:: @ 85DCEDC
.byte 0x0e, 0x11, 0x03, 0x15, 0x17, 0x07, 0x0a, 0x19, 0x1a, 0x1b, 0x1d, 0x1e, 0x20, 0x26, 0x29, 0x09, 0x2b, 0x2d, 0x2e, 0x30, 0x32, 0x34, 0x04, 0x35, 0x3a, 0x05, 0x42, 0x44, 0x43, 0x00
gUnknown_085DCEFA:: @ 85DCEFA
gTowerFemaleFacilityClasses:: @ 85DCEFA
.byte 0x0d, 0x10, 0x12, 0x0c, 0x13, 0x14, 0x1f, 0x27, 0x2a, 0x16, 0x2f, 0x31, 0x33, 0x36, 0x37, 0x38, 0x1c, 0x02, 0x45, 0x47
gUnknown_085DCF0E:: @ 85DCF0E
gTowerMaleTrainerGfxIds:: @ 85DCF0E
.byte 0x37, 0x36, 0x21, 0x0f, 0x27, 0x33, 0x2c, 0x42, 0x42, 0x1f, 0x27, 0x25, 0x30, 0x26, 0x19, 0x15, 0x23, 0x32, 0x38, 0x33, 0x33, 0x21, 0x42, 0x05, 0x31, 0x27, 0x41, 0x1f, 0x24, 0x37
gUnknown_085DCF2C:: @ 85DCF2C
gTowerFemaleTrainerGfxIds:: @ 85DCF2C
.byte 0x14, 0x35, 0x22, 0x28, 0x14, 0x2d, 0x2f, 0x0e, 0x12, 0x16, 0x39, 0x34, 0x34, 0x0e, 0x22, 0x34, 0x20, 0x14, 0x20, 0x2f
gUnknown_085DCF40:: @ 85DCF40
@ -683,7 +683,7 @@ gUnknown_085DF96C:: @ 85DF96C
.4byte sub_8161F94
.4byte sub_8162054
.4byte sub_81620F4
.4byte sub_81623F0
.4byte ChooseNextBattleTowerTrainer
.4byte sub_81621C0
.4byte sub_816502C
.4byte sub_8164040

View File

@ -4,7 +4,7 @@ SootopolisCity_MysteryEventsHouse_B1F_MapScripts:: @ 8227E4F
.byte 0
SootopolisCity_MysteryEventsHouse_B1F_MapScript1_227E5A: @ 8227E5A
special sub_8162794
special SetEReaderTrainerGfxId
end
SootopolisCity_MysteryEventsHouse_B1F_MapScript2_227E5E: @ 8227E5E

View File

@ -332,7 +332,7 @@ gSpecials:: @ 81DBA64
def_special sp13F_fall_to_last_warp
def_special sub_80F8D28
def_special sub_80F8EB8
def_special sub_8162794
def_special SetEReaderTrainerGfxId
def_special BattleSetup_StartLatiBattle
def_special SetRoute119Weather
def_special SetRoute123Weather

View File

@ -14,5 +14,6 @@ bool8 InBattlePike(void);
void sub_81AA078(u16*, u8);
void sub_81A4C30(void);
bool8 sub_81A6BF4(void);
u8 sub_81A6CA8(u8, u8);
#endif // GUARD_BATTLE_FRONTIER_2_H

View File

@ -1,9 +1,9 @@
#ifndef GUARD_BATTLE_TOWER_H
#define GUARD_BATTLE_TOWER_H
#define BATTLE_TOWER_EREADER_TRAINER_ID 200
#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
{
@ -12,9 +12,7 @@ struct RSBattleTowerRecord
/*0x02*/ u16 winStreak;
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
/*0x0C*/ u8 trainerId[4];
/*0x10*/ struct {
u16 easyChat[6];
} greeting;
/*0x10*/ u16 greeting[6];
/*0x1C*/ struct UnknownPokemonStruct party[3];
/*0xA0*/ u32 checksum;
/*0xA4*/ u16 unk_11c8;
@ -26,16 +24,15 @@ union BattleTowerRecord
struct EmeraldBattleTowerRecord emerald;
};
#define FRONTIER_TRAINER_NAME_LENGTH 7
struct BattleFrontierTrainer
{
u32 facilityClass;
u8 trainerName[FRONTIER_TRAINER_NAME_LENGTH + 1];
u8 facilityClass;
u8 filler1[3];
u8 trainerName[PLAYER_NAME_LENGTH + 1];
u16 speechBefore[6];
u16 speechWin[6];
u16 speechLose[6];
const u16 *btMonPool;
const u16 *bfMonPool;
};
struct FacilityMon
@ -47,6 +44,11 @@ struct FacilityMon
u8 nature;
};
extern const u8 gTowerMaleFacilityClasses[30];
extern const u8 gTowerMaleTrainerGfxIds[30];
extern const u8 gTowerFemaleFacilityClasses[20];
extern const u8 gTowerFemaleTrainerGfxIds[20];
extern const struct BattleFrontierTrainer *gFacilityTrainers;
extern const struct FacilityMon *gFacilityTrainerMons;
@ -54,8 +56,8 @@ u16 GetCurrentBattleTowerWinStreak(u8, u8);
void sub_81659DC(struct RSBattleTowerRecord *a0, struct RSBattleTowerRecord *a1);
bool32 sub_816587C(union BattleTowerRecord *, union BattleTowerRecord *);
void CalcEmeraldBattleTowerChecksum(struct EmeraldBattleTowerRecord *);
void sub_81628A0(union BattleTowerRecord *);
void sub_8162614(u16 trainerId, u8);
void PutNewBattleTowerRecord(union BattleTowerRecord *);
void SetBattleFacilityTrainerGfxId(u16 trainerId, u8 tempVarId);
void ConvertBattleFrontierTrainerSpeechToString(const u16 *words);
void GetFrontierTrainerName(u8 *dest, u16 trainerIdx);
void GetEreaderTrainerName(u8 *dest);

View File

@ -326,19 +326,31 @@ struct UnknownPokemonStruct
struct EmeraldBattleTowerRecord
{
/*0x00*/ u8 lvlMode; // 0 = level 50, 1 = level 100
/*0x01*/ u8 trainerClass;
/*0x01*/ u8 facilityClass;
/*0x02*/ u16 winStreak;
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
/*0x0C*/ u8 trainerId[4];
/*0x10*/ struct {
u16 easyChat[6];
} greeting;
/*0x10*/ u16 greeting[6];
/*0x1C*/ u8 filler_1c[0x18];
/*0x34*/ struct UnknownPokemonStruct party[4];
/*0xE4*/ u8 language;
/*0xE8*/ u32 checksum;
};
struct BattleTowerEReaderTrainer
{
/*0x00*/ u8 unk0;
/*0x01*/ u8 facilityClass;
/*0x02*/ u16 winStreak;
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
/*0x0C*/ u8 trainerId[4];
/*0x10*/ u16 greeting[6];
/*0x1C*/ u16 farewellPlayerLost[6];
/*0x28*/ u16 farewellPlayerWon[6];
/*0x34*/ struct UnknownPokemonStruct party[3];
/*0xB8*/ u32 checksum;
};
struct FrontierMonData
{
u16 moves[4];
@ -367,17 +379,13 @@ struct BattleDomeTrainer
struct BattleFrontier
{
/*0x64C*/ struct EmeraldBattleTowerRecord battleTower;
/*0x738*/ struct EmeraldBattleTowerRecord records[5]; // No idea here, it's probably wrong, no clue.
/*0x738*/ struct EmeraldBattleTowerRecord records[5]; // From record mixing.
/*0xBD4*/ u16 field_BD4;
/*0xBD6*/ u16 field_BD6;
/*0xBD8*/ u8 field_BD8[11];
/*0xBE3*/ u8 field_BE3[8];
/*0xBEB*/ u8 field_BEB;
/*0xBEC*/ u8 filler_BEC[16];
/*0xBFC*/ u16 ecwords_BFC[6];
/*0xC08*/ u16 ecwords_C08[6];
/*0xC14*/ u16 ecwords_C14[6];
/*0xC20*/ u8 filler_C20[0x88];
/*0xBEC*/ struct BattleTowerEReaderTrainer ereaderTrainer;
/*0xCA8*/ u8 field_CA8;
/*0xCA9*/ u8 lvlMode:2; // 0x1, 0x2 -> 0x3
/*0xCA9*/ u8 field_CA9_a:1; // 0x4
@ -388,8 +396,8 @@ struct BattleFrontier
/*0xCA9*/ u8 field_CA9_f:1; // 0x80
/*0xCAA*/ u16 field_CAA[3];
/*0xCB0*/ u16 field_CB0;
/*0xCB2*/ u16 field_CB2;
/*0xCB4*/ u16 field_CB4[20];
/*0xCB2*/ u16 curChallengeBattleNum; // In case of battle pyramid, the floor.
/*0xCB4*/ u16 battledTrainerIds[20];
/*0xCDC*/ u32 field_CDC;
/*0xCE0*/ u16 field_CE0[4][2];
/*0xCF0*/ u16 field_CF0[2];

View File

@ -346,11 +346,6 @@ extern void (*gUnknown_030062F4)(void);
extern void sub_8165AE8(struct Apprentice *);
extern const u8 gUnknown_085DCEDC[];
extern const u8 gUnknown_085DCF0E[];
extern const u8 gUnknown_085DCEFA[];
extern const u8 gUnknown_085DCF2C[];
// This file's functions.
static u16 sub_819FF98(u8 arg0);
static bool8 sub_81A0194(u8 arg0, u16 moveId);
@ -382,7 +377,7 @@ static void sub_81A1218(void);
static void sub_81A1224(void);
static void sub_81A1438(void);
static void sub_81A150C(void);
static void sub_81A15A4(void);
static void Script_SetPlayerApprenticeTrainerGfxId(void);
static void sub_81A1644(void);
static void sub_81A1370(void);
@ -1030,7 +1025,7 @@ static void (* const sApprenticeFunctions[])(void) =
sub_81A1224,
sub_81A1438,
sub_81A150C,
sub_81A15A4,
Script_SetPlayerApprenticeTrainerGfxId,
sub_81A1644,
sub_81A1370,
};
@ -2270,51 +2265,46 @@ static void sub_81A150C(void)
u8 mapObjectGfxId;
u8 class = gApprentices[gSaveBlock2Ptr->apprentices[0].id].facilityClass;
for (i = 0; i < 30 && gUnknown_085DCEDC[i] != class; i++)
// Search male classes.
for (i = 0; i < ARRAY_COUNT(gTowerMaleFacilityClasses) && gTowerMaleFacilityClasses[i] != class; i++)
;
if (i != 30)
if (i != ARRAY_COUNT(gTowerMaleFacilityClasses))
{
mapObjectGfxId = gUnknown_085DCF0E[i];
mapObjectGfxId = gTowerMaleTrainerGfxIds[i];
VarSet(VAR_OBJ_GFX_ID_0, mapObjectGfxId);
return;
}
else
{
for (i = 0; i < 20 && gUnknown_085DCEFA[i] != class; i++)
;
if (i != 20)
{
mapObjectGfxId = gUnknown_085DCF2C[i];
VarSet(VAR_OBJ_GFX_ID_0, mapObjectGfxId);
}
for (i = 0; i < ARRAY_COUNT(gTowerFemaleFacilityClasses) && gTowerFemaleFacilityClasses[i] != class; i++)
;
if (i != ARRAY_COUNT(gTowerFemaleFacilityClasses))
{
mapObjectGfxId = gTowerFemaleTrainerGfxIds[i];
VarSet(VAR_OBJ_GFX_ID_0, mapObjectGfxId);
}
}
static void sub_81A15A4(void)
static void Script_SetPlayerApprenticeTrainerGfxId(void)
{
u8 i;
u8 mapObjectGfxId;
u8 class = gApprentices[PLAYER_APPRENTICE.id].facilityClass;
for (i = 0; i < 30 && gUnknown_085DCEDC[i] != class; i++)
for (i = 0; i < ARRAY_COUNT(gTowerMaleFacilityClasses) && gTowerMaleFacilityClasses[i] != class; i++)
;
if (i != 30)
if (i != ARRAY_COUNT(gTowerMaleFacilityClasses))
{
mapObjectGfxId = gUnknown_085DCF0E[i];
mapObjectGfxId = gTowerMaleTrainerGfxIds[i];
VarSet(VAR_OBJ_GFX_ID_0, mapObjectGfxId);
return;
}
else
{
for (i = 0; i < 20 && gUnknown_085DCEFA[i] != class; i++)
;
if (i != 20)
{
mapObjectGfxId = gUnknown_085DCF2C[i];
VarSet(VAR_OBJ_GFX_ID_0, mapObjectGfxId);
}
for (i = 0; i < ARRAY_COUNT(gTowerFemaleFacilityClasses) && gTowerFemaleFacilityClasses[i] != class; i++)
;
if (i != ARRAY_COUNT(gTowerFemaleFacilityClasses))
{
mapObjectGfxId = gTowerFemaleTrainerGfxIds[i];
VarSet(VAR_OBJ_GFX_ID_0, mapObjectGfxId);
}
}

View File

@ -62,7 +62,7 @@ extern u8 GetFacilityEnemyMonLevel(void);
extern u16 sub_81A5060(u8 monId, u8 moveSlotId);
extern u8 sub_81A50F0(u8, u8);
extern u8 sub_81A50B0(u8);
extern void sub_8162614(u16, u8);
extern void SetBattleFacilityTrainerGfxId(u16, u8);
extern void sub_81A4C30(void);
extern bool8 sub_81A3610(void);
extern u16 sub_81A4FF0(u8);
@ -2424,7 +2424,7 @@ static void sub_818E9CC(void)
u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
gSaveBlock2Ptr->frontier.field_CA8 = 0;
gSaveBlock2Ptr->frontier.field_CB2 = 0;
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
gSaveBlock2Ptr->frontier.field_CA9_a = 0;
gSaveBlock2Ptr->frontier.field_CA9_b = 0;
if (!(gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860D0EC[battleMode][lvlMode]))
@ -2824,12 +2824,12 @@ static void SwapDomeTrainers(s32 id1, s32 id2, u16 *statsArray)
static void sub_818F9B0(void)
{
StringCopy(gStringVar1, gRoundsStringTable[gSaveBlock2Ptr->frontier.field_CB2]);
StringCopy(gStringVar1, gRoundsStringTable[gSaveBlock2Ptr->frontier.curChallengeBattleNum]);
}
static void sub_818F9E0(void)
{
StringCopy(gStringVar1, gRoundsStringTable[gSaveBlock2Ptr->frontier.field_CB2]);
StringCopy(gStringVar1, gRoundsStringTable[gSaveBlock2Ptr->frontier.curChallengeBattleNum]);
CopyDomeTrainerName(gStringVar2, gTrainerBattleOpponent_A);
}
@ -3480,12 +3480,12 @@ static void sub_8190298(void)
static u16 TrainerIdOfPlayerOpponent(void)
{
return gSaveBlock2Ptr->frontier.domeTrainers[TournamentIdOfOpponent(gSaveBlock2Ptr->frontier.field_CB2, TRAINER_PLAYER)].trainerId;
return gSaveBlock2Ptr->frontier.domeTrainers[TournamentIdOfOpponent(gSaveBlock2Ptr->frontier.curChallengeBattleNum, TRAINER_PLAYER)].trainerId;
}
static void sub_81902E4(void)
{
sub_8162614(gTrainerBattleOpponent_A, 0);
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
}
static void sub_81902F8(void)
@ -3819,7 +3819,7 @@ static void sub_8190B40(struct Sprite *sprite)
s32 taskId1 = sprite->data[0];
s32 arrId = gTasks[gTasks[taskId1].data[4]].data[1];
s32 tournmanetTrainerId = gUnknown_0860D080[arrId];
s32 r12 = gSaveBlock2Ptr->frontier.field_CB2;
s32 roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
if (gTasks[taskId1].data[3] == 1)
{
@ -3831,7 +3831,7 @@ static void sub_8190B40(struct Sprite *sprite)
sprite->invisible = FALSE;
}
else if (!gSaveBlock2Ptr->frontier.domeTrainers[tournmanetTrainerId].isEliminated
&& sBattleDomeStruct->unk_10 - 1 < r12)
&& sBattleDomeStruct->unk_10 - 1 < roundId)
{
sprite->invisible = FALSE;
}
@ -4635,7 +4635,7 @@ static u8 sub_819221C(u8 taskId)
s32 taskId2 = gTasks[taskId].data[4];
s32 r5 = gTasks[taskId2].data[1];
u8 r10 = gUnknown_0860D080[r5];
u16 roundId = gSaveBlock2Ptr->frontier.field_CB2;
u16 roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
retVal = 9;
@ -5387,7 +5387,7 @@ static void sub_81938E0(void)
sub_8194D48();
gSaveBlock2Ptr->frontier.lvlMode = gSaveBlock2Ptr->frontier.field_D0A - 1;
gSaveBlock2Ptr->frontier.field_CB2 = 3;
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 3;
taskId = CreateTask(sub_8194220, 0);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0;
@ -5489,7 +5489,7 @@ static u8 sub_8193BDC(u8 taskId)
u8 retVal = 1;
s32 arrId = 4;
s32 spriteId = gTasks[taskId].data[1];
s32 roundId = gSaveBlock2Ptr->frontier.field_CB2;
s32 roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
if (gMain.newKeys == B_BUTTON || (gMain.newKeys & A_BUTTON && spriteId == 31))
{
@ -5550,19 +5550,19 @@ static void sub_8193D7C(void)
if (gSpecialVar_0x8005 == 1)
{
gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(gTrainerBattleOpponent_A)].isEliminated = 1;
gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(gTrainerBattleOpponent_A)].eliminatedAt = gSaveBlock2Ptr->frontier.field_CB2;
gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(gTrainerBattleOpponent_A)].eliminatedAt = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
gSaveBlock2Ptr->frontier.field_EC0[TrainerIdToTournamentId(gTrainerBattleOpponent_A)] = gBattleResults.lastUsedMovePlayer;
if (gSaveBlock2Ptr->frontier.field_CB2 < DOME_FINAL)
DecideRoundWinners(gSaveBlock2Ptr->frontier.field_CB2);
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < DOME_FINAL)
DecideRoundWinners(gSaveBlock2Ptr->frontier.curChallengeBattleNum);
}
else
{
gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(TRAINER_PLAYER)].isEliminated = 1;
gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(TRAINER_PLAYER)].eliminatedAt = gSaveBlock2Ptr->frontier.field_CB2;
gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(TRAINER_PLAYER)].eliminatedAt = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
gSaveBlock2Ptr->frontier.field_EC0[TrainerIdToTournamentId(TRAINER_PLAYER)] = gBattleResults.lastUsedMoveOpponent;
if (gBattleOutcome == B_OUTCOME_FORFEITED || gSpecialVar_0x8005 == 9)
gSaveBlock2Ptr->frontier.domeTrainers[TrainerIdToTournamentId(TRAINER_PLAYER)].unk3 = 1;
for (i = gSaveBlock2Ptr->frontier.field_CB2; i < DOME_ROUNDS_COUNT; i++)
for (i = gSaveBlock2Ptr->frontier.curChallengeBattleNum; i < DOME_ROUNDS_COUNT; i++)
DecideRoundWinners(i);
}
}
@ -5775,7 +5775,7 @@ static void sub_8194220(u8 taskId)
AddTextPrinter(&textPrinter, 0, NULL);
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
s32 var, var2;
s32 roundId, var2;
CopyDomeTrainerName(gDisplayedStringBattle, gSaveBlock2Ptr->frontier.domeTrainers[i].trainerId);
if (r10 == 1)
@ -5788,9 +5788,9 @@ static void sub_8194220(u8 taskId)
sub_81948EC(i, var2);
}
}
else if (gSaveBlock2Ptr->frontier.field_CB2 != DOME_ROUND2)
else if (gSaveBlock2Ptr->frontier.curChallengeBattleNum != DOME_ROUND2)
{
sub_81948EC(i, gSaveBlock2Ptr->frontier.field_CB2 - 2);
sub_81948EC(i, gSaveBlock2Ptr->frontier.curChallengeBattleNum - 2);
}
}
else if (r10 == 0)
@ -5803,23 +5803,23 @@ static void sub_8194220(u8 taskId)
sub_81948EC(i, var2);
}
}
else if (gSaveBlock2Ptr->frontier.field_CB2 != DOME_ROUND1)
else if (gSaveBlock2Ptr->frontier.curChallengeBattleNum != DOME_ROUND1)
{
if (gTasks[taskId].data[4])
var2 = gSaveBlock2Ptr->frontier.field_CB2;
var2 = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
else
var2 = gSaveBlock2Ptr->frontier.field_CB2 - 1;
var2 = gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1;
sub_81948EC(i, var2);
}
}
if (gTasks[taskId].data[4])
var = gSaveBlock2Ptr->frontier.field_CB2;
roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
else
var = gSaveBlock2Ptr->frontier.field_CB2 - 1;
roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1;
if ( ((r10 == 1 && gSaveBlock2Ptr->frontier.domeTrainers[i].eliminatedAt < gSaveBlock2Ptr->frontier.field_CB2 - 1)
|| (r10 == 0 && gSaveBlock2Ptr->frontier.domeTrainers[i].eliminatedAt <= var))
if ( ((r10 == 1 && gSaveBlock2Ptr->frontier.domeTrainers[i].eliminatedAt < gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1)
|| (r10 == 0 && gSaveBlock2Ptr->frontier.domeTrainers[i].eliminatedAt <= roundId))
&& gSaveBlock2Ptr->frontier.domeTrainers[i].isEliminated)
{
if (gSaveBlock2Ptr->frontier.domeTrainers[i].trainerId == TRAINER_PLAYER)
@ -5944,7 +5944,7 @@ static void sub_8194950(u8 taskId)
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
CopyDomeTrainerName(gDisplayedStringBattle, gSaveBlock2Ptr->frontier.domeTrainers[i].trainerId);
if (gSaveBlock2Ptr->frontier.domeTrainers[i].eliminatedAt == gSaveBlock2Ptr->frontier.field_CB2 - 1
if (gSaveBlock2Ptr->frontier.domeTrainers[i].eliminatedAt == gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1
&& gSaveBlock2Ptr->frontier.domeTrainers[i].isEliminated)
{
if (gUnknown_0860D3F1[i][0] == 0)
@ -5959,8 +5959,8 @@ static void sub_8194950(u8 taskId)
}
if (!gSaveBlock2Ptr->frontier.domeTrainers[i].isEliminated)
{
s32 var = gSaveBlock2Ptr->frontier.field_CB2 - 1;
sub_81948EC(i, var);
s32 roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1;
sub_81948EC(i, roundId);
}
}
}
@ -6454,7 +6454,7 @@ static void CopyDomeTrainerName(u8 *dst, u16 trainerId)
}
else if (trainerId < 300)
{
for (i = 0; i < FRONTIER_TRAINER_NAME_LENGTH; i++)
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
dst[i] = gFacilityTrainers[trainerId].trainerName[i];
}
dst[i] = EOS;
@ -6475,7 +6475,7 @@ static void CopyDomeBrainTrainerName(u8 *dst)
{
s32 i;
for (i = 0; i < FRONTIER_TRAINER_NAME_LENGTH; i++)
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
dst[i] = gTrainers[TRAINER_TUCKER].trainerName[i];
dst[i] = EOS;
}

View File

@ -5,7 +5,7 @@
#include "random.h"
#include "battle_tower.h"
extern void sub_8162614(u16, u8);
extern void SetBattleFacilityTrainerGfxId(u16, u8);
extern void (* const gUnknown_0860DE50[])(void);
extern const u32 gUnknown_0860DE98[][2];
@ -23,7 +23,7 @@ void sub_8195980(void)
u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
gSaveBlock2Ptr->frontier.field_CA8 = 0;
gSaveBlock2Ptr->frontier.field_CB2 = 0;
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
gSaveBlock2Ptr->frontier.field_CA9_a = 0;
gSaveBlock2Ptr->frontier.field_CA9_b = 0;
if (!(gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860DE98[battleMode][lvlMode]))
@ -90,7 +90,7 @@ void sub_8195BB0(void)
void sub_8195C20(void)
{
gTrainerBattleOpponent_A = 5 *(Random() % 255) / 64u;
sub_8162614(gTrainerBattleOpponent_A, 0);
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
}
void sub_8195C50(void)

View File

@ -885,8 +885,8 @@ u8 sub_80B100C(s32 arg0)
return sUnknown_0854FE98[Random() % ARRAY_COUNT(sUnknown_0854FE98)];
}
var = gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.field_CB2 * 2 + 0]
+ gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.field_CB2 * 2 + 1];
var = gSaveBlock2Ptr->frontier.battledTrainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum * 2 + 0]
+ gSaveBlock2Ptr->frontier.battledTrainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum * 2 + 1];
return sUnknown_0854FE98[var % ARRAY_COUNT(sUnknown_0854FE98)];
}

View File

@ -102,7 +102,7 @@ void sub_81B99B4(void)
static void sub_81B99D4(void)
{
gSaveBlock2Ptr->frontier.field_CA8 = 0;
gSaveBlock2Ptr->frontier.field_CB2 = 0;
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
gSaveBlock2Ptr->frontier.field_CA9_a = FALSE;
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
}
@ -120,7 +120,7 @@ static void sub_81B9A44(void)
static void sub_81B9A60(void)
{
gTrainerBattleOpponent_A = (u32)((Random() % 255) * 5) / 64;
sub_8162614(gTrainerBattleOpponent_A, 0);
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
}
static void sub_81B9A90(void)
@ -164,7 +164,7 @@ void sub_81B9B80(void)
static void sub_81B9BA0(void)
{
gSaveBlock2Ptr->frontier.field_CA8 = 0;
gSaveBlock2Ptr->frontier.field_CB2 = 0;
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
gSaveBlock2Ptr->frontier.field_CA9_a = FALSE;
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
}
@ -219,7 +219,7 @@ void sub_81B9D08(void)
static void sub_81B9D28(void)
{
gSaveBlock2Ptr->frontier.field_CA8 = 0;
gSaveBlock2Ptr->frontier.field_CB2 = 0;
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
gSaveBlock2Ptr->frontier.field_CA9_a = FALSE;
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
}
@ -551,25 +551,25 @@ static void sub_81BA040(void)
do
{
trainerId = Random() % 30;
for (i = 0; i < gSaveBlock2Ptr->frontier.field_CB2; i++)
for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum; i++)
{
if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId)
if (gSaveBlock2Ptr->frontier.battledTrainerIds[i] == trainerId)
break;
}
} while (i != gSaveBlock2Ptr->frontier.field_CB2);
} while (i != gSaveBlock2Ptr->frontier.curChallengeBattleNum);
gTrainerBattleOpponent_A = trainerId;
while (gFacilityTrainers[gTrainerBattleOpponent_A].btMonPool[monPoolCount] != 0xFFFF)
while (gFacilityTrainers[gTrainerBattleOpponent_A].bfMonPool[monPoolCount] != 0xFFFF)
monPoolCount++;
if (monPoolCount > 8)
break;
monPoolCount = 0;
}
if (gSaveBlock2Ptr->frontier.field_CB2 < 2)
gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.field_CB2] = gTrainerBattleOpponent_A;
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 2)
gSaveBlock2Ptr->frontier.battledTrainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = gTrainerBattleOpponent_A;
monSetsPool = gFacilityTrainers[gTrainerBattleOpponent_A].btMonPool;
monSetsPool = gFacilityTrainers[gTrainerBattleOpponent_A].bfMonPool;
i = 0;
while (i != 3)
{

File diff suppressed because it is too large Load Diff

View File

@ -314,7 +314,7 @@ static void ShowMapNamePopUpWindow(void)
else
{
withoutPrefixPtr = &(mapDisplayHeader[3]);
mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[gSaveBlock2Ptr->frontier.field_CB2];
mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[gSaveBlock2Ptr->frontier.curChallengeBattleNum];
}
StringCopy(withoutPrefixPtr, mapDisplayHeaderSource);
}

View File

@ -686,7 +686,7 @@ static void ReceiveBattleTowerData(void *battleTowerRecord, size_t recordSize, u
}
CalcEmeraldBattleTowerChecksum(dest);
}
sub_81628A0((void *)battleTowerRecord + recordSize * which);
PutNewBattleTowerRecord((void *)battleTowerRecord + recordSize * which);
}
static void ReceiveLilycoveLadyData(LilycoveLady *lilycoveLady, size_t recordSize, u8 which)

View File

@ -383,14 +383,14 @@ static void ShowSafariBallsWindow(void)
static void ShowPyramidFloorWindow(void)
{
if (gSaveBlock2Ptr->frontier.field_CB2 == 7)
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum == 7)
sBattlePyramidFloorWindowId = AddWindow(&sPyramidFloorWindowTemplate_1);
else
sBattlePyramidFloorWindowId = AddWindow(&sPyramidFloorWindowTemplate_2);
PutWindowTilemap(sBattlePyramidFloorWindowId);
NewMenuHelpers_DrawStdWindowFrame(sBattlePyramidFloorWindowId, FALSE);
StringCopy(gStringVar1, sPyramindFloorNames[gSaveBlock2Ptr->frontier.field_CB2]);
StringCopy(gStringVar1, sPyramindFloorNames[gSaveBlock2Ptr->frontier.curChallengeBattleNum]);
StringExpandPlaceholders(gStringVar4, gText_BattlePyramidFloor);
AddTextPrinterParameterized(sBattlePyramidFloorWindowId, 1, gStringVar4, 0, 1, 0xFF, NULL);
CopyWindowToVram(sBattlePyramidFloorWindowId, 2);

View File

@ -5102,7 +5102,7 @@ bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavi
}
if (gMapHeader.mapLayoutId == 0x169)
{
headerId = gSaveBlock2Ptr->frontier.field_CB2;
headerId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
if (previousMetaTileBehavior != currMetaTileBehavior && !DoGlobalWildEncounterDiceRoll())
return FALSE;
else if (DoWildEncounterRateTest(gBattlePyramidWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
@ -5240,7 +5240,7 @@ bool8 SweetScentWildEncounter(void)
}
if (gMapHeader.mapLayoutId == 0x169)
{
headerId = gSaveBlock2Ptr->frontier.field_CB2;
headerId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
if (TryGenerateWildMon(gBattlePyramidWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, 0) != TRUE)
return FALSE;