Document recorded battle

This commit is contained in:
DizzyEggg 2018-11-01 15:06:50 +01:00
parent 7de1c4bd14
commit 37d742cbd8
7 changed files with 493 additions and 1457 deletions

View File

@ -6,512 +6,7 @@
.text
thumb_func_start CreateFrontierBrainPokemon
CreateFrontierBrainPokemon: @ 81A4E04
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x44
ldr r0, =0x000040cf
bl VarGet
lsls r0, 16
lsrs r0, 16
str r0, [sp, 0x20]
bl sub_81A513C
str r0, [sp, 0x24]
ldr r0, [sp, 0x20]
cmp r0, 0x1
bne _081A4E44
ldr r0, =0x000003fe
bl TrainerIdToDomeTournamentId
lsls r0, 16
lsrs r0, 16
bl GetTrainerMonCountInBits
adds r4, r0, 0
b _081A4E46
.pool
_081A4E44:
movs r4, 0x7
_081A4E46:
bl ZeroEnemyPartyMons
movs r1, 0
str r1, [sp, 0x18]
bl SetFacilityPtrsGetLevel
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x1C]
movs r2, 0
str r2, [sp, 0x14]
_081A4E5C:
movs r0, 0x1
ands r0, r4
asrs r4, 1
str r4, [sp, 0x30]
ldr r3, [sp, 0x14]
adds r3, 0x1
str r3, [sp, 0x28]
cmp r0, 0
bne _081A4E70
b _081A4FC4
_081A4E70:
ldr r4, [sp, 0x14]
lsls r4, 2
mov r9, r4
ldr r0, [sp, 0x24]
lsls r0, 4
str r0, [sp, 0x38]
ldr r1, [sp, 0x20]
lsls r1, 4
str r1, [sp, 0x34]
ldr r2, [sp, 0x1C]
lsls r2, 24
str r2, [sp, 0x3C]
ldr r3, [sp, 0x18]
adds r3, 0x1
str r3, [sp, 0x2C]
ldr r0, [sp, 0x14]
add r0, r9
lsls r0, 2
mov r8, r0
_081A4E96:
bl Random
adds r4, r0, 0
bl Random
lsls r4, 16
lsrs r7, r4, 16
lsls r0, 16
orrs r7, r0
ldr r0, =0x0000ef2a
adds r1, r7, 0
bl IsShinyOtIdPersonality
lsls r0, 24
cmp r0, 0
bne _081A4E96
ldr r4, [sp, 0x38]
ldr r1, [sp, 0x24]
subs r0, r4, r1
lsls r5, r0, 2
mov r2, r8
adds r4, r2, r5
ldr r3, [sp, 0x34]
ldr r1, [sp, 0x20]
subs r0, r3, r1
lsls r6, r0, 3
adds r4, r6
ldr r2, =sFrontierBrainsMons
adds r4, r2
adds r0, r7, 0
bl GetNatureFromPersonality
ldrb r1, [r4, 0x5]
lsls r0, 24
lsrs r0, 24
cmp r1, r0
bne _081A4E96
ldr r4, [sp, 0x18]
movs r0, 0x64
adds r3, r4, 0
muls r3, r0
mov r8, r3
ldr r1, =gEnemyParty
add r1, r8
mov r10, r1
ldr r4, [sp, 0x14]
add r4, r9
lsls r4, 2
adds r0, r4, r5
adds r0, r6
ldr r2, =sFrontierBrainsMons
adds r0, r2
ldrh r1, [r0]
ldr r3, [sp, 0x3C]
lsrs r2, r3, 24
ldrb r3, [r0, 0x4]
movs r0, 0x1
str r0, [sp]
str r7, [sp, 0x4]
str r0, [sp, 0x8]
ldr r0, =0x0000ef2a
str r0, [sp, 0xC]
mov r0, r10
bl CreateMon
ldr r0, =sFrontierBrainsMons
adds r5, r0
adds r5, r6, r5
adds r4, r5, r4
adds r4, 0x2
mov r0, r10
movs r1, 0xC
adds r2, r4, 0
bl SetMonData
movs r7, 0
mov r6, r8
ldr r3, =gEnemyParty
_081A4F32:
adds r1, r7, 0
adds r1, 0x1A
ldr r0, [sp, 0x14]
add r0, r9
lsls r4, r0, 2
adds r2, r5, r4
adds r0, r7, 0x6
adds r2, r0
adds r0, r6, r3
str r3, [sp, 0x40]
bl SetMonData
adds r7, 0x1
ldr r3, [sp, 0x40]
cmp r7, 0x5
ble _081A4F32
movs r1, 0xFF
add r0, sp, 0x10
strb r1, [r0]
movs r7, 0
ldr r1, [sp, 0x18]
movs r2, 0x64
adds r6, r1, 0
muls r6, r2
ldr r3, =gUnknown_08611578
mov r8, r3
ldr r3, =gEnemyParty
adds r5, r4, 0
_081A4F6A:
ldr r4, [sp, 0x38]
ldr r0, [sp, 0x24]
subs r1, r4, r0
lsls r1, 2
adds r1, r5, r1
ldr r2, [sp, 0x34]
ldr r4, [sp, 0x20]
subs r0, r2, r4
lsls r0, 3
adds r1, r0
add r1, r8
ldrh r4, [r1]
lsls r2, r7, 24
lsrs r2, 24
adds r0, r6, r3
adds r1, r4, 0
str r3, [sp, 0x40]
bl SetMonMoveSlot
ldr r3, [sp, 0x40]
cmp r4, 0xDA
bne _081A4F9C
movs r1, 0
add r0, sp, 0x10
strb r1, [r0]
_081A4F9C:
adds r5, 0x2
adds r7, 0x1
cmp r7, 0x3
ble _081A4F6A
ldr r0, [sp, 0x18]
movs r1, 0x64
adds r4, r0, 0
muls r4, r1
ldr r0, =gEnemyParty
adds r4, r0
adds r0, r4, 0
movs r1, 0x20
add r2, sp, 0x10
bl SetMonData
adds r0, r4, 0
bl CalculateMonStats
ldr r2, [sp, 0x2C]
str r2, [sp, 0x18]
_081A4FC4:
ldr r4, [sp, 0x30]
ldr r3, [sp, 0x28]
str r3, [sp, 0x14]
cmp r3, 0x2
bgt _081A4FD0
b _081A4E5C
_081A4FD0:
add sp, 0x44
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end CreateFrontierBrainPokemon
thumb_func_start sub_81A4FF0
sub_81A4FF0: @ 81A4FF0
push {r4,r5,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
ldr r0, =0x000040cf
bl VarGet
adds r5, r0, 0
lsls r5, 16
lsrs r5, 16
bl sub_81A513C
ldr r3, =sFrontierBrainsMons
lsls r2, r4, 2
adds r2, r4
lsls r1, r0, 4
subs r1, r0
adds r1, r2
lsls r1, 2
lsls r0, r5, 4
subs r0, r5
lsls r0, 3
adds r1, r0
adds r1, r3
ldrh r0, [r1]
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_81A4FF0
thumb_func_start sub_81A5030
sub_81A5030: @ 81A5030
push {lr}
lsls r0, 24
ldr r2, =gTrainerBattleOpponent_A
ldr r3, =0x000003fe
adds r1, r3, 0
strh r1, [r2]
ldr r2, =0x00004010
ldr r1, =gUnknown_08611C8C
lsrs r0, 23
adds r0, r1
ldrb r1, [r0]
adds r0, r2, 0
bl VarSet
pop {r0}
bx r0
.pool
thumb_func_end sub_81A5030
thumb_func_start sub_81A5060
sub_81A5060: @ 81A5060
push {r4-r6,lr}
adds r6, r0, 0
adds r4, r1, 0
lsls r6, 24
lsrs r6, 24
lsls r4, 24
lsrs r4, 24
ldr r0, =0x000040cf
bl VarGet
adds r5, r0, 0
lsls r5, 16
lsrs r5, 16
bl sub_81A513C
ldr r2, =sFrontierBrainsMons
lsls r4, 1
lsls r1, r6, 2
adds r1, r6
lsls r1, 2
adds r4, r1
lsls r1, r0, 4
subs r1, r0
lsls r1, 2
adds r4, r1
lsls r0, r5, 4
subs r0, r5
lsls r0, 3
adds r4, r0
adds r2, 0xC
adds r4, r2
ldrh r0, [r4]
pop {r4-r6}
pop {r1}
bx r1
.pool
thumb_func_end sub_81A5060
thumb_func_start sub_81A50B0
sub_81A50B0: @ 81A50B0
push {r4,r5,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
ldr r0, =0x000040cf
bl VarGet
adds r5, r0, 0
lsls r5, 16
lsrs r5, 16
bl sub_81A513C
ldr r3, =sFrontierBrainsMons
lsls r2, r4, 2
adds r2, r4
lsls r1, r0, 4
subs r1, r0
adds r1, r2
lsls r1, 2
lsls r0, r5, 4
subs r0, r5
lsls r0, 3
adds r1, r0
adds r1, r3
ldrb r0, [r1, 0x5]
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_81A50B0
thumb_func_start sub_81A50F0
sub_81A50F0: @ 81A50F0
push {r4-r6,lr}
adds r6, r0, 0
adds r4, r1, 0
lsls r6, 24
lsrs r6, 24
lsls r4, 24
lsrs r4, 24
ldr r0, =0x000040cf
bl VarGet
adds r5, r0, 0
lsls r5, 16
lsrs r5, 16
bl sub_81A513C
ldr r2, =sFrontierBrainsMons
lsls r1, r6, 2
adds r1, r6
lsls r1, 2
adds r4, r1
lsls r1, r0, 4
subs r1, r0
lsls r1, 2
adds r4, r1
lsls r0, r5, 4
subs r0, r5
lsls r0, 3
adds r4, r0
adds r2, 0x6
adds r4, r2
ldrb r0, [r4]
pop {r4-r6}
pop {r1}
bx r1
.pool
thumb_func_end sub_81A50F0
thumb_func_start sub_81A513C
sub_81A513C: @ 81A513C
push {r4,r5,lr}
ldr r0, =0x000040cf
bl VarGet
lsls r0, 16
lsrs r5, r0, 16
lsls r0, r5, 24
lsrs r0, 24
bl sub_81A3B30
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x2
bne _081A51A0
bl GetCurrentFacilityWinStreak
lsls r0, 16
ldr r3, =gUnknown_08611550
lsls r2, r5, 2
adds r1, r3, 0x3
adds r1, r2, r1
lsrs r0, 16
ldrb r1, [r1]
adds r1, r0, r1
adds r0, r2, r3
ldrb r0, [r0]
cmp r1, r0
bne _081A5180
movs r4, 0
b _081A51A0
.pool
_081A5180:
adds r0, r3, 0x1
adds r0, r2, r0
ldrb r0, [r0]
cmp r1, r0
beq _081A519E
cmp r1, r0
ble _081A51A0
subs r0, r1, r0
adds r1, r3, 0x2
adds r1, r2, r1
ldrb r1, [r1]
bl __modsi3
cmp r0, 0
bne _081A51A0
_081A519E:
movs r4, 0x1
_081A51A0:
adds r0, r4, 0
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_81A513C
thumb_func_start sub_81A51A8
sub_81A51A8: @ 81A51A8
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
ands r0, r1
cmp r0, 0
beq _081A51D4
bl GetRecordedBattleFrontierFacility
lsls r0, 24
lsrs r4, r0, 24
bl sub_8185EAC
lsls r0, 24
lsrs r1, r0, 24
b _081A51E4
.pool
_081A51D4:
ldr r0, =0x000040cf
bl VarGet
lsls r0, 16
lsrs r4, r0, 16
bl sub_81A513C
adds r1, r0, 0
_081A51E4:
cmp r5, 0
beq _081A51F4
cmp r5, 0x1
beq _081A5214
b _081A5228
.pool
_081A51F4:
ldr r0, =gStringVar4
ldr r2, =gUnknown_08611DB0
lsls r1, 2
adds r1, r2
ldr r2, [r1]
lsls r1, r4, 2
adds r1, r2
ldr r1, [r1]
bl StringCopy
b _081A5228
.pool
_081A5214:
ldr r0, =gStringVar4
ldr r2, =gUnknown_08611DB8
lsls r1, 2
adds r1, r2
ldr r2, [r1]
lsls r1, r4, 2
adds r1, r2
ldr r1, [r1]
bl StringCopy
_081A5228:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81A51A8
thumb_func_start sub_81A5238
sub_81A5238: @ 81A5238

View File

@ -18,5 +18,6 @@ u8 sub_81A6CA8(u8, u8);
void sub_81A3908(void);
u32 GetCurrentFacilityWinStreak(void);
void ClearnRankingHallRecords(void);
s32 GetFronterBrainSymbol(void);
#endif // GUARD_FRONTIER_UTIL_H

View File

@ -14,16 +14,16 @@ u8 sub_81850D0(void);
u8 sub_81850DC(u8 *arg0);
void sub_81851A8(u8 *arg0);
bool32 CanCopyRecordedBattleSaveData(void);
u32 MoveRecordedBattleToSaveData(void);
bool32 MoveRecordedBattleToSaveData(void);
void PlayRecordedBattle(void (*CB2_After)(void));
u8 GetRecordedBattleFrontierFacility(void);
u8 sub_8185EAC(void);
u8 GetRecordedBattleFronterBrainSymbol(void);
void RecordedBattle_SaveParties(void);
u8 GetActiveBattlerLinkPlayerGender(void);
void sub_8185F84(void);
void sub_8185F90(u16 arg0);
u8 sub_8185FAC(void);
u8 GetBattleStyleInRecordedBattle(void);
u8 GetBattleSceneInRecordedBattle(void);
u8 GetTextSpeedInRecordedBattle(void);
void RecordedBattle_CopyBattlerMoves(void);
void sub_818603C(u8 arg0);
@ -31,11 +31,11 @@ u32 GetAiScriptsInRecordedBattle(void);
void sub_8186444(void);
bool8 sub_8186450(void);
void sub_8186468(u8 *dst);
u8 sub_818649C(void);
u8 sub_81864A8(void);
u8 sub_81864B4(void);
u8 sub_81864C0(void);
void sub_81864CC(void);
u16 *sub_81864E0(void);
u8 GetRecordedBattleRecordMixFriendClass(void);
u8 GetRecordedBattleApprenticeId(void);
u8 GetRecordedBattleRecordMixFriendLanguage(void);
u8 GetRecordedBattleApprenticeLanguage(void);
void RecordedBattle_SaveBattleOutcome(void);
u16 *GetRecordedBattleEasyChatSpeech(void);
#endif // GUARD_RECORDED_BATTLE_H

View File

@ -3027,7 +3027,7 @@ static void BattleStartClearSetData(void)
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) && gSaveBlock2Ptr->optionsBattleSceneOff == TRUE)
gHitMarker |= HITMARKER_NO_ANIMATIONS;
}
else if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) && GetBattleStyleInRecordedBattle())
else if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) && GetBattleSceneInRecordedBattle())
gHitMarker |= HITMARKER_NO_ANIMATIONS;
gBattleScripting.battleStyle = gSaveBlock2Ptr->optionsBattleStyle;

View File

@ -769,14 +769,14 @@ u8 GetFrontierTrainerFrontSpriteId(u16 trainerId)
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
return gFacilityClassToPicIndex[sub_818649C()];
return gFacilityClassToPicIndex[GetRecordedBattleRecordMixFriendClass()];
else
return gFacilityClassToPicIndex[gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].facilityClass];
}
else
{
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
return gFacilityClassToPicIndex[gApprentices[sub_81864A8()].facilityClass];
return gFacilityClassToPicIndex[gApprentices[GetRecordedBattleApprenticeId()].facilityClass];
else
return gFacilityClassToPicIndex[gApprentices[gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].id].facilityClass];
}
@ -807,7 +807,7 @@ u8 GetFrontierOpponentClass(u16 trainerId)
{
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
{
trainerClass = gFacilityClassToTrainerClass[sub_818649C()];
trainerClass = gFacilityClassToTrainerClass[GetRecordedBattleRecordMixFriendClass()];
}
else
{
@ -819,7 +819,7 @@ u8 GetFrontierOpponentClass(u16 trainerId)
{
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
{
trainerClass = gFacilityClassToTrainerClass[gApprentices[sub_81864A8()].facilityClass];
trainerClass = gFacilityClassToTrainerClass[gApprentices[GetRecordedBattleApprenticeId()].facilityClass];
}
else
{
@ -847,14 +847,14 @@ static u8 GetFrontierTrainerFacilityClass(u16 trainerId)
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
facilityClass = sub_818649C();
facilityClass = GetRecordedBattleRecordMixFriendClass();
else
facilityClass = gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].facilityClass;
}
else
{
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
facilityClass = gApprentices[sub_81864A8()].facilityClass;
facilityClass = gApprentices[GetRecordedBattleApprenticeId()].facilityClass;
else
facilityClass = gApprentices[gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].id].facilityClass;
}
@ -907,8 +907,8 @@ void GetFrontierTrainerName(u8 *dst, u16 trainerId)
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
{
id = sub_81864A8();
language = sub_81864C0();
id = GetRecordedBattleApprenticeId();
language = GetRecordedBattleApprenticeLanguage();
}
else
{
@ -1297,7 +1297,7 @@ static void HandleSpecialTrainerBattleEnd(void)
{
s32 i;
sub_81864CC();
RecordedBattle_SaveBattleOutcome();
switch (gBattleScripting.specialTrainerBattleType)
{
case SPECIAL_BATTLE_TOWER:
@ -2527,14 +2527,14 @@ void GetBattleTowerTrainerLanguage(u8 *dst, u16 trainerId)
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
*dst = sub_81864B4();
*dst = GetRecordedBattleRecordMixFriendLanguage();
else
*dst = gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].language;
}
else
{
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
*dst = sub_81864C0();
*dst = GetRecordedBattleApprenticeLanguage();
else
*dst = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].language;
}

View File

@ -61,7 +61,7 @@ static void ShowArenaResultsWindow(void);
static void ShowPyramidResultsWindow(void);
static void ShowLinkContestResultsWindow(void);
u8 sub_81A3610(void);
void sub_81A51A8(u8);
static void CopyFrontierBrainText(bool8 playerWonText);
void sub_81A5030(u8);
// const rom data
@ -987,7 +987,7 @@ void CopyFrontierTrainerText(u8 whichText, u16 trainerId)
if (trainerId == TRAINER_EREADER)
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.greeting);
else if (trainerId == TRAINER_FRONTIER_BRAIN)
sub_81A51A8(0);
CopyFrontierBrainText(FALSE);
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
FrontierSpeechToString(gFacilityTrainers[trainerId].speechBefore);
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
@ -1002,7 +1002,7 @@ void CopyFrontierTrainerText(u8 whichText, u16 trainerId)
}
else if (trainerId == TRAINER_FRONTIER_BRAIN)
{
sub_81A51A8(0);
CopyFrontierBrainText(FALSE);
}
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{
@ -1011,14 +1011,14 @@ void CopyFrontierTrainerText(u8 whichText, u16 trainerId)
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
FrontierSpeechToString(sub_81864E0());
FrontierSpeechToString(GetRecordedBattleEasyChatSpeech());
else
FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].speechWon);
}
else
{
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
FrontierSpeechToString(sub_81864E0());
FrontierSpeechToString(GetRecordedBattleEasyChatSpeech());
else
FrontierSpeechToString(gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].easyChatWords);
}
@ -1030,7 +1030,7 @@ void CopyFrontierTrainerText(u8 whichText, u16 trainerId)
}
else if (trainerId == TRAINER_FRONTIER_BRAIN)
{
sub_81A51A8(1);
CopyFrontierBrainText(TRUE);
}
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{
@ -1039,7 +1039,7 @@ void CopyFrontierTrainerText(u8 whichText, u16 trainerId)
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
FrontierSpeechToString(sub_81864E0());
FrontierSpeechToString(GetRecordedBattleEasyChatSpeech());
else
FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].speechLost);
}
@ -1047,7 +1047,7 @@ void CopyFrontierTrainerText(u8 whichText, u16 trainerId)
{
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
{
trainerId = sub_81864A8();
trainerId = GetRecordedBattleApprenticeId();
FrontierSpeechToString(gApprentices[trainerId].easyChatWords);
}
else
@ -1766,8 +1766,6 @@ void SetFrontierBrainTrainerGfxId(void)
VarSet(VAR_OBJ_GFX_ID_0, gUnknown_08611C8C[facility][0]);
}
s32 sub_81A513C(void);
#define FRONTIER_BRAIN_OTID 61226
struct FrontierBrainMon
@ -1782,16 +1780,16 @@ struct FrontierBrainMon
extern const struct FrontierBrainMon sFrontierBrainsMons[][2][3];
/*
#ifdef NONMATCHING
void CreateFrontierBrainPokemon(void)
{
s32 i, j;
s32 monCountInBits;
s32 monPartyId;
s32 monLevel;
s32 monLevel = 0;
u8 friendship;
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
s32 symbol = sub_81A513C();
s32 symbol = GetFronterBrainSymbol();
if (facility == FRONTIER_FACILITY_DOME)
monCountInBits = GetTrainerMonCountInBits(TrainerIdToDomeTournamentId(TRAINER_FRONTIER_BRAIN));
@ -1831,4 +1829,327 @@ void CreateFrontierBrainPokemon(void)
monPartyId++;
}
}
*/
#else
NAKED
void CreateFrontierBrainPokemon(void)
{
asm_unified("\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x44\n\
ldr r0, =0x000040cf\n\
bl VarGet\n\
lsls r0, 16\n\
lsrs r0, 16\n\
str r0, [sp, 0x20]\n\
bl GetFronterBrainSymbol\n\
str r0, [sp, 0x24]\n\
ldr r0, [sp, 0x20]\n\
cmp r0, 0x1\n\
bne _081A4E44\n\
ldr r0, =0x000003fe\n\
bl TrainerIdToDomeTournamentId\n\
lsls r0, 16\n\
lsrs r0, 16\n\
bl GetTrainerMonCountInBits\n\
adds r4, r0, 0\n\
b _081A4E46\n\
.pool\n\
_081A4E44:\n\
movs r4, 0x7\n\
_081A4E46:\n\
bl ZeroEnemyPartyMons\n\
movs r1, 0\n\
str r1, [sp, 0x18]\n\
bl SetFacilityPtrsGetLevel\n\
lsls r0, 24\n\
lsrs r0, 24\n\
str r0, [sp, 0x1C]\n\
movs r2, 0\n\
str r2, [sp, 0x14]\n\
_081A4E5C:\n\
movs r0, 0x1\n\
ands r0, r4\n\
asrs r4, 1\n\
str r4, [sp, 0x30]\n\
ldr r3, [sp, 0x14]\n\
adds r3, 0x1\n\
str r3, [sp, 0x28]\n\
cmp r0, 0\n\
bne _081A4E70\n\
b _081A4FC4\n\
_081A4E70:\n\
ldr r4, [sp, 0x14]\n\
lsls r4, 2\n\
mov r9, r4\n\
ldr r0, [sp, 0x24]\n\
lsls r0, 4\n\
str r0, [sp, 0x38]\n\
ldr r1, [sp, 0x20]\n\
lsls r1, 4\n\
str r1, [sp, 0x34]\n\
ldr r2, [sp, 0x1C]\n\
lsls r2, 24\n\
str r2, [sp, 0x3C]\n\
ldr r3, [sp, 0x18]\n\
adds r3, 0x1\n\
str r3, [sp, 0x2C]\n\
ldr r0, [sp, 0x14]\n\
add r0, r9\n\
lsls r0, 2\n\
mov r8, r0\n\
_081A4E96:\n\
bl Random\n\
adds r4, r0, 0\n\
bl Random\n\
lsls r4, 16\n\
lsrs r7, r4, 16\n\
lsls r0, 16\n\
orrs r7, r0\n\
ldr r0, =0x0000ef2a\n\
adds r1, r7, 0\n\
bl IsShinyOtIdPersonality\n\
lsls r0, 24\n\
cmp r0, 0\n\
bne _081A4E96\n\
ldr r4, [sp, 0x38]\n\
ldr r1, [sp, 0x24]\n\
subs r0, r4, r1\n\
lsls r5, r0, 2\n\
mov r2, r8\n\
adds r4, r2, r5\n\
ldr r3, [sp, 0x34]\n\
ldr r1, [sp, 0x20]\n\
subs r0, r3, r1\n\
lsls r6, r0, 3\n\
adds r4, r6\n\
ldr r2, =sFrontierBrainsMons\n\
adds r4, r2\n\
adds r0, r7, 0\n\
bl GetNatureFromPersonality\n\
ldrb r1, [r4, 0x5]\n\
lsls r0, 24\n\
lsrs r0, 24\n\
cmp r1, r0\n\
bne _081A4E96\n\
ldr r4, [sp, 0x18]\n\
movs r0, 0x64\n\
adds r3, r4, 0\n\
muls r3, r0\n\
mov r8, r3\n\
ldr r1, =gEnemyParty\n\
add r1, r8\n\
mov r10, r1\n\
ldr r4, [sp, 0x14]\n\
add r4, r9\n\
lsls r4, 2\n\
adds r0, r4, r5\n\
adds r0, r6\n\
ldr r2, =sFrontierBrainsMons\n\
adds r0, r2\n\
ldrh r1, [r0]\n\
ldr r3, [sp, 0x3C]\n\
lsrs r2, r3, 24\n\
ldrb r3, [r0, 0x4]\n\
movs r0, 0x1\n\
str r0, [sp]\n\
str r7, [sp, 0x4]\n\
str r0, [sp, 0x8]\n\
ldr r0, =0x0000ef2a\n\
str r0, [sp, 0xC]\n\
mov r0, r10\n\
bl CreateMon\n\
ldr r0, =sFrontierBrainsMons\n\
adds r5, r0\n\
adds r5, r6, r5\n\
adds r4, r5, r4\n\
adds r4, 0x2\n\
mov r0, r10\n\
movs r1, 0xC\n\
adds r2, r4, 0\n\
bl SetMonData\n\
movs r7, 0\n\
mov r6, r8\n\
ldr r3, =gEnemyParty\n\
_081A4F32:\n\
adds r1, r7, 0\n\
adds r1, 0x1A\n\
ldr r0, [sp, 0x14]\n\
add r0, r9\n\
lsls r4, r0, 2\n\
adds r2, r5, r4\n\
adds r0, r7, 0x6\n\
adds r2, r0\n\
adds r0, r6, r3\n\
str r3, [sp, 0x40]\n\
bl SetMonData\n\
adds r7, 0x1\n\
ldr r3, [sp, 0x40]\n\
cmp r7, 0x5\n\
ble _081A4F32\n\
movs r1, 0xFF\n\
add r0, sp, 0x10\n\
strb r1, [r0]\n\
movs r7, 0\n\
ldr r1, [sp, 0x18]\n\
movs r2, 0x64\n\
adds r6, r1, 0\n\
muls r6, r2\n\
ldr r3, =gUnknown_08611578\n\
mov r8, r3\n\
ldr r3, =gEnemyParty\n\
adds r5, r4, 0\n\
_081A4F6A:\n\
ldr r4, [sp, 0x38]\n\
ldr r0, [sp, 0x24]\n\
subs r1, r4, r0\n\
lsls r1, 2\n\
adds r1, r5, r1\n\
ldr r2, [sp, 0x34]\n\
ldr r4, [sp, 0x20]\n\
subs r0, r2, r4\n\
lsls r0, 3\n\
adds r1, r0\n\
add r1, r8\n\
ldrh r4, [r1]\n\
lsls r2, r7, 24\n\
lsrs r2, 24\n\
adds r0, r6, r3\n\
adds r1, r4, 0\n\
str r3, [sp, 0x40]\n\
bl SetMonMoveSlot\n\
ldr r3, [sp, 0x40]\n\
cmp r4, 0xDA\n\
bne _081A4F9C\n\
movs r1, 0\n\
add r0, sp, 0x10\n\
strb r1, [r0]\n\
_081A4F9C:\n\
adds r5, 0x2\n\
adds r7, 0x1\n\
cmp r7, 0x3\n\
ble _081A4F6A\n\
ldr r0, [sp, 0x18]\n\
movs r1, 0x64\n\
adds r4, r0, 0\n\
muls r4, r1\n\
ldr r0, =gEnemyParty\n\
adds r4, r0\n\
adds r0, r4, 0\n\
movs r1, 0x20\n\
add r2, sp, 0x10\n\
bl SetMonData\n\
adds r0, r4, 0\n\
bl CalculateMonStats\n\
ldr r2, [sp, 0x2C]\n\
str r2, [sp, 0x18]\n\
_081A4FC4:\n\
ldr r4, [sp, 0x30]\n\
ldr r3, [sp, 0x28]\n\
str r3, [sp, 0x14]\n\
cmp r3, 0x2\n\
bgt _081A4FD0\n\
b _081A4E5C\n\
_081A4FD0:\n\
add sp, 0x44\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool\n\
");
}
#endif
u16 sub_81A4FF0(u8 monPartyId)
{
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
s32 symbol = GetFronterBrainSymbol();
return sFrontierBrainsMons[facility][symbol][monPartyId].species;
}
void sub_81A5030(u8 facility)
{
gTrainerBattleOpponent_A = TRAINER_FRONTIER_BRAIN;
VarSet(VAR_OBJ_GFX_ID_0, gUnknown_08611C8C[facility][0]);
}
u16 sub_81A5060(u8 monId, u8 moveSlotId)
{
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
s32 symbol = GetFronterBrainSymbol();
return sFrontierBrainsMons[facility][symbol][monId].moves[moveSlotId];
}
u8 sub_81A50B0(u8 monPartyId)
{
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
s32 symbol = GetFronterBrainSymbol();
return sFrontierBrainsMons[facility][symbol][monPartyId].nature;
}
u8 sub_81A50F0(u8 monId, u8 evStatId)
{
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
s32 symbol = GetFronterBrainSymbol();
return sFrontierBrainsMons[facility][symbol][monId].evs[evStatId];
}
s32 GetFronterBrainSymbol(void)
{
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
s32 symbol = sub_81A3B30(facility);
if (symbol == 2)
{
u16 winStreak = GetCurrentFacilityWinStreak();
if (winStreak + gUnknown_08611550[facility][3] == gUnknown_08611550[facility][0])
symbol = 0;
else if (winStreak + gUnknown_08611550[facility][3] == gUnknown_08611550[facility][1])
symbol = 1;
else if (winStreak + gUnknown_08611550[facility][3] > gUnknown_08611550[facility][1]
&& (winStreak + gUnknown_08611550[facility][3] - gUnknown_08611550[facility][1]) % gUnknown_08611550[facility][2] == 0)
symbol = 1;
}
return symbol;
}
extern const u8 *const *const gUnknown_08611DB0[];
extern const u8 *const *const gUnknown_08611DB8[];
static void CopyFrontierBrainText(bool8 playerWonText)
{
s32 facility;
s32 symbol;
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
{
facility = GetRecordedBattleFrontierFacility();
symbol = GetRecordedBattleFronterBrainSymbol();
}
else
{
facility = VarGet(VAR_FRONTIER_FACILITY);
symbol = GetFronterBrainSymbol();
}
switch (playerWonText)
{
case FALSE:
StringCopy(gStringVar4, gUnknown_08611DB0[symbol][facility]);
break;
case TRUE:
StringCopy(gStringVar4, gUnknown_08611DB8[symbol][facility]);
break;
}
}

File diff suppressed because it is too large Load Diff