mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-26 21:33:53 +01:00
more tower, fail
This commit is contained in:
parent
16026fe91d
commit
0ab27e44b1
@ -3600,7 +3600,7 @@ _081A370C:
|
||||
ldr r0, [r2]
|
||||
adds r0, r1
|
||||
adds r0, 0xC
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
b _081A38F8
|
||||
.pool
|
||||
_081A3738:
|
||||
@ -3652,7 +3652,7 @@ _081A3794:
|
||||
ldr r0, [r2]
|
||||
adds r0, r1
|
||||
adds r0, 0x18
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
b _081A38F8
|
||||
.pool
|
||||
_081A37B8:
|
||||
@ -3720,7 +3720,7 @@ _081A3844:
|
||||
ldr r0, [r2]
|
||||
adds r0, r1
|
||||
adds r0, 0x24
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
b _081A38F8
|
||||
.pool
|
||||
_081A3868:
|
||||
@ -3736,7 +3736,7 @@ _081A3868:
|
||||
beq _081A3890
|
||||
_081A387C:
|
||||
bl sub_81864E0
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
b _081A38F8
|
||||
.pool
|
||||
_081A3890:
|
||||
@ -3764,7 +3764,7 @@ _081A38A8:
|
||||
ldr r1, =gApprentices+0x4A
|
||||
_081A38C4:
|
||||
adds r0, r1
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
b _081A38F8
|
||||
.pool
|
||||
_081A38D4:
|
||||
@ -3784,7 +3784,7 @@ _081A38D4:
|
||||
muls r0, r3
|
||||
ldr r1, =gApprentices+0x4A
|
||||
adds r0, r1
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
_081A38F8:
|
||||
pop {r0}
|
||||
bx r0
|
||||
@ -10896,7 +10896,7 @@ _081A7560:
|
||||
lsls r0, 2
|
||||
ldr r1, =gUnknown_086123E4
|
||||
adds r0, r1
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
@ -12875,7 +12875,7 @@ sub_81A84EC: @ 81A84EC
|
||||
ldr r0, [r2]
|
||||
adds r0, r1
|
||||
adds r0, 0xC
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
b _081A8542
|
||||
.pool
|
||||
_081A8524:
|
||||
@ -12892,7 +12892,7 @@ _081A8524:
|
||||
ldr r0, [r2]
|
||||
adds r0, r1
|
||||
adds r0, 0xC
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
_081A8542:
|
||||
pop {r0}
|
||||
bx r0
|
||||
@ -16003,7 +16003,7 @@ sub_81A9EDC: @ 81A9EDC
|
||||
ldr r0, [r2]
|
||||
adds r0, r1
|
||||
adds r0, 0xC
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
@ -16020,7 +16020,7 @@ sub_81A9EFC: @ 81A9EFC
|
||||
ldr r0, [r2]
|
||||
adds r0, r1
|
||||
adds r0, 0x18
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
@ -16037,7 +16037,7 @@ sub_81A9F1C: @ 81A9F1C
|
||||
ldr r0, [r2]
|
||||
adds r0, r1
|
||||
adds r0, 0x24
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
|
1526
asm/battle_tower.s
1526
asm/battle_tower.s
File diff suppressed because it is too large
Load Diff
@ -28371,7 +28371,7 @@ _081D5764:
|
||||
adds r1, 0x4
|
||||
adds r0, r1
|
||||
adds r0, 0x10
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
b _081D580E
|
||||
.pool
|
||||
_081D5790:
|
||||
@ -28392,7 +28392,7 @@ _081D5790:
|
||||
adds r1, 0x4
|
||||
adds r0, r1
|
||||
adds r0, 0x1C
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
b _081D580E
|
||||
.pool
|
||||
_081D57BC:
|
||||
@ -28413,7 +28413,7 @@ _081D57BC:
|
||||
adds r1, 0x4
|
||||
adds r0, r1
|
||||
adds r0, 0x28
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
b _081D580E
|
||||
.pool
|
||||
_081D57E8:
|
||||
@ -28434,7 +28434,7 @@ _081D57E8:
|
||||
adds r1, 0x4
|
||||
adds r0, r1
|
||||
adds r0, 0x34
|
||||
bl ConvertBattleFrontierTrainerSpeechToString
|
||||
bl FrontierSpeechToString
|
||||
_081D580E:
|
||||
bl sub_81D5710
|
||||
pop {r4-r6}
|
||||
|
@ -686,7 +686,7 @@ gUnknown_085DF96C:: @ 85DF96C
|
||||
.4byte ChooseNextBattleTowerTrainer
|
||||
.4byte sub_81621C0
|
||||
.4byte sub_816502C
|
||||
.4byte sub_8164040
|
||||
.4byte SaveBattleTowerProgress
|
||||
.4byte sub_8163914
|
||||
.4byte nullsub_61
|
||||
.4byte nullsub_116
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "constants/vars.h"
|
||||
#include "constants/heal_locations.h"
|
||||
#include "constants/trainers.h"
|
||||
#include "constants/battle_frontier.h"
|
||||
.include "asm/macros.inc"
|
||||
.include "asm/macros/event.inc"
|
||||
.include "constants/constants.inc"
|
||||
@ -5126,9 +5127,9 @@ SecretBase_RedCave1_EventScript_27627C:: @ 827627C
|
||||
|
||||
SecretBase_RedCave1_EventScript_276286:: @ 8276286
|
||||
special sub_80EA2E4
|
||||
setvar VAR_0x8004, 1
|
||||
setvar VAR_0x8004, SPECIAL_BATTLE_SECRET_BASE
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8163AC4
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
compare VAR_RESULT, 3
|
||||
call_if 1, SecretBase_RedCave1_EventScript_2762BD
|
||||
|
@ -89,7 +89,7 @@ BattleFrontier_BattleArenaBattleRoom_EventScript_25752E:: @ 825752E
|
||||
waitmovement 0
|
||||
setvar VAR_0x8004, 5
|
||||
special sub_8195960
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
waitmessage
|
||||
call BattleFrontier_BattleArenaBattleRoom_EventScript_257B6C
|
||||
switch VAR_RESULT
|
||||
@ -431,9 +431,9 @@ FallarborTown_BattleTentBattleRoom_EventScript_257B6C:: @ 8257B6C
|
||||
setvar VAR_0x8006, 0
|
||||
special sub_81A1780
|
||||
special HealPlayerParty
|
||||
setvar VAR_0x8004, 5
|
||||
setvar VAR_0x8004, SPECIAL_BATTLE_ARENA
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8163AC4
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
setvar VAR_0x8004, 18
|
||||
special sub_81A1780
|
||||
|
@ -81,7 +81,7 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_24BD82:: @ 824BD82
|
||||
setvar VAR_0x8004, 7
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8161F74
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
closemessage
|
||||
setvar VAR_0x8004, 5
|
||||
special CallBattleDomeFunction
|
||||
@ -529,10 +529,10 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_24C440:: @ 824C440
|
||||
setvar VAR_0x8006, 0
|
||||
special sub_81A1780
|
||||
special HealPlayerParty
|
||||
setvar VAR_0x8004, 3
|
||||
setvar VAR_0x8004, SPECIAL_BATTLE_DOME
|
||||
setvar VAR_0x8005, 0
|
||||
setvar VAR_TEMP_9, 1
|
||||
special sub_8163AC4
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
setvar VAR_TEMP_9, 0
|
||||
setvar VAR_0x8004, 17
|
||||
|
@ -82,7 +82,7 @@ BattleFrontier_BattleFactoryBattleRoom_EventScript_25AEA7:: @ 825AEA7
|
||||
setvar VAR_0x8004, 5
|
||||
special sub_8195960
|
||||
lockall
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
waitmessage
|
||||
closemessage
|
||||
setvar VAR_0x8004, 2
|
||||
@ -90,9 +90,9 @@ BattleFrontier_BattleFactoryBattleRoom_EventScript_25AEA7:: @ 825AEA7
|
||||
setvar VAR_0x8006, 0
|
||||
special sub_81A1780
|
||||
special HealPlayerParty
|
||||
setvar VAR_0x8004, 6
|
||||
setvar VAR_0x8004, SPECIAL_BATTLE_FACTORY
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8163AC4
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
switch VAR_RESULT
|
||||
case 1, BattleFrontier_BattleFactoryBattleRoom_EventScript_25AF0F
|
||||
@ -226,9 +226,9 @@ BattleFrontier_BattleFactoryBattleRoom_EventScript_25B0E0:: @ 825B0E0
|
||||
setvar VAR_0x8006, 0
|
||||
special sub_81A1780
|
||||
special HealPlayerParty
|
||||
setvar VAR_0x8004, 6
|
||||
setvar VAR_0x8004, SPECIAL_BATTLE_FACTORY
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8163AC4
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
return
|
||||
|
||||
|
@ -61,7 +61,7 @@ BattleFrontier_BattlePalaceBattleRoom_EventScript_24F8BF:: @ 824F8BF
|
||||
waitmovement 0
|
||||
setvar VAR_0x8004, 5
|
||||
special sub_8195960
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
waitmessage
|
||||
call BattleFrontier_BattlePalaceBattleRoom_EventScript_24FDF7
|
||||
switch VAR_RESULT
|
||||
@ -338,9 +338,9 @@ VerdanturfTown_BattleTentBattleRoom_EventScript_24FDF7:: @ 824FDF7
|
||||
setvar VAR_0x8006, 0
|
||||
special sub_81A1780
|
||||
special HealPlayerParty
|
||||
setvar VAR_0x8004, 4
|
||||
setvar VAR_0x8004, SPECIAL_BATTLE_PALACE
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8163AC4
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
setvar VAR_0x8004, 18
|
||||
special sub_81A1780
|
||||
|
@ -30,13 +30,13 @@ BattleFrontier_BattlePikeRandomRoom1_EventScript_25D1C6:: @ 825D1C6
|
||||
setvar VAR_0x8004, 21
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_81A703C
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
waitmessage
|
||||
closemessage
|
||||
releaseall
|
||||
setvar VAR_0x8004, 7
|
||||
setvar VAR_0x8004, SPECIAL_BATTLE_PIKE_SINGLE
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8163AC4
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
switch VAR_RESULT
|
||||
case 1, BattleFrontier_BattlePikeRandomRoom1_EventScript_25D226
|
||||
@ -66,13 +66,13 @@ BattleFrontier_BattlePikeRandomRoom1_EventScript_25D231:: @ 825D231
|
||||
setvar VAR_0x8004, 21
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_81A703C
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
waitmessage
|
||||
closemessage
|
||||
releaseall
|
||||
setvar VAR_0x8004, 7
|
||||
setvar VAR_0x8004, SPECIAL_BATTLE_PIKE_SINGLE
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8163AC4
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
switch VAR_RESULT
|
||||
case 1, BattleFrontier_BattlePikeRandomRoom1_EventScript_25D285
|
||||
@ -282,7 +282,7 @@ BattleFrontier_BattlePikeRandomRoom1_EventScript_25D53E:: @ 825D53E
|
||||
setvar VAR_0x8004, 21
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_81A703C
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
closemessage
|
||||
delay 16
|
||||
applymovement 255, BattleFrontier_BattlePikeRandomRoom1_Movement_25D7BD
|
||||
@ -290,11 +290,11 @@ BattleFrontier_BattlePikeRandomRoom1_EventScript_25D53E:: @ 825D53E
|
||||
setvar VAR_0x8004, 21
|
||||
setvar VAR_0x8005, 1
|
||||
special sub_81A703C
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
closemessage
|
||||
setvar VAR_0x8004, 9
|
||||
setvar VAR_0x8004, SPECIAL_BATTLE_PIKE_DOUBLE
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8163AC4
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
switch VAR_RESULT
|
||||
case 1, BattleFrontier_BattlePikeRandomRoom1_EventScript_25D5DC
|
||||
@ -433,9 +433,9 @@ BattleFrontier_BattlePikeRandomRoom1_EventScript_25D77B:: @ 825D77B
|
||||
closemessage
|
||||
applymovement 255, BattleFrontier_BattlePikeRandomRoom1_Movement_25D7DC
|
||||
waitmovement 0
|
||||
setvar VAR_0x8004, 7
|
||||
setvar VAR_0x8004, SPECIAL_BATTLE_PIKE_SINGLE
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8163AC4
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
return
|
||||
|
||||
@ -590,7 +590,7 @@ BattleFrontier_BattlePikeRandomRoom1_EventScript_25D81B:: @ 825D81B
|
||||
faceplayer
|
||||
setvar VAR_0x8004, 14
|
||||
special sub_81A703C
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
waitmessage
|
||||
closemessage
|
||||
release
|
||||
|
@ -228,9 +228,9 @@ BattleFrontier_BattlePyramidTop_EventScript_2553B3:: @ 82553B3
|
||||
|
||||
BattleFrontier_BattlePyramidTop_EventScript_2553ED:: @ 82553ED
|
||||
closemessage
|
||||
setvar VAR_0x8004, 10
|
||||
setvar VAR_0x8004, SPECIAL_BATTLE_PYRAMID
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8163AC4
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
return
|
||||
|
||||
|
@ -45,7 +45,7 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_241BC3:: @ 8241BC3
|
||||
setvar VAR_0x8004, 7
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8161F74
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
waitmessage
|
||||
call BattleFrontier_BattleTowerBattleRoom_EventScript_24210E
|
||||
switch VAR_RESULT
|
||||
@ -362,9 +362,9 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_24210E:: @ 824210E
|
||||
setvar VAR_0x8006, 0
|
||||
special sub_81A1780
|
||||
special HealPlayerParty
|
||||
setvar VAR_0x8004, 0
|
||||
setvar VAR_0x8004, SPECIAL_BATTLE_TOWER
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8163AC4
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
copyvar VAR_0x8004, VAR_FRONTIER_BATTLE_MODE
|
||||
compare VAR_0x8004, 3
|
||||
|
@ -78,14 +78,14 @@ BattleFrontier_BattleTowerBattleRoom2_EventScript_248FB4:: @ 8248FB4
|
||||
delay 15
|
||||
applymovement 1, BattleFrontier_BattleTowerBattleRoom2_Movement_249545
|
||||
waitmovement 0
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
waitmessage
|
||||
setvar VAR_0x8004, 7
|
||||
setvar VAR_0x8005, 1
|
||||
special sub_8161F74
|
||||
applymovement 4, BattleFrontier_BattleTowerBattleRoom2_Movement_249545
|
||||
waitmovement 0
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
waitmessage
|
||||
goto BattleFrontier_BattleTowerBattleRoom2_EventScript_249069
|
||||
|
||||
|
@ -54,7 +54,7 @@ FallarborTown_BattleTentBattleRoom_EventScript_20090F:: @ 820090F
|
||||
msgbox FallarborTown_BattleTentBattleRoom_Text_257C93, 4
|
||||
setvar VAR_0x8004, 4
|
||||
special sub_81B99B4
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
waitmessage
|
||||
call FallarborTown_BattleTentBattleRoom_EventScript_257B6C
|
||||
switch VAR_RESULT
|
||||
|
@ -264,9 +264,9 @@ MossdeepCity_SpaceCenter_2F_EventScript_224032:: @ 8224032
|
||||
setvar VAR_0x8004, 2
|
||||
setvar VAR_0x8005, 4
|
||||
special sub_81A1780
|
||||
setvar VAR_0x8004, 8
|
||||
setvar VAR_0x8004, SPECIAL_BATTLE_STEVEN
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8163AC4
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
setvar VAR_0x8004, 6
|
||||
special sub_81A1780
|
||||
|
@ -51,13 +51,13 @@ SlateportCity_BattleTentBattleRoom_EventScript_2099BE:: @ 82099BE
|
||||
setvar VAR_0x8004, 4
|
||||
special sub_81B99B4
|
||||
lockall
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
waitmessage
|
||||
closemessage
|
||||
special HealPlayerParty
|
||||
setvar VAR_0x8004, 6
|
||||
setvar VAR_0x8004, SPECIAL_BATTLE_FACTORY
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8163AC4
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
switch VAR_RESULT
|
||||
case 1, SlateportCity_BattleTentBattleRoom_EventScript_209A39
|
||||
|
@ -16,11 +16,11 @@ SootopolisCity_MysteryEventsHouse_B1F_EventScript_227E68:: @ 8227E68
|
||||
applymovement 255, SootopolisCity_MysteryEventsHouse_B1F_Movement_227EF3
|
||||
waitmovement 0
|
||||
special sub_8165360
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
closemessage
|
||||
setvar VAR_0x8004, 2
|
||||
setvar VAR_0x8004, SPECIAL_BATTLE_EREADER
|
||||
setvar VAR_0x8005, 0
|
||||
special sub_8163AC4
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
compare VAR_RESULT, 3
|
||||
call_if 1, SootopolisCity_MysteryEventsHouse_B1F_EventScript_227ECF
|
||||
|
@ -48,7 +48,7 @@ VerdanturfTown_BattleTentBattleRoom_EventScript_20236F:: @ 820236F
|
||||
waitmovement 0
|
||||
setvar VAR_0x8004, 4
|
||||
special sub_81B99B4
|
||||
msgbox 0x2021fc4, 4
|
||||
msgbox gStringVar4, 4
|
||||
waitmessage
|
||||
call VerdanturfTown_BattleTentBattleRoom_EventScript_24FDF7
|
||||
switch VAR_RESULT
|
||||
|
@ -247,7 +247,7 @@ gSpecials:: @ 81DBA64
|
||||
def_special CallBattleDomeFunction
|
||||
def_special sub_8195960
|
||||
def_special sub_8165360
|
||||
def_special sub_8163AC4
|
||||
def_special DoSpecialTrainerBattle
|
||||
def_special sub_81A5238
|
||||
def_special sub_81A5E74
|
||||
def_special sub_81A703C
|
||||
|
@ -561,6 +561,7 @@ struct BattleScripting
|
||||
u8 field_23;
|
||||
u8 windowsType; // 0 - normal, 1 - battle arena
|
||||
u8 multiplayerId;
|
||||
u8 specialTrainerBattleType;
|
||||
};
|
||||
|
||||
// rom_80A5C6C
|
||||
|
@ -58,7 +58,7 @@ bool32 sub_816587C(union BattleTowerRecord *, union BattleTowerRecord *);
|
||||
void CalcEmeraldBattleTowerChecksum(struct EmeraldBattleTowerRecord *);
|
||||
void PutNewBattleTowerRecord(union BattleTowerRecord *);
|
||||
void SetBattleFacilityTrainerGfxId(u16 trainerId, u8 tempVarId);
|
||||
void ConvertBattleFrontierTrainerSpeechToString(const u16 *words);
|
||||
void FrontierSpeechToString(const u16 *words);
|
||||
void GetFrontierTrainerName(u8 *dest, u16 trainerIdx);
|
||||
void GetEreaderTrainerName(u8 *dest);
|
||||
|
||||
|
@ -21,4 +21,17 @@
|
||||
#define FRONTIER_MODE_MULTIS 2
|
||||
#define FRONTIER_MODE_LINK_MULTIS 3
|
||||
|
||||
// Special trainer battles.
|
||||
#define SPECIAL_BATTLE_TOWER 0
|
||||
#define SPECIAL_BATTLE_SECRET_BASE 1
|
||||
#define SPECIAL_BATTLE_EREADER 2
|
||||
#define SPECIAL_BATTLE_DOME 3
|
||||
#define SPECIAL_BATTLE_PALACE 4
|
||||
#define SPECIAL_BATTLE_ARENA 5
|
||||
#define SPECIAL_BATTLE_FACTORY 6
|
||||
#define SPECIAL_BATTLE_PIKE_SINGLE 7
|
||||
#define SPECIAL_BATTLE_STEVEN 8
|
||||
#define SPECIAL_BATTLE_PIKE_DOUBLE 9
|
||||
#define SPECIAL_BATTLE_PYRAMID 10
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_FRONTIER_H
|
||||
|
@ -11,9 +11,9 @@
|
||||
#define sB_ANIM_ARG2 gBattleScripting + 0x11
|
||||
#define sTRIPLE_KICK_POWER gBattleScripting + 0x12
|
||||
#define sMOVEEND_STATE gBattleScripting + 0x14
|
||||
#define sBANK_WITH_ABILITY gBattleScripting + 0x15
|
||||
#define sBATTLER_WITH_ABILITY gBattleScripting + 0x15
|
||||
#define sMULTIHIT_EFFECT gBattleScripting + 0x16
|
||||
#define sBANK gBattleScripting + 0x17
|
||||
#define sBATTLER gBattleScripting + 0x17
|
||||
#define sB_ANIM_TURN gBattleScripting + 0x18
|
||||
#define sB_ANIM_TARGETS_HIT gBattleScripting + 0x19
|
||||
#define sSTATCHANGER gBattleScripting + 0x1A
|
||||
@ -26,8 +26,9 @@
|
||||
#define sRESHOW_MAIN_STATE gBattleScripting + 0x21
|
||||
#define sRESHOW_HELPER_STATE gBattleScripting + 0x22
|
||||
#define sFIELD_23 gBattleScripting + 0x23
|
||||
#define sFIELD_24 gBattleScripting + 0x24
|
||||
#define sWINDOWS_TYPE gBattleScripting + 0x24
|
||||
#define sMULTIPLAYER_ID gBattleScripting + 0x25
|
||||
#define sSPECIAL_TRAINER_BATTLE_TYPE gBattleScripting + 0x26
|
||||
|
||||
#define cEFFECT_CHOOSER gBattleCommunication + 3
|
||||
#define cMULTISTRING_CHOOSER gBattleCommunication + 5
|
||||
|
@ -331,7 +331,8 @@ struct EmeraldBattleTowerRecord
|
||||
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
|
||||
/*0x0C*/ u8 trainerId[4];
|
||||
/*0x10*/ u16 greeting[6];
|
||||
/*0x1C*/ u8 filler_1c[0x18];
|
||||
/*0x1C*/ u16 unk1C[6];
|
||||
/*0x28*/ u16 unk28[6];
|
||||
/*0x34*/ struct UnknownPokemonStruct party[4];
|
||||
/*0xE4*/ u8 language;
|
||||
/*0xE8*/ u32 checksum;
|
||||
@ -378,8 +379,8 @@ struct BattleDomeTrainer
|
||||
|
||||
struct BattleFrontier
|
||||
{
|
||||
/*0x64C*/ struct EmeraldBattleTowerRecord battleTower;
|
||||
/*0x738*/ struct EmeraldBattleTowerRecord records[5]; // From record mixing.
|
||||
/*0x64C*/ struct EmeraldBattleTowerRecord towerPlayer;
|
||||
/*0x738*/ struct EmeraldBattleTowerRecord towerRecords[5]; // From record mixing.
|
||||
/*0xBD4*/ u16 field_BD4;
|
||||
/*0xBD6*/ u16 field_BD6;
|
||||
/*0xBD8*/ u8 field_BD8[11];
|
||||
@ -397,7 +398,10 @@ struct BattleFrontier
|
||||
/*0xCAA*/ u16 field_CAA[3];
|
||||
/*0xCB0*/ u16 field_CB0;
|
||||
/*0xCB2*/ u16 curChallengeBattleNum; // In case of battle pyramid, the floor.
|
||||
/*0xCB4*/ u16 battledTrainerIds[20];
|
||||
/*0xCB4*/ u16 battledTrainerIds[17];
|
||||
u16 field_CD6;
|
||||
u16 field_CD8;
|
||||
u16 field_CDA;
|
||||
/*0xCDC*/ u32 field_CDC;
|
||||
/*0xCE0*/ u16 field_CE0[4][2];
|
||||
/*0xCF0*/ u16 field_CF0[2];
|
||||
@ -457,10 +461,7 @@ struct BattleFrontier
|
||||
/*0xEB8*/ u16 frontierBattlePoints;
|
||||
/*0xEBA*/ u8 field_EBA;
|
||||
/*0xEBB*/ u8 field_EBB;
|
||||
/*0xEBC*/ u8 field_EBC;
|
||||
/*0xEBD*/ u8 field_EBD;
|
||||
/*0xEBE*/ u8 field_EBE;
|
||||
/*0xEBF*/ u8 field_EBF;
|
||||
/*0xEBC*/ u32 battlesCount;
|
||||
/*0xEC0*/ u16 field_EC0[16];
|
||||
/*0xEE0*/ u8 field_EE0;
|
||||
/*0xEE1*/ u8 field_EE1[2][PLAYER_NAME_LENGTH + 1];
|
||||
|
@ -1970,7 +1970,7 @@ static void sub_81A0FFC(void)
|
||||
StringCopy(stringDst, gText_OpenLevel);
|
||||
break;
|
||||
case APPRENTICE_BUFF_EASY_CHAT:
|
||||
ConvertBattleFrontierTrainerSpeechToString(gSaveBlock2Ptr->apprentices[0].easyChatWords);
|
||||
FrontierSpeechToString(gSaveBlock2Ptr->apprentices[0].easyChatWords);
|
||||
StringCopy(stringDst, gStringVar4);
|
||||
break;
|
||||
case APPRENTICE_BUFF_SPECIES4:
|
||||
|
@ -96,7 +96,7 @@ void sub_8195C20(void)
|
||||
void sub_8195C50(void)
|
||||
{
|
||||
if (gTrainerBattleOpponent_A < 300)
|
||||
ConvertBattleFrontierTrainerSpeechToString(gFacilityTrainers[gTrainerBattleOpponent_A].speechBefore);
|
||||
FrontierSpeechToString(gFacilityTrainers[gTrainerBattleOpponent_A].speechBefore);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -126,7 +126,7 @@ static void sub_81B9A60(void)
|
||||
static void sub_81B9A90(void)
|
||||
{
|
||||
if (gTrainerBattleOpponent_A < 300)
|
||||
ConvertBattleFrontierTrainerSpeechToString(gFacilityTrainers[gTrainerBattleOpponent_A].speechBefore);
|
||||
FrontierSpeechToString(gFacilityTrainers[gTrainerBattleOpponent_A].speechBefore);
|
||||
}
|
||||
|
||||
static void sub_81B9ABC(void)
|
||||
|
@ -6,12 +6,18 @@
|
||||
#include "overworld.h"
|
||||
#include "random.h"
|
||||
#include "text.h"
|
||||
#include "main.h"
|
||||
#include "international_string_util.h"
|
||||
#include "battle.h"
|
||||
#include "battle_frontier_1.h"
|
||||
#include "battle_frontier_2.h"
|
||||
#include "recorded_battle.h"
|
||||
#include "easy_chat.h"
|
||||
#include "gym_leader_rematch.h"
|
||||
#include "battle_transition.h"
|
||||
#include "trainer_see.h"
|
||||
#include "new_game.h"
|
||||
#include "string_util.h"
|
||||
#include "constants/battle_frontier.h"
|
||||
#include "constants/trainers.h"
|
||||
#include "constants/event_objects.h"
|
||||
@ -39,9 +45,11 @@ extern const u16 gBattleFrontierHeldItems[];
|
||||
|
||||
// This file's functions.
|
||||
void sub_8164ED8(void);
|
||||
void sub_8163E90(void);
|
||||
void SaveCurrentWinStreak(void);
|
||||
void sub_8165B20(void);
|
||||
void sub_8165E18(void);
|
||||
void sub_816537C(void);
|
||||
void sub_8164FB8(struct EmeraldBattleTowerRecord *record);
|
||||
u16 GetCurrentBattleTowerWinStreak(u8 lvlMode, u8 battleMode);
|
||||
void sub_816534C(void *);
|
||||
u16 sub_8162548(u8, u8);
|
||||
@ -50,6 +58,7 @@ void sub_8165EA4(u16 trainerId, u8 firstMonId, u8 monCount);
|
||||
void sub_81635D4(u16 trainerId, u8 firstMonId);
|
||||
void sub_816379C(u16 trainerId, u8 firstMonId);
|
||||
u8 GetFrontierTrainerFixedIvs(u16 trainerId);
|
||||
void sub_8165404(u16 trainerId);
|
||||
|
||||
// code
|
||||
void sub_8161F74(void)
|
||||
@ -129,7 +138,7 @@ void sub_81621C0(void)
|
||||
gSaveBlock2Ptr->frontier.field_D04++;
|
||||
|
||||
gSaveBlock2Ptr->frontier.curChallengeBattleNum++;
|
||||
sub_8163E90();
|
||||
SaveCurrentWinStreak();
|
||||
gSpecialVar_Result = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
|
||||
}
|
||||
|
||||
@ -148,7 +157,7 @@ bool8 ChooseSpecialBattleTowerTrainer(void)
|
||||
winStreak = GetCurrentBattleTowerWinStreak(lvlMode, battleMode);
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
u32 *record = (u32*)(&gSaveBlock2Ptr->frontier.records[i]);
|
||||
u32 *record = (u32*)(&gSaveBlock2Ptr->frontier.towerRecords[i]);
|
||||
u32 recordHasData = 0;
|
||||
u32 checksum = 0;
|
||||
for (j = 0; j < (sizeof(struct EmeraldBattleTowerRecord) - 4) / 4; j++) // - 4, because of the last field being the checksum itself.
|
||||
@ -159,16 +168,16 @@ bool8 ChooseSpecialBattleTowerTrainer(void)
|
||||
validMons = 0;
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.records[i].party[j].species != 0
|
||||
&& gSaveBlock2Ptr->frontier.records[i].party[j].level <= GetFrontierEnemyMonLevel(lvlMode))
|
||||
if (gSaveBlock2Ptr->frontier.towerRecords[i].party[j].species != 0
|
||||
&& gSaveBlock2Ptr->frontier.towerRecords[i].party[j].level <= GetFrontierEnemyMonLevel(lvlMode))
|
||||
validMons++;
|
||||
}
|
||||
|
||||
if (validMons >= gUnknown_085DF9F6[battleMode]
|
||||
&& gSaveBlock2Ptr->frontier.records[i].winStreak == winStreak
|
||||
&& gSaveBlock2Ptr->frontier.records[i].lvlMode == lvlMode
|
||||
&& gSaveBlock2Ptr->frontier.towerRecords[i].winStreak == winStreak
|
||||
&& gSaveBlock2Ptr->frontier.towerRecords[i].lvlMode == lvlMode
|
||||
&& recordHasData
|
||||
&& gSaveBlock2Ptr->frontier.records[i].checksum == checksum)
|
||||
&& gSaveBlock2Ptr->frontier.towerRecords[i].checksum == checksum)
|
||||
{
|
||||
trainerIds[idsCount] = i + BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID;
|
||||
idsCount++;
|
||||
@ -385,7 +394,7 @@ void SetBattleFacilityTrainerGfxId(u16 trainerId, u8 tempVarId)
|
||||
}
|
||||
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID)
|
||||
{
|
||||
facilityClass = gSaveBlock2Ptr->frontier.records[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass;
|
||||
facilityClass = gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -477,7 +486,7 @@ u8 GetBattleFacilityTrainerGfxId(u16 trainerId)
|
||||
}
|
||||
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID)
|
||||
{
|
||||
facilityClass = gSaveBlock2Ptr->frontier.records[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass;
|
||||
facilityClass = gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -527,7 +536,7 @@ void PutNewBattleTowerRecord(union BattleTowerRecord *newRecord)
|
||||
k = 0;
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.records[i].trainerId[j] != newRecordEm->trainerId[j])
|
||||
if (gSaveBlock2Ptr->frontier.towerRecords[i].trainerId[j] != newRecordEm->trainerId[j])
|
||||
break;
|
||||
}
|
||||
if (j == 4)
|
||||
@ -535,7 +544,7 @@ void PutNewBattleTowerRecord(union BattleTowerRecord *newRecord)
|
||||
for (k = 0; k < PLAYER_NAME_LENGTH; k++)
|
||||
{
|
||||
// BUG: Wrong variable used, 'j' instead of 'k'.
|
||||
if (gSaveBlock2Ptr->frontier.records[i].name[j] != newRecordEm->name[j])
|
||||
if (gSaveBlock2Ptr->frontier.towerRecords[i].name[j] != newRecordEm->name[j])
|
||||
break;
|
||||
if (newRecordEm->name[j] == EOS)
|
||||
{
|
||||
@ -550,24 +559,24 @@ void PutNewBattleTowerRecord(union BattleTowerRecord *newRecord)
|
||||
}
|
||||
if (i < 5)
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.records[i] = *newRecordEm;
|
||||
gSaveBlock2Ptr->frontier.towerRecords[i] = *newRecordEm;
|
||||
return;
|
||||
}
|
||||
|
||||
// Find an empty record slot.
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.records[i].winStreak == 0)
|
||||
if (gSaveBlock2Ptr->frontier.towerRecords[i].winStreak == 0)
|
||||
break;
|
||||
}
|
||||
if (i < 5)
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.records[i] = *newRecordEm;
|
||||
gSaveBlock2Ptr->frontier.towerRecords[i] = *newRecordEm;
|
||||
return;
|
||||
}
|
||||
|
||||
// Find possible slots to replace the record.
|
||||
slotValues[0] = gSaveBlock2Ptr->frontier.records[0].winStreak;
|
||||
slotValues[0] = gSaveBlock2Ptr->frontier.towerRecords[0].winStreak;
|
||||
slotIds[0] = 0;
|
||||
slotsCount++;
|
||||
|
||||
@ -575,15 +584,15 @@ void PutNewBattleTowerRecord(union BattleTowerRecord *newRecord)
|
||||
{
|
||||
for (j = 0; j < slotsCount; j++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.records[i].winStreak < slotValues[j])
|
||||
if (gSaveBlock2Ptr->frontier.towerRecords[i].winStreak < slotValues[j])
|
||||
{
|
||||
j = 0;
|
||||
slotsCount = 1;
|
||||
slotValues[0] = gSaveBlock2Ptr->frontier.records[i].winStreak;
|
||||
slotValues[0] = gSaveBlock2Ptr->frontier.towerRecords[i].winStreak;
|
||||
slotIds[0] = i;
|
||||
break;
|
||||
}
|
||||
else if (gSaveBlock2Ptr->frontier.records[i].winStreak > slotValues[j])
|
||||
else if (gSaveBlock2Ptr->frontier.towerRecords[i].winStreak > slotValues[j])
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -591,14 +600,14 @@ void PutNewBattleTowerRecord(union BattleTowerRecord *newRecord)
|
||||
|
||||
if (j == slotsCount)
|
||||
{
|
||||
slotValues[slotsCount] = gSaveBlock2Ptr->frontier.records[i].winStreak;
|
||||
slotValues[slotsCount] = gSaveBlock2Ptr->frontier.towerRecords[i].winStreak;
|
||||
slotIds[slotsCount] = i;
|
||||
slotsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
i = Random() % slotsCount;
|
||||
gSaveBlock2Ptr->frontier.records[slotIds[i]] = *newRecordEm;
|
||||
gSaveBlock2Ptr->frontier.towerRecords[slotIds[i]] = *newRecordEm;
|
||||
}
|
||||
|
||||
u8 GetFrontierTrainerFrontSpriteId(u16 trainerId)
|
||||
@ -622,7 +631,7 @@ u8 GetFrontierTrainerFrontSpriteId(u16 trainerId)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
||||
return gFacilityClassToPicIndex[sub_818649C()];
|
||||
else
|
||||
return gFacilityClassToPicIndex[gSaveBlock2Ptr->frontier.records[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass];
|
||||
return gFacilityClassToPicIndex[gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -662,7 +671,7 @@ u8 GetFrontierOpponentClass(u16 trainerId)
|
||||
}
|
||||
else
|
||||
{
|
||||
trainerClass = gFacilityClassToTrainerClass[gSaveBlock2Ptr->frontier.records[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass];
|
||||
trainerClass = gFacilityClassToTrainerClass[gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass];
|
||||
asm("");
|
||||
}
|
||||
}
|
||||
@ -700,7 +709,7 @@ u8 GetFrontierTrainerFacilityClass(u16 trainerId)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
||||
facilityClass = sub_818649C();
|
||||
else
|
||||
facilityClass = gSaveBlock2Ptr->frontier.records[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass;
|
||||
facilityClass = gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -747,7 +756,7 @@ void GetFrontierTrainerName(u8 *dst, u16 trainerId)
|
||||
}
|
||||
else
|
||||
{
|
||||
struct EmeraldBattleTowerRecord *record = &gSaveBlock2Ptr->frontier.records[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID];
|
||||
struct EmeraldBattleTowerRecord *record = &gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID];
|
||||
TVShowConvertInternationalString(dst, record->name, record->language);
|
||||
return;
|
||||
}
|
||||
@ -794,7 +803,7 @@ bool8 IsFrontierTrainerFemale(u16 trainerId)
|
||||
}
|
||||
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID)
|
||||
{
|
||||
facilityClass = gSaveBlock2Ptr->frontier.records[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass;
|
||||
facilityClass = gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].facilityClass;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -865,10 +874,10 @@ void sub_81630C4(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
// Record mixed player.
|
||||
for (j = 0, i = firstMonId; i < firstMonId + monCount; j++, i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.records[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[j].species != 0
|
||||
&& gSaveBlock2Ptr->frontier.records[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[j].level <= level)
|
||||
if (gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[j].species != 0
|
||||
&& gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[j].level <= level)
|
||||
{
|
||||
sub_8068338(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.records[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[j], FALSE);
|
||||
sub_8068338(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[j], FALSE);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -1044,11 +1053,11 @@ void sub_81635D4(u16 trainerId, u8 firstMonId)
|
||||
{
|
||||
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; // Unused variable.
|
||||
u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
||||
u8 r1 = gSaveBlock2Ptr->frontier.field_CE0[battleMode][0] / 7;
|
||||
u8 challengeNum = gSaveBlock2Ptr->frontier.field_CE0[battleMode][0] / 7;
|
||||
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 6)
|
||||
fixedIV = sub_81A6CA8(r1, 0);
|
||||
fixedIV = sub_81A6CA8(challengeNum, 0);
|
||||
else
|
||||
fixedIV = sub_81A6CA8(r1, 1);
|
||||
fixedIV = sub_81A6CA8(challengeNum, 1);
|
||||
}
|
||||
else if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID)
|
||||
{
|
||||
@ -1121,7 +1130,7 @@ void sub_816379C(u16 trainerId, u8 firstMonId)
|
||||
}
|
||||
}
|
||||
|
||||
void ConvertBattleFrontierTrainerSpeechToString(const u16 *words)
|
||||
void FrontierSpeechToString(const u16 *words)
|
||||
{
|
||||
ConvertEasyChatWordsToString(gStringVar4, words, 3, 2);
|
||||
if (GetStringWidth(1, gStringVar4, -1) > 204)
|
||||
@ -1137,3 +1146,486 @@ void ConvertBattleFrontierTrainerSpeechToString(const u16 *words)
|
||||
gStringVar4[i] = CHAR_PROMPT_SCROLL;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8163914(void)
|
||||
{
|
||||
u16 trainerId;
|
||||
GetFacilityEnemyMonLevel(); // Pointless function call.
|
||||
|
||||
if (gSpecialVar_0x8005)
|
||||
trainerId = gTrainerBattleOpponent_B;
|
||||
else
|
||||
trainerId = gTrainerBattleOpponent_A;
|
||||
|
||||
if (trainerId == BATTLE_TOWER_EREADER_TRAINER_ID)
|
||||
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.greeting);
|
||||
else if (trainerId < BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID)
|
||||
FrontierSpeechToString(gFacilityTrainers[trainerId].speechBefore);
|
||||
else if (trainerId < BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID)
|
||||
FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].greeting);
|
||||
else
|
||||
CopyFriendsApprenticeChallengeText(trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID);
|
||||
}
|
||||
|
||||
static void HandleSpecialTrainerBattleEnd(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
sub_81864CC();
|
||||
switch (gBattleScripting.specialTrainerBattleType)
|
||||
{
|
||||
case SPECIAL_BATTLE_TOWER:
|
||||
case SPECIAL_BATTLE_DOME:
|
||||
case SPECIAL_BATTLE_PALACE:
|
||||
case SPECIAL_BATTLE_ARENA:
|
||||
case SPECIAL_BATTLE_FACTORY:
|
||||
case SPECIAL_BATTLE_PIKE_SINGLE:
|
||||
case SPECIAL_BATTLE_PIKE_DOUBLE:
|
||||
case SPECIAL_BATTLE_PYRAMID:
|
||||
if (gSaveBlock2Ptr->frontier.battlesCount < 0xFFFFFF)
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.battlesCount++;
|
||||
if (gSaveBlock2Ptr->frontier.battlesCount % 20 == 0)
|
||||
UpdateGymLeaderRematch();
|
||||
}
|
||||
else
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.battlesCount = 0xFFFFFF;
|
||||
}
|
||||
break;
|
||||
case SPECIAL_BATTLE_SECRET_BASE:
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
u16 itemBefore = GetMonData(&gSaveBlock1Ptr->playerParty[i], MON_DATA_HELD_ITEM);
|
||||
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &itemBefore);
|
||||
}
|
||||
break;
|
||||
case SPECIAL_BATTLE_EREADER:
|
||||
sub_816537C();
|
||||
break;
|
||||
}
|
||||
|
||||
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
|
||||
}
|
||||
|
||||
static void Task_StartBattleAfterTransition(u8 taskId)
|
||||
{
|
||||
if (IsBattleTransitionDone() == TRUE)
|
||||
{
|
||||
gMain.savedCallback = HandleSpecialTrainerBattleEnd;
|
||||
SetMainCallback2(CB2_InitBattle);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
extern const u8 MossdeepCity_SpaceCenter_2F_EventScript_224157[];
|
||||
extern const u8 MossdeepCity_SpaceCenter_2F_EventScript_224166[];
|
||||
|
||||
void DoSpecialTrainerBattle(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
gBattleScripting.specialTrainerBattleType = gSpecialVar_0x8004;
|
||||
switch (gSpecialVar_0x8004)
|
||||
{
|
||||
case SPECIAL_BATTLE_TOWER:
|
||||
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_BATTLE_TOWER;
|
||||
switch (VarGet(VAR_FRONTIER_BATTLE_MODE))
|
||||
{
|
||||
case FRONTIER_MODE_SINGLES:
|
||||
sub_8163048(3);
|
||||
break;
|
||||
case FRONTIER_MODE_DOUBLES:
|
||||
sub_8163048(4);
|
||||
gBattleTypeFlags |= BATTLE_TYPE_DOUBLE;
|
||||
break;
|
||||
case FRONTIER_MODE_MULTIS:
|
||||
sub_816306C(2);
|
||||
gPartnerTrainerId = gSaveBlock2Ptr->frontier.field_CD6;
|
||||
sub_8165404(gPartnerTrainerId);
|
||||
gBattleTypeFlags |= BATTLE_TYPE_DOUBLE | BATTLE_TYPE_INGAME_PARTNER | BATTLE_TYPE_MULTI | BATTLE_TYPE_TWO_OPPONENTS;
|
||||
break;
|
||||
case FRONTIER_MODE_LINK_MULTIS:
|
||||
gBattleTypeFlags |= BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_MULTI | BATTLE_TYPE_x800000;
|
||||
sub_816306C(2);
|
||||
break;
|
||||
}
|
||||
CreateTask(Task_StartBattleAfterTransition, 1);
|
||||
PlayMapChosenOrBattleBGM(0);
|
||||
BattleTransition_StartOnField(sub_80B100C(0));
|
||||
break;
|
||||
case SPECIAL_BATTLE_SECRET_BASE:
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
u16 itemBefore = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
|
||||
SetMonData(&gSaveBlock1Ptr->playerParty[i], MON_DATA_HELD_ITEM, &itemBefore);
|
||||
}
|
||||
CreateTask(Task_StartBattleAfterTransition, 1);
|
||||
PlayMapChosenOrBattleBGM(0);
|
||||
BattleTransition_StartOnField(sub_80B100C(12));
|
||||
break;
|
||||
case SPECIAL_BATTLE_EREADER:
|
||||
ZeroEnemyPartyMons();
|
||||
for (i = 0; i < 3; i++)
|
||||
sub_806819C(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i]);
|
||||
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_EREADER_TRAINER;
|
||||
gTrainerBattleOpponent_A = 0;
|
||||
CreateTask(Task_StartBattleAfterTransition, 1);
|
||||
PlayMapChosenOrBattleBGM(0);
|
||||
BattleTransition_StartOnField(sub_80B100C(13));
|
||||
break;
|
||||
case SPECIAL_BATTLE_DOME:
|
||||
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOME;
|
||||
if (VarGet(VAR_FRONTIER_BATTLE_MODE) == FRONTIER_MODE_DOUBLES)
|
||||
gBattleTypeFlags |= BATTLE_TYPE_DOUBLE;
|
||||
if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN)
|
||||
sub_8163048(2);
|
||||
CreateTask(Task_StartBattleAfterTransition, 1);
|
||||
sub_806E694(0);
|
||||
BattleTransition_StartOnField(sub_80B100C(3));
|
||||
break;
|
||||
case SPECIAL_BATTLE_PALACE:
|
||||
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_PALACE;
|
||||
if (VarGet(VAR_FRONTIER_BATTLE_MODE) == FRONTIER_MODE_DOUBLES)
|
||||
gBattleTypeFlags |= BATTLE_TYPE_DOUBLE;
|
||||
if (gSaveBlock2Ptr->frontier.lvlMode != FRONTIER_LVL_TENT)
|
||||
sub_8163048(3);
|
||||
else
|
||||
sub_81630A0(3);
|
||||
CreateTask(Task_StartBattleAfterTransition, 1);
|
||||
PlayMapChosenOrBattleBGM(0);
|
||||
BattleTransition_StartOnField(sub_80B100C(4));
|
||||
break;
|
||||
case SPECIAL_BATTLE_ARENA:
|
||||
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_ARENA;
|
||||
if (gSaveBlock2Ptr->frontier.lvlMode != FRONTIER_LVL_TENT)
|
||||
sub_8163048(3);
|
||||
else
|
||||
sub_81630A0(3);
|
||||
CreateTask(Task_StartBattleAfterTransition, 1);
|
||||
PlayMapChosenOrBattleBGM(0);
|
||||
BattleTransition_StartOnField(sub_80B100C(5));
|
||||
break;
|
||||
case SPECIAL_BATTLE_FACTORY:
|
||||
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_FACTORY;
|
||||
if (VarGet(VAR_FRONTIER_BATTLE_MODE) == FRONTIER_MODE_DOUBLES)
|
||||
gBattleTypeFlags |= BATTLE_TYPE_DOUBLE;
|
||||
sub_8163590();
|
||||
CreateTask(Task_StartBattleAfterTransition, 1);
|
||||
PlayMapChosenOrBattleBGM(0);
|
||||
BattleTransition_StartOnField(sub_80B100C(6));
|
||||
break;
|
||||
case SPECIAL_BATTLE_PIKE_SINGLE:
|
||||
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_BATTLE_TOWER;
|
||||
sub_8163048(3);
|
||||
CreateTask(Task_StartBattleAfterTransition, 1);
|
||||
PlayMapChosenOrBattleBGM(0);
|
||||
BattleTransition_StartOnField(sub_80B100C(7));
|
||||
break;
|
||||
case SPECIAL_BATTLE_PYRAMID:
|
||||
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_PYRAMID;
|
||||
sub_8163048(3);
|
||||
CreateTask(Task_StartBattleAfterTransition, 1);
|
||||
PlayMapChosenOrBattleBGM(0);
|
||||
BattleTransition_StartOnField(sub_80B100C(10));
|
||||
break;
|
||||
case SPECIAL_BATTLE_PIKE_DOUBLE:
|
||||
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TWO_OPPONENTS;
|
||||
sub_816306C(1);
|
||||
CreateTask(Task_StartBattleAfterTransition, 1);
|
||||
PlayMapChosenOrBattleBGM(0);
|
||||
BattleTransition_StartOnField(sub_80B100C(7));
|
||||
break;
|
||||
case SPECIAL_BATTLE_STEVEN:
|
||||
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER;
|
||||
sub_8165404(TRAINER_STEVEN_PARTNER);
|
||||
gApproachingTrainerId = 0;
|
||||
BattleSetup_ConfigureTrainerBattle(MossdeepCity_SpaceCenter_2F_EventScript_224157 + 1);
|
||||
gApproachingTrainerId = 1;
|
||||
BattleSetup_ConfigureTrainerBattle(MossdeepCity_SpaceCenter_2F_EventScript_224166 + 1);
|
||||
gPartnerTrainerId = TRAINER_STEVEN_PARTNER;
|
||||
CreateTask(Task_StartBattleAfterTransition, 1);
|
||||
PlayMapChosenOrBattleBGM(0);
|
||||
BattleTransition_StartOnField(B_TRANSITION_MAGMA);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SaveCurrentWinStreak(void)
|
||||
{
|
||||
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||
u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
||||
u16 winStreak = GetCurrentBattleTowerWinStreak(lvlMode, battleMode);
|
||||
|
||||
if (gSaveBlock2Ptr->frontier.field_CE0[battleMode][lvlMode] < winStreak)
|
||||
gSaveBlock2Ptr->frontier.field_CE0[battleMode][lvlMode] = winStreak;
|
||||
}
|
||||
|
||||
void sub_8163EE4(void)
|
||||
{
|
||||
s32 i;
|
||||
u8 lvlMode, battleMode, class;
|
||||
struct EmeraldBattleTowerRecord *playerRecord = &gSaveBlock2Ptr->frontier.towerPlayer;
|
||||
|
||||
sub_8164FB8(playerRecord);
|
||||
lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||
battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
||||
if (gSaveBlock2Ptr->playerGender != MALE)
|
||||
{
|
||||
class = gTowerFemaleFacilityClasses[(gSaveBlock2Ptr->playerTrainerId[0] +
|
||||
gSaveBlock2Ptr->playerTrainerId[1] +
|
||||
gSaveBlock2Ptr->playerTrainerId[2] +
|
||||
gSaveBlock2Ptr->playerTrainerId[3]) % ARRAY_COUNT(gTowerFemaleFacilityClasses)];
|
||||
}
|
||||
else
|
||||
{
|
||||
class = gTowerMaleFacilityClasses[(gSaveBlock2Ptr->playerTrainerId[0] +
|
||||
gSaveBlock2Ptr->playerTrainerId[1] +
|
||||
gSaveBlock2Ptr->playerTrainerId[2] +
|
||||
gSaveBlock2Ptr->playerTrainerId[3]) % ARRAY_COUNT(gTowerMaleFacilityClasses)];
|
||||
}
|
||||
playerRecord->lvlMode = lvlMode;
|
||||
playerRecord->facilityClass = class;
|
||||
CopyUnalignedWord(playerRecord->trainerId, gSaveBlock2Ptr->playerTrainerId);
|
||||
StringCopy7(playerRecord->name, gSaveBlock2Ptr->playerName);
|
||||
playerRecord->winStreak = GetCurrentBattleTowerWinStreak(lvlMode, battleMode);
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
playerRecord->greeting[i] = gSaveBlock1Ptr->unk2BBC[i];
|
||||
playerRecord->unk1C[i] = gSaveBlock1Ptr->unk2BC8[i];
|
||||
playerRecord->unk28[i] = gSaveBlock1Ptr->unk2BD4[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.field_CAA[i] != 0)
|
||||
sub_80686FC(&gPlayerParty[gSaveBlock2Ptr->frontier.field_CAA[i] - 1], &playerRecord->party[i]);
|
||||
}
|
||||
|
||||
playerRecord->language = gGameLanguage;
|
||||
CalcEmeraldBattleTowerChecksum(&gSaveBlock2Ptr->frontier.towerPlayer);
|
||||
SaveCurrentWinStreak();
|
||||
}
|
||||
|
||||
void SaveBattleTowerProgress(void)
|
||||
{
|
||||
u16 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||
u16 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
||||
s32 challengeNum = (signed)(gSaveBlock2Ptr->frontier.field_CE0[battleMode][lvlMode] / 7);
|
||||
|
||||
if (gSpecialVar_0x8005 == 0 && (challengeNum > 1 || gSaveBlock2Ptr->frontier.curChallengeBattleNum != 0))
|
||||
sub_8163EE4();
|
||||
|
||||
gSaveBlock2Ptr->frontier.field_CA8 =gSpecialVar_0x8005;
|
||||
VarSet(VAR_TEMP_0, 0);
|
||||
gSaveBlock2Ptr->frontier.field_CA9_a = 1;
|
||||
sub_81A4C30();
|
||||
}
|
||||
|
||||
void nullsub_61(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void nullsub_116(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void sub_81640E0(u16 trainerId)
|
||||
{
|
||||
s32 i, count;
|
||||
u32 validSpecies[3];
|
||||
u16 species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL);
|
||||
u16 species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL);
|
||||
|
||||
count = 0;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
u16 apprenticeSpecies = gSaveBlock2Ptr->apprentices[trainerId - BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID].monData[i].species;
|
||||
if (apprenticeSpecies != species1 && apprenticeSpecies != species2)
|
||||
{
|
||||
validSpecies[count] = i;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
gUnknown_03006298[0] = validSpecies[Random() % count];
|
||||
do
|
||||
{
|
||||
gUnknown_03006298[1] = validSpecies[Random() % count];
|
||||
} while (gUnknown_03006298[0] == gUnknown_03006298[1]);
|
||||
}
|
||||
|
||||
void sub_8164188(u16 trainerId)
|
||||
{
|
||||
s32 i, count;
|
||||
u32 validSpecies[3];
|
||||
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||
u16 species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL);
|
||||
u16 species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL);
|
||||
|
||||
count = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[i].species != species1
|
||||
&& gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[i].species != species2
|
||||
&& gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[i].level <= GetFrontierEnemyMonLevel(lvlMode)
|
||||
&& gSaveBlock2Ptr->frontier.towerRecords[trainerId - BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID].party[i].species != 0)
|
||||
{
|
||||
validSpecies[count] = i;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
gUnknown_03006298[2] = validSpecies[Random() % count];
|
||||
do
|
||||
{
|
||||
gUnknown_03006298[3] = validSpecies[Random() % count];
|
||||
} while (gUnknown_03006298[2] == gUnknown_03006298[3]);
|
||||
}
|
||||
|
||||
void sub_81642A0(void)
|
||||
{
|
||||
s32 i, j, k;
|
||||
u32 spArray[5];
|
||||
s32 r10;
|
||||
u16 trainerId;
|
||||
u16 monPoolId;
|
||||
u32 lvlMode, battleMode;
|
||||
s32 challengeNum;
|
||||
u32 species1, species2;
|
||||
u32 level;
|
||||
struct EventObjectTemplate *eventObjTemplates;
|
||||
|
||||
eventObjTemplates = gSaveBlock1Ptr->eventObjectTemplates;
|
||||
lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||
battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
||||
challengeNum = gSaveBlock2Ptr->frontier.field_CE0[battleMode][lvlMode] / 7;
|
||||
species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL);
|
||||
species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL);
|
||||
level = GetFacilityEnemyMonLevel();
|
||||
|
||||
for (j = 0; j < 6; j++)
|
||||
{
|
||||
do
|
||||
{
|
||||
trainerId = sub_8162548(challengeNum, 0);
|
||||
for (i = 0; i < j; i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.battledTrainerIds[i] == trainerId)
|
||||
break;
|
||||
if (gFacilityTrainers[gSaveBlock2Ptr->frontier.battledTrainerIds[i]].facilityClass == gFacilityTrainers[trainerId].facilityClass)
|
||||
break;
|
||||
}
|
||||
} while (i != j);
|
||||
gSaveBlock2Ptr->frontier.battledTrainerIds[j] = trainerId;
|
||||
}
|
||||
|
||||
r10 = 8;
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
trainerId = gSaveBlock2Ptr->frontier.battledTrainerIds[i];
|
||||
eventObjTemplates[i + 1].graphicsId = GetBattleFacilityTrainerGfxId(trainerId);
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
monPoolId = RandomizeFacilityTrainerMonId(trainerId);
|
||||
if (j % 2 != 0 && gFacilityTrainerMons[gSaveBlock2Ptr->frontier.battledTrainerIds[r10 - 1]].itemTableId == gFacilityTrainerMons[monPoolId].itemTableId)
|
||||
continue;
|
||||
|
||||
for (k = 8; k < r10; k++)
|
||||
{
|
||||
if (gFacilityTrainerMons[gSaveBlock2Ptr->frontier.battledTrainerIds[k]].species == gFacilityTrainerMons[monPoolId].species)
|
||||
break;
|
||||
if (species1 == gFacilityTrainerMons[monPoolId].species)
|
||||
break;
|
||||
if (species2 == gFacilityTrainerMons[monPoolId].species)
|
||||
break;
|
||||
}
|
||||
if (k == r10)
|
||||
break;
|
||||
}
|
||||
|
||||
gSaveBlock2Ptr->frontier.battledTrainerIds[r10] = monPoolId;
|
||||
r10++;
|
||||
}
|
||||
}
|
||||
|
||||
r10 = 0;
|
||||
sub_8165B20();
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->apprentices[i].lvlMode != 0
|
||||
&& gUnknown_085DF9EC[gSaveBlock2Ptr->apprentices[i].field_1] / 7 <= challengeNum
|
||||
&& gSaveBlock2Ptr->apprentices[i].lvlMode - 1 == lvlMode)
|
||||
{
|
||||
k = 0;
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
if (species1 != gSaveBlock2Ptr->apprentices[i].monData[j].species
|
||||
&& species2 != gSaveBlock2Ptr->apprentices[i].monData[j].species)
|
||||
{
|
||||
k++;
|
||||
}
|
||||
}
|
||||
if (k > 2)
|
||||
{
|
||||
spArray[r10] = i + BATTLE_TOWER_RECORD_APPRENTICE_BASE_ID;
|
||||
r10++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (r10 != 0)
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.battledTrainerIds[6] = spArray[Random() % r10];
|
||||
eventObjTemplates[7].graphicsId = GetBattleFacilityTrainerGfxId(gSaveBlock2Ptr->frontier.battledTrainerIds[6]);
|
||||
FlagClear(FLAG_HIDE_BATTLE_TOWER_MULTI_BATTLE_PARTNER_ALT_1);
|
||||
sub_81640E0(gSaveBlock2Ptr->frontier.battledTrainerIds[6]);
|
||||
}
|
||||
|
||||
r10 = 0;
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
u32 *record = (u32*)(&gSaveBlock2Ptr->frontier.towerRecords[i]);
|
||||
u32 recordHasData = 0;
|
||||
u32 checksum = 0;
|
||||
for (j = 0; j < (sizeof(struct EmeraldBattleTowerRecord) - 4) / 4; j++) // - 4, because of the last field being the checksum itself.
|
||||
{
|
||||
recordHasData |= record[j];
|
||||
checksum += record[j];
|
||||
}
|
||||
|
||||
if (gSaveBlock2Ptr->frontier.towerRecords[i].winStreak / 7 <= challengeNum
|
||||
&& gSaveBlock2Ptr->frontier.towerRecords[i].lvlMode == lvlMode
|
||||
&& recordHasData
|
||||
&& gSaveBlock2Ptr->frontier.towerRecords[i].checksum == checksum)
|
||||
{
|
||||
k = 0;
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
if (species1 != gSaveBlock2Ptr->frontier.towerRecords[i].party[j].species
|
||||
&& species2 != gSaveBlock2Ptr->frontier.towerRecords[i].party[j].species
|
||||
&& gSaveBlock2Ptr->frontier.towerRecords[i].party[j].level <= GetFrontierEnemyMonLevel(lvlMode)
|
||||
&& gSaveBlock2Ptr->frontier.towerRecords[i].party[j].species != 0)
|
||||
{
|
||||
k++;
|
||||
}
|
||||
}
|
||||
if (k > 1)
|
||||
{
|
||||
spArray[r10] = i + BATTLE_TOWER_RECORD_MIXING_TRAINER_BASE_ID;
|
||||
r10++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (r10 != 0)
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.battledTrainerIds[7] = spArray[Random() % r10];
|
||||
eventObjTemplates[8].graphicsId = GetBattleFacilityTrainerGfxId(gSaveBlock2Ptr->frontier.battledTrainerIds[7]);
|
||||
FlagClear(FLAG_HIDE_BATTLE_TOWER_MULTI_BATTLE_PARTNER_ALT_2);
|
||||
sub_8164188(gSaveBlock2Ptr->frontier.battledTrainerIds[7]);
|
||||
}
|
||||
}
|
||||
|
@ -197,10 +197,10 @@ static void SetSrcLookupPointers(void)
|
||||
sOldManSave = &gSaveBlock1Ptr->oldMan;
|
||||
sEasyChatPairsSave = gSaveBlock1Ptr->easyChatPairs;
|
||||
gUnknown_03001148 = &gUnknown_02039F9C;
|
||||
sBattleTowerSave = &gSaveBlock2Ptr->frontier.battleTower;
|
||||
sBattleTowerSave = &gSaveBlock2Ptr->frontier.towerPlayer;
|
||||
sLilycoveLadySave = &gSaveBlock1Ptr->lilycoveLady;
|
||||
gUnknown_03001154 = gSaveBlock2Ptr->apprentices;
|
||||
sBattleTowerSave_Duplicate = &gSaveBlock2Ptr->frontier.battleTower;
|
||||
sBattleTowerSave_Duplicate = &gSaveBlock2Ptr->frontier.towerPlayer;
|
||||
}
|
||||
|
||||
static void PrepareUnknownExchangePacket(struct PlayerRecordsRS *dest)
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "tv.h"
|
||||
#include "secret_base.h"
|
||||
#include "constants/map_types.h"
|
||||
#include "constants/trainers.h"
|
||||
|
||||
extern void mapldr_default(void);
|
||||
|
||||
@ -1143,7 +1144,7 @@ const u8 *GetSecretBaseTrainerLoseText(void)
|
||||
void sub_80EA2E4(void)
|
||||
{
|
||||
sub_813BADC(TRUE);
|
||||
gTrainerBattleOpponent_A = 0x400;
|
||||
gTrainerBattleOpponent_A = TRAINER_SECRET_BASE;
|
||||
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_SECRET_BASE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user