Merge pull request #370 from DizzyEggg/battle_tower

Decompile Battle Tower
This commit is contained in:
Diegoisawesome 2018-10-30 11:18:24 -05:00 committed by GitHub
commit f3af20d3cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 3154 additions and 8047 deletions

View File

@ -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
@ -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
@ -6261,7 +6261,7 @@ _081A4E46:
bl ZeroEnemyPartyMons
movs r1, 0
str r1, [sp, 0x18]
bl GetFacilityEnemyMonLevel
bl SetFacilityPtrsGetLevel
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x1C]
@ -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
@ -9904,7 +9904,7 @@ sub_81A6CD0: @ 81A6CD0
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x24]
bl GetFacilityEnemyMonLevel
bl SetFacilityPtrsGetLevel
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x20]
@ -10896,7 +10896,7 @@ _081A7560:
lsls r0, 2
ldr r1, =gUnknown_086123E4
adds r0, r1
bl ConvertBattleFrontierTrainerSpeechToString
bl FrontierSpeechToString
pop {r0}
bx r0
.pool
@ -11734,7 +11734,7 @@ TryGenerateBattlePikeWildMon: @ 81A7B90
ands r0, r1
cmp r0, 0
beq _081A7C1C
bl sub_8165CB4
bl GetHighestLevelInPlayerParty
adds r7, r0, 0
cmp r7, 0x3B
ble _081A7C08
@ -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
@ -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
@ -15719,7 +15719,7 @@ _081A9C56:
bl SetMonData
cmp r5, 0
beq _081A9CD4
bl GetFacilityEnemyMonLevel
bl SetFacilityPtrsGetLevel
lsls r0, 24
lsrs r5, r0, 24
ldr r1, [sp, 0x10]
@ -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
@ -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

@ -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}
@ -29731,7 +29731,7 @@ sub_81D62CC: @ 81D62CC
lsls r0, r1, 24
lsrs r6, r0, 24
bl sub_81D56B0
bl sub_8165CB4
bl GetHighestLevelInPlayerParty
lsls r0, 24
lsrs r0, 24
mov r10, r0

View File

@ -10934,7 +10934,7 @@ sub_801B1E8: @ 801B1E8
ldr r0, [r0]
ldr r1, =0x00000bec
adds r0, r1
bl sub_816534C
bl ClearEReaderTrainer
pop {r0}
bx r0
.pool

View File

@ -1601,12 +1601,12 @@ BattleScript_EffectPerishSong::
waitanimation
printstring STRINGID_FAINTINTHREE
waitmessage 0x40
setbyte sBANK, 0x0
setbyte sBATTLER, 0x0
BattleScript_PerishSongLoop::
jumpifability BS_SCRIPTING, ABILITY_SOUNDPROOF, BattleScript_PerishSongNotAffected
BattleScript_PerishSongLoopIncrement::
addbyte sBANK, 0x1
jumpifbytenotequal sBANK, gBattlersCount, BattleScript_PerishSongLoop
addbyte sBATTLER, 0x1
jumpifbytenotequal sBATTLER, gBattlersCount, BattleScript_PerishSongLoop
goto BattleScript_MoveEnd
BattleScript_PerishSongNotAffected::
@ -2493,7 +2493,7 @@ BattleScript_EffectYawn::
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_PrintBankAbilityMadeIneffective::
copybyte sBANK, sBANK_WITH_ABILITY
copybyte sBATTLER, sBATTLER_WITH_ABILITY
BattleScript_PrintAbilityMadeIneffective::
pause 0x20
printstring STRINGID_PKMNSXMADEITINEFFECTIVE
@ -3523,7 +3523,7 @@ BattleScript_RapidSpinAway::
BattleScript_WrapFree::
printstring STRINGID_PKMNGOTFREE
waitmessage 0x40
copybyte gBattlerTarget, sBANK
copybyte gBattlerTarget, sBATTLER
return
BattleScript_LeechSeedFree::
@ -4030,11 +4030,11 @@ BattleScript_ShedSkinActivates::
end3
BattleScript_WeatherFormChanges::
setbyte sBANK, 0x0
setbyte sBATTLER, 0x0
BattleScript_WeatherFormChangesLoop::
trycastformdatachange
addbyte sBANK, 0x1
jumpifbytenotequal sBANK, gBattlersCount, BattleScript_WeatherFormChangesLoop
addbyte sBATTLER, 0x1
jumpifbytenotequal sBATTLER, gBattlersCount, BattleScript_WeatherFormChangesLoop
return
BattleScript_CastformChange::

View File

@ -21,19 +21,19 @@
@ 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
sRubyFacilityClassToEmerald:: @ 85DCF40
.byte 0x00, 0x0b, 0x01, 0x01, 0x02, 0x06, 0x03, 0x0d, 0x04, 0x0e, 0x05, 0x0f, 0x06, 0x10, 0x07, 0x11, 0x08, 0x03, 0x09, 0x12, 0x0a, 0x0c, 0x0b, 0x13, 0x0c, 0x14, 0x0d, 0x15, 0x0e, 0x17, 0x0f, 0x07
.byte 0x10, 0x0a, 0x11, 0x19, 0x12, 0x1a, 0x13, 0x1b, 0x14, 0x1d, 0x15, 0x1e, 0x16, 0x1f, 0x17, 0x20, 0x18, 0x21, 0x19, 0x22, 0x1a, 0x23, 0x1b, 0x24, 0x1c, 0x25, 0x1d, 0x26, 0x1e, 0x27, 0x1f, 0x28
.byte 0x20, 0x29, 0x21, 0x2a, 0x22, 0x09, 0x23, 0x16, 0x24, 0x2b, 0x25, 0x2c, 0x26, 0x2d, 0x27, 0x2e, 0x28, 0x2f, 0x29, 0x30, 0x2a, 0x31, 0x2b, 0x32, 0x2c, 0x33, 0x2d, 0x34, 0x2e, 0x04, 0x2f, 0x35
@ -640,7 +640,7 @@ gUnknown_085DD690:: @ 85DD690
.4byte gUnknown_085DD0F0
.4byte gUnknown_085DD104
gUnknown_085DD6D0:: @ 85DD6D0
sStevenMons:: @ 85DD6D0
.byte 0x8f, 0x01, 0x1f, 0x2a, 0x02
gUnknown_085DD6D5:: @ 85DD6D5
@ -677,57 +677,3 @@ gUnknown_085DD6DC:: @ 85DD6DC
@ 85DF69C
.include "data/battle_frontier/fallarbor_battle_tent_mons.inc"
.align 2
gUnknown_085DF96C:: @ 85DF96C
.4byte sub_8161F94
.4byte sub_8162054
.4byte sub_81620F4
.4byte sub_81623F0
.4byte sub_81621C0
.4byte sub_816502C
.4byte sub_8164040
.4byte sub_8163914
.4byte nullsub_61
.4byte nullsub_116
.4byte sub_81642A0
.4byte sub_8164828
.4byte sub_8164B74
.4byte sub_8164DCC
.4byte sub_8164DE4
.4byte sub_8164E04
.align 2
gUnknown_085DF9AC:: @ 85DF9AC
.4byte 0x00000001, 0x00000002, 0x00004000, 0x00008000, 0x00010000, 0x00020000, 0x00040000, 0x00080000
.align 2
gUnknown_085DF9CC:: @ 85DF9CC
.4byte 0xfffffffe, 0xfffffffd, 0xffffbfff, 0xffff7fff, 0xfffeffff, 0xfffdffff, 0xfffbffff, 0xfff7ffff
gUnknown_085DF9EC:: @ 85DF9EC
.byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x08, 0x09, 0x0a, 0x0b, 0x0c
gUnknown_085DF9F6:: @ 85DF9F6
.byte 0x03, 0x04, 0x02, 0x02
.align 1
gUnknown_085DF9FA:: @ 85DF9FA
.2byte 0x0000, 0x0063, 0x0050, 0x0077, 0x0064, 0x008b, 0x0078, 0x009f, 0x008c, 0x00b3, 0x00a0, 0x00c7, 0x00b4, 0x00db, 0x00c8, 0x012b
.align 1
gUnknown_085DFA1A:: @ 85DFA1A
.2byte 0x0064, 0x0077, 0x0078, 0x008b, 0x008c, 0x009f, 0x00a0, 0x00b3, 0x00b4, 0x00c7, 0x00c8, 0x00db, 0x00dc, 0x00ef, 0x00c8, 0x012b
.2byte 0x00b3, 0x008d, 0x00c8, 0x00b7
gUnknown_085DFA42:: @ 85DFA42
.byte 0x03, 0x04, 0x02, 0x02
.align 1
gUnknown_085DFA46:: @ 85DFA46
.2byte 0x0c3a, 0x0c3a, 0x0c01, 0x0a2a, 0x0607, 0x0c01
.align 1
gUnknown_085DFA52:: @ 85DFA52
.2byte 0x1039, 0x122e, 0x0c04, 0x0a3d, 0x0630, 0x0c04, 0x0000

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

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
@ -15,12 +15,12 @@ SootopolisCity_MysteryEventsHouse_B1F_EventScript_227E68:: @ 8227E68
lockall
applymovement 255, SootopolisCity_MysteryEventsHouse_B1F_Movement_227EF3
waitmovement 0
special sub_8165360
msgbox 0x2021fc4, 4
special CopyEReaderTrainerGreeting
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

View File

@ -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

View File

@ -246,8 +246,8 @@ gSpecials:: @ 81DBA64
def_special sub_8161F74
def_special CallBattleDomeFunction
def_special sub_8195960
def_special sub_8165360
def_special sub_8163AC4
def_special CopyEReaderTrainerGreeting
def_special DoSpecialTrainerBattle
def_special sub_81A5238
def_special sub_81A5E74
def_special sub_81A703C
@ -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

@ -2,6 +2,8 @@
.include "constants/constants.inc"
.section .rodata
.align 4
gUnknown_085DFA60:: @ 85DFA60
.incbin "graphics/interface/85DFA60.bin"

View File

@ -561,6 +561,7 @@ struct BattleScripting
u8 field_23;
u8 windowsType; // 0 - normal, 1 - battle arena
u8 multiplayerId;
u8 specialTrainerBattleType;
};
// rom_80A5C6C

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

@ -3,35 +3,25 @@
struct RSBattleTowerRecord
{
/*0x00*/ u8 battleTowerLevelType; // 0 = level 50, 1 = level 100
/*0x01*/ u8 trainerClass;
/*0x00*/ u8 lvlMode; // 0 = level 50, 1 = level 100
/*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*/ struct UnknownPokemonStruct party[3];
/*0xA0*/ u32 checksum;
/*0xA4*/ u16 unk_11c8;
};
union BattleTowerRecord
{
struct RSBattleTowerRecord ruby_sapphire;
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
@ -43,17 +33,47 @@ 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;
u16 sub_8164FCC(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 ConvertBattleFrontierTrainerSpeechToString(const u16 *words);
void GetFrontierTrainerName(u8 *dest, u16 trainerIdx);
void GetEreaderTrainerName(u8 *dest);
void sub_8161F74(void);
u16 sub_8162548(u8 challengeNum, u8 battleNum);
void SetBattleFacilityTrainerGfxId(u16 trainerId, u8 tempVarId);
void SetEReaderTrainerGfxId(void);
u8 GetBattleFacilityTrainerGfxId(u16 trainerId);
void PutNewBattleTowerRecord(struct EmeraldBattleTowerRecord *newRecordEm);
u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
u8 GetFrontierOpponentClass(u16 trainerId);
void GetFrontierTrainerName(u8 *dst, u16 trainerId);
void FillFrontierTrainerParty(u8 monsCount);
void FillFrontierTrainersParties(u8 monsCount);
u16 RandomizeFacilityTrainerMonId(u16 trainerId);
void FrontierSpeechToString(const u16 *words);
void DoSpecialTrainerBattle(void);
void CalcEmeraldBattleTowerChecksum(struct EmeraldBattleTowerRecord *record);
void CalcRubyBattleTowerChecksum(struct RSBattleTowerRecord *record);
u16 GetCurrentBattleTowerWinStreak(u8 lvlMode, u8 battleMode);
u8 GetEreaderTrainerFrontSpriteId(void);
u8 GetEreaderTrainerClassId(void);
void GetEreaderTrainerName(u8 *dst);
void ValidateEReaderTrainer(void);
void ClearEReaderTrainer(struct BattleTowerEReaderTrainer *ereaderTrainer);
void CopyEReaderTrainerGreeting(void);
void sub_81653CC(void);
bool32 RubyBattleTowerRecordToEmerald(struct RSBattleTowerRecord *src, struct EmeraldBattleTowerRecord *dst);
bool32 EmeraldBattleTowerRecordToRuby(struct EmeraldBattleTowerRecord *src, struct RSBattleTowerRecord *dst);
void CalcApprenticeChecksum(struct Apprentice *apprentice);
void GetBattleTowerTrainerLanguage(u8 *dst, u16 trainerId);
u8 SetFacilityPtrsGetLevel(void);
u8 GetFrontierEnemyMonLevel(u8 lvlMode);
s32 GetHighestLevelInPlayerParty(void);
u8 sub_81660B8(u8 facilityClass);
bool32 ValidateBattleTowerRecord(u8 recordId); // unused
void sub_8166188(void);
#endif //GUARD_BATTLE_TOWER_H

View File

@ -10,6 +10,10 @@
#define FRONTIER_FACILITY_PIKE 5
#define FRONTIER_FACILITY_PYRAMID 6
#define TENT_VERDANTURF 2
#define TENT_FALLARBOR 3
#define TENT_SLATEPORT 4
// Battle Frontier lvl modes.
#define FRONTIER_LVL_50 0
#define FRONTIER_LVL_OPEN 1
@ -21,4 +25,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

View File

@ -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

View File

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

View File

@ -275,26 +275,6 @@ struct BerryCrush
u32 unk;
};
struct UnknownSaveBlock2Struct
{
u8 field_0;
u8 field_1;
u8 field_2[2];
u8 field_4[8];
u8 field_C[16];
u16 field_1C[6];
u16 field_28[6];
u8 field_34[176];
u8 field_E4;
u8 field_E5;
u8 field_E6;
u8 field_E7;
u8 field_E8;
u8 field_E9;
u8 field_EA;
u8 field_EB;
}; // sizeof = 0xEC
struct ApprenticeMon
{
u16 species;
@ -308,12 +288,12 @@ struct Apprentice
u8 lvlMode:2; // + 1
u8 field_1;
u8 number;
struct ApprenticeMon monData[3];
struct ApprenticeMon party[3];
u16 easyChatWords[6];
u8 playerId[4];
u8 playerName[PLAYER_NAME_LENGTH];
u8 language;
u32 unk40;
u32 checksum;
};
struct UnknownPokemonStruct
@ -345,20 +325,33 @@ struct UnknownPokemonStruct
struct EmeraldBattleTowerRecord
{
/*0x00*/ u8 battleTowerLevelType; // 0 = level 50, 1 = level 100
/*0x01*/ u8 trainerClass;
/*0x00*/ u8 lvlMode; // 0 = level 50, 1 = level 100
/*0x01*/ u8 facilityClass;
/*0x02*/ u16 winStreak;
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
/*0x0C*/ u8 trainerId[4];
/*0x10*/ struct {
u16 easyChat[6];
} greeting;
/*0x1C*/ u8 filler_1c[0x18];
/*0x10*/ u16 greeting[6];
/*0x1C*/ u16 unk1C[6];
/*0x28*/ u16 unk28[6];
/*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];
@ -386,18 +379,14 @@ struct BattleDomeTrainer
struct BattleFrontier
{
/*0x64C*/ struct EmeraldBattleTowerRecord battleTower;
/*0x738*/ struct UnknownSaveBlock2Struct field_738[5]; // No idea here, it's probably wrong, no clue.
/*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];
/*0xBE3*/ u8 field_BE3[8];
/*0xBD8*/ u8 field_BD8[PLAYER_NAME_LENGTH + 1];
/*0xBE3*/ u8 field_BE0[POKEMON_NAME_LENGTH + 1];
/*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
@ -406,16 +395,19 @@ struct BattleFrontier
/*0xCA9*/ u8 field_CA9_d:1; // 0x20
/*0xCA9*/ u8 field_CA9_e:1; // 0x40
/*0xCA9*/ u8 field_CA9_f:1; // 0x80
/*0xCAA*/ u16 field_CAA[3];
/*0xCAA*/ u16 selectedPartyMons[3];
/*0xCB0*/ u16 field_CB0;
/*0xCB2*/ u16 field_CB2;
/*0xCB2*/ u16 curChallengeBattleNum; // In case of battle pyramid, the floor.
/*0xCB4*/ u16 field_CB4[20];
/*0xCDC*/ u32 field_CDC;
/*0xCE0*/ u16 field_CE0[4][2];
/*0xCE0*/ u16 winStreaks[4][2];
/*0xCF0*/ u16 field_CF0[2];
/*0xCF4*/ u16 field_CF4[2];
/*0xCF8*/ u16 field_CF8[2];
/*0xCFC*/ u16 field_CFC[5];
/*0xCFC*/ u16 field_CFC[2];
/*0xD06*/ u16 field_D00;
/*0xD06*/ u16 field_D02;
/*0xD06*/ u16 field_D04;
/*0xD06*/ u8 field_D06;
/*0xD07*/ u8 field_D07;
/*0xD08*/ u8 field_D08_0:1;
@ -466,10 +458,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];

View File

@ -211,7 +211,6 @@ SECTIONS {
src/decoration_inventory.o(.text);
src/roamer.o(.text);
src/battle_tower.o(.text);
asm/battle_tower.o(.text);
src/use_pokeblock.o(.text);
asm/use_pokeblock.o(.text);
src/battle_controller_wally.o(.text);
@ -500,6 +499,7 @@ SECTIONS {
src/learn_move.o(.rodata);
src/roamer.o(.rodata);
data/battle_tower.o(.rodata);
src/battle_tower.o(.rodata);
src/use_pokeblock.o(.rodata);
data/use_pokeblock.o(.rodata);
src/battle_controller_wally.o(.rodata);

View File

@ -344,13 +344,6 @@ extern struct Unk030062ECStruct *gUnknown_030062EC;
extern struct Unk030062F0Struct *gUnknown_030062F0;
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 +375,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 +1023,7 @@ static void (* const sApprenticeFunctions[])(void) =
sub_81A1224,
sub_81A1438,
sub_81A150C,
sub_81A15A4,
Script_SetPlayerApprenticeTrainerGfxId,
sub_81A1644,
sub_81A1370,
};
@ -1092,7 +1085,7 @@ void ResetAllApprenticeData(void)
for (j = 0; j < 4; j++)
gSaveBlock2Ptr->apprentices[i].playerId[j] = 0;
gSaveBlock2Ptr->apprentices[i].language = gGameLanguage;
gSaveBlock2Ptr->apprentices[i].unk40 = 0;
gSaveBlock2Ptr->apprentices[i].checksum = 0;
}
Script_ResetPlayerApprentice();
@ -1435,16 +1428,16 @@ static void sub_81A0390(u8 arg0)
for (i = 0; i < 3; i++)
{
gSaveBlock2Ptr->apprentices[0].monData[i].species = 0;
gSaveBlock2Ptr->apprentices[0].monData[i].item = 0;
gSaveBlock2Ptr->apprentices[0].party[i].species = 0;
gSaveBlock2Ptr->apprentices[0].party[i].item = 0;
for (j = 0; j < 4; j++)
gSaveBlock2Ptr->apprentices[0].monData[i].moves[j] = 0;
gSaveBlock2Ptr->apprentices[0].party[i].moves[j] = 0;
}
j = PLAYER_APPRENTICE.field_B1_2;
for (i = 0; i < 3; i++)
{
apprenticeMons[j] = &gSaveBlock2Ptr->apprentices[0].monData[i];
apprenticeMons[j] = &gSaveBlock2Ptr->apprentices[0].party[i];
j = (j + 1) % 3;
}
@ -1975,7 +1968,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:
@ -2261,7 +2254,7 @@ static void sub_81A1438(void)
StringCopy(gSaveBlock2Ptr->apprentices[0].playerName, gSaveBlock2Ptr->playerName);
gSaveBlock2Ptr->apprentices[0].language = gGameLanguage;
sub_8165AE8(&gSaveBlock2Ptr->apprentices[0]);
CalcApprenticeChecksum(&gSaveBlock2Ptr->apprentices[0]);
}
static void sub_81A150C(void)
@ -2270,51 +2263,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

@ -57,18 +57,12 @@ struct UnkStruct_860DD10
extern void sub_81B8558(void);
extern u32 sub_81A39C4(void);
extern u16 sub_8162548(u8, u8);
extern u16 RandomizeFacilityTrainerMonId(u16);
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 sub_81A4C30(void);
extern bool8 sub_81A3610(void);
extern u16 sub_81A4FF0(u8);
extern u8 GetFrontierTrainerFrontSpriteId(u16);
extern u8 GetFrontierOpponentClass(u16);
extern void ReducePlayerPartyToThree(void);
extern u8 gUnknown_0203CEF8[];
@ -2410,7 +2404,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]))
@ -2581,13 +2575,13 @@ static void InitDomeTrainers(void)
for (i = 0; i < 3; i++)
{
gSaveBlock2Ptr->frontier.domeMonId[0][i] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.field_CAA[i] - 1], MON_DATA_SPECIES, NULL);
gSaveBlock2Ptr->frontier.domeMonId[0][i] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_SPECIES, NULL);
for (j = 0; j < 4; j++)
gSaveBlock2Ptr->frontier.field_EFC[i].moves[j] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.field_CAA[i] - 1], MON_DATA_MOVE1 + j, NULL);
gSaveBlock2Ptr->frontier.field_EFC[i].moves[j] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_MOVE1 + j, NULL);
for (j = 0; j < 6; j++)
gSaveBlock2Ptr->frontier.field_EFC[i].evs[j] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.field_CAA[i] - 1], MON_DATA_HP_EV + j, NULL);
gSaveBlock2Ptr->frontier.field_EFC[i].evs[j] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_HP_EV + j, NULL);
gSaveBlock2Ptr->frontier.field_EFC[i].nature = GetNature(&gPlayerParty[gSaveBlock2Ptr->frontier.field_CAA[i] - 1]);
gSaveBlock2Ptr->frontier.field_EFC[i].nature = GetNature(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1]);
}
for (i = 1; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
@ -2649,7 +2643,7 @@ static void InitDomeTrainers(void)
statSums[0] = 0;
for (i = 0; i < 3; i++)
{
trainerId = gSaveBlock2Ptr->frontier.field_CAA[i] - 1; // Great variable choice, gamefreak.
trainerId = gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1; // Great variable choice, gamefreak.
statSums[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_ATK, NULL);
statSums[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_DEF, NULL);
statSums[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_SPATK, NULL);
@ -2667,7 +2661,7 @@ static void InitDomeTrainers(void)
monTypesBits >>= 1;
}
monLevel = GetFacilityEnemyMonLevel();
monLevel = SetFacilityPtrsGetLevel();
statSums[0] += (monTypesCount * monLevel) / 20;
for (i = 1; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
@ -2810,12 +2804,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);
}
@ -2833,7 +2827,7 @@ static void CreateDomeMon(u8 monPartyId, u16 tournamentTrainerId, u8 tournamentM
s32 i;
u8 happiness = 0xFF;
u8 fixedIv = GetDomeTrainerMonIvs(tournamentTrainerId); // BUG: Should be using trainerId instead of tournamentTrainerId. As a result, all Pokemon have ivs of 3.
u8 level = GetFacilityEnemyMonLevel();
u8 level = SetFacilityPtrsGetLevel();
CreateMonWithEVSpreadPersonalityOTID(&gEnemyParty[monPartyId],
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentTrainerId][tournamentMonId]].species,
level,
@ -3466,12 +3460,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)
@ -3805,7 +3799,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)
{
@ -3817,7 +3811,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;
}
@ -4621,7 +4615,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;
@ -5373,7 +5367,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;
@ -5475,7 +5469,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))
{
@ -5536,19 +5530,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);
}
}
@ -5561,7 +5555,7 @@ static u16 GetWinningMove(s32 winnerTournamentId, s32 loserTournamentId, u8 roun
u16 bestScore = 0;
u16 bestId = 0;
s32 movePower = 0;
GetFacilityEnemyMonLevel(); // Unused return variable.
SetFacilityPtrsGetLevel();
// Calc move points of all 4 moves for all 3 pokemon hitting all 3 target mons.
for (i = 0; i < 3; i++)
@ -5761,7 +5755,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)
@ -5774,9 +5768,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)
@ -5789,23 +5783,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)
@ -5930,7 +5924,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)
@ -5945,8 +5939,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);
}
}
}
@ -6084,7 +6078,7 @@ static void sub_8194D68(void)
for (i = 0; i < 2; i++)
{
s32 playerMonId = gSaveBlock2Ptr->frontier.field_CAA[gUnknown_0203CEF8[i] - 1] - 1;
s32 playerMonId = gSaveBlock2Ptr->frontier.selectedPartyMons[gUnknown_0203CEF8[i] - 1] - 1;
s32 count;
for (moveSlot = 0; moveSlot < 4; moveSlot++)
@ -6110,7 +6104,7 @@ static void sub_8194E44(void)
for (i = 0; i < 2; i++)
{
s32 playerMonId = gSaveBlock2Ptr->frontier.field_CAA[gUnknown_0203CEF8[i] - 1] - 1;
s32 playerMonId = gSaveBlock2Ptr->frontier.selectedPartyMons[gUnknown_0203CEF8[i] - 1] - 1;
u16 item = GetMonData(&gSaveBlock1Ptr->playerParty[playerMonId], MON_DATA_HELD_ITEM, NULL);
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &item);
}
@ -6425,7 +6419,7 @@ static void DecideRoundWinners(u8 roundId)
static void CopyDomeTrainerName(u8 *dst, u16 trainerId)
{
s32 i = 0;
GetFacilityEnemyMonLevel(); // Unused return value.
SetFacilityPtrsGetLevel();
if (trainerId == TRAINER_FRONTIER_BRAIN)
{
@ -6440,7 +6434,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;
@ -6461,7 +6455,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,13 +90,13 @@ 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)
{
if (gTrainerBattleOpponent_A < 300)
ConvertBattleFrontierTrainerSpeechToString(gFacilityTrainers[gTrainerBattleOpponent_A].speechBefore);
FrontierSpeechToString(gFacilityTrainers[gTrainerBattleOpponent_A].speechBefore);
}
/*

View File

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

View File

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

View File

@ -31,6 +31,7 @@
#include "string_util.h"
#include "overworld.h"
#include "field_weather.h"
#include "battle_tower.h"
#include "gym_leader_rematch.h"
#include "constants/map_types.h"
#include "constants/battle_frontier.h"
@ -67,8 +68,6 @@ extern u16 sub_81D6180(u8 localId);
extern bool8 GetBattlePyramidTrainerFlag(u8 eventObjId);
extern bool8 GetTrainerHillTrainerFlag(u8 eventObjId);
extern bool8 sub_81D5C18(void);
extern void sub_816306C(u8 a0);
extern void sub_8163048(u8 a0);
extern void sub_81A9B04(void);
extern void sub_81D639C(void);
extern void sub_81D6384(void);
@ -885,8 +884,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.field_CB4[gSaveBlock2Ptr->frontier.curChallengeBattleNum * 2 + 0]
+ gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.curChallengeBattleNum * 2 + 1];
return sUnknown_0854FE98[var % ARRAY_COUNT(sUnknown_0854FE98)];
}
@ -1264,7 +1263,7 @@ void BattleSetup_StartTrainerBattle(void)
if (gNoOfApproachingTrainers == 2)
{
sub_816306C(1);
FillFrontierTrainersParties(1);
ZeroMonData(&gEnemyParty[1]);
ZeroMonData(&gEnemyParty[2]);
ZeroMonData(&gEnemyParty[4]);
@ -1272,7 +1271,7 @@ void BattleSetup_StartTrainerBattle(void)
}
else
{
sub_8163048(1);
FillFrontierTrainerParty(1);
ZeroMonData(&gEnemyParty[1]);
ZeroMonData(&gEnemyParty[2]);
}

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,13 +120,13 @@ 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)
{
if (gTrainerBattleOpponent_A < 300)
ConvertBattleFrontierTrainerSpeechToString(gFacilityTrainers[gTrainerBattleOpponent_A].speechBefore);
FrontierSpeechToString(gFacilityTrainers[gTrainerBattleOpponent_A].speechBefore);
}
static void sub_81B9ABC(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)
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.field_CB4[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

@ -2158,13 +2158,13 @@ void sub_8139F20(void)
case 1:
case 2:
case 3:
if (gSaveBlock2Ptr->frontier.field_CE0[var][0] >= gSaveBlock2Ptr->frontier.field_CE0[var][1])
if (gSaveBlock2Ptr->frontier.winStreaks[var][0] >= gSaveBlock2Ptr->frontier.winStreaks[var][1])
{
unk = gSaveBlock2Ptr->frontier.field_CE0[var][0];
unk = gSaveBlock2Ptr->frontier.winStreaks[var][0];
}
else
{
unk = gSaveBlock2Ptr->frontier.field_CE0[var][1];
unk = gSaveBlock2Ptr->frontier.winStreaks[var][1];
}
break;
case 4:
@ -2244,7 +2244,7 @@ void sub_813A080(void)
u16 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
if (battleMode == 2 && !FlagGet(FLAG_0x152))
if (battleMode == FRONTIER_MODE_MULTIS && !FlagGet(FLAG_0x152))
{
gSpecialVar_0x8005 = 5;
gSpecialVar_0x8006 = 4;
@ -2253,7 +2253,7 @@ void sub_813A080(void)
for (i = 0; i < 9; i++)
{
if (gUnknown_085B2CDC[i] > gSaveBlock2Ptr->frontier.field_CE0[battleMode][lvlMode])
if (gUnknown_085B2CDC[i] > gSaveBlock2Ptr->frontier.winStreaks[battleMode][lvlMode])
{
gSpecialVar_0x8005 = 4;
gSpecialVar_0x8006 = i + 5;
@ -2733,8 +2733,6 @@ static void sub_813A46C(s32 itemIndex, bool8 onInit, struct ListMenu *list)
}
}
// stupid r5<->r6 swap
#ifdef NONMATCHING
static void sub_813A4EC(u8 taskId)
{
struct Task *task = &gTasks[taskId];
@ -2752,7 +2750,11 @@ static void sub_813A4EC(u8 taskId)
default:
gSpecialVar_Result = itemId;
PlaySE(SE_SELECT);
if (!task->data[6] || itemId == task->data[1] - 1)
if (!task->data[6])
{
sub_813A570(taskId);
}
else if (itemId == task->data[1] - 1)
{
sub_813A570(taskId);
}
@ -2765,72 +2767,6 @@ static void sub_813A4EC(u8 taskId)
break;
}
}
#else
NAKED
static void sub_813A4EC(u8 taskId)
{
asm_unified("push {r4-r6,lr}\n\
lsls r0, 24\n\
lsrs r5, r0, 24\n\
lsls r0, r5, 2\n\
adds r0, r5\n\
lsls r0, 3\n\
ldr r1, =gTasks\n\
adds r6, r0, r1\n\
ldrh r0, [r6, 0x24]\n\
lsls r0, 24\n\
lsrs r0, 24\n\
bl ListMenuHandleInputGetItemId\n\
adds r4, r0, 0\n\
movs r0, 0x2\n\
negs r0, r0\n\
cmp r4, r0\n\
beq _0813A51C\n\
adds r0, 0x1\n\
cmp r4, r0\n\
bne _0813A530\n\
b _0813A566\n\
.pool\n\
_0813A51C:\n\
ldr r1, =gSpecialVar_Result\n\
movs r0, 0x7F\n\
strh r0, [r1]\n\
movs r0, 0x5\n\
bl PlaySE\n\
b _0813A54C\n\
.pool\n\
_0813A530:\n\
ldr r0, =gSpecialVar_Result\n\
strh r4, [r0]\n\
movs r0, 0x5\n\
bl PlaySE\n\
movs r1, 0x14\n\
ldrsh r0, [r6, r1]\n\
cmp r0, 0\n\
beq _0813A54C\n\
movs r1, 0xA\n\
ldrsh r0, [r6, r1]\n\
subs r0, 0x1\n\
cmp r4, r0\n\
bne _0813A558\n\
_0813A54C:\n\
adds r0, r5, 0\n\
bl sub_813A570\n\
b _0813A566\n\
.pool\n\
_0813A558:\n\
adds r0, r5, 0\n\
bl sub_813A738\n\
ldr r0, =sub_813A600\n\
str r0, [r6]\n\
bl EnableBothScriptContexts\n\
_0813A566:\n\
pop {r4-r6}\n\
pop {r0}\n\
bx r0\n\
.pool");
}
#endif // NONMATCHING
static void sub_813A570(u8 taskId)
{

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

@ -2879,10 +2879,10 @@ void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 m
u8 language;
u32 otId = gApprentices[src->id].otId;
u32 personality = ((gApprentices[src->id].otId >> 8) | ((gApprentices[src->id].otId & 0xFF) << 8))
+ src->monData[monId].species + src->number;
+ src->party[monId].species + src->number;
CreateMon(mon,
src->monData[monId].species,
src->party[monId].species,
GetFrontierEnemyMonLevel(src->lvlMode - 1),
0x1F,
TRUE,
@ -2890,9 +2890,9 @@ void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 m
TRUE,
otId);
SetMonData(mon, MON_DATA_HELD_ITEM, &src->monData[monId].item);
SetMonData(mon, MON_DATA_HELD_ITEM, &src->party[monId].item);
for (i = 0; i < 4; i++)
SetMonMoveSlot(mon, src->monData[monId].moves[i], i);
SetMonMoveSlot(mon, src->party[monId].moves[i], i);
evAmount = MAX_TOTAL_EVS / NUM_STATS;
for (i = 0; i < NUM_STATS; i++)

View File

@ -69,6 +69,7 @@ struct PlayerRecordsRS
struct EasyChatPair easyChatPairs[5];
struct RecordMixingDayCareMail dayCareMail;
struct RSBattleTowerRecord battleTowerRecord;
u16 giftItem;
u16 filler11C8[0x32];
};
@ -81,7 +82,7 @@ struct PlayerRecordsEmerald
/* 0x1084 */ struct EasyChatPair easyChatPairs[5];
/* 0x10ac */ struct RecordMixingDayCareMail dayCareMail;
/* 0x1124 */ struct EmeraldBattleTowerRecord battleTowerRecord;
/* 0x1210 */ u16 unk_1210;
/* 0x1210 */ u16 giftItem;
/* 0x1214 */ LilycoveLady lilycoveLady;
/* 0x1254 */ struct Apprentice apprentice[2];
/* 0x12dc */ struct UnkRecordMixingStruct2 unk_12dc;
@ -132,7 +133,7 @@ static void ReceiveBattleTowerData(void *battleTowerRecord, size_t, u8);
static void ReceiveLilycoveLadyData(LilycoveLady *, size_t, u8);
static void sub_80E7B2C(const u8 *);
static void ReceiveDaycareMailData(struct RecordMixingDayCareMail *, size_t, u8, TVShow *);
static void sub_80E7F68(u16 *item, u8 which);
static void ReceiveGiftItem(u16 *item, u8 which);
static void sub_80E7FF8(u8 taskId);
static void sub_80E8110(struct Apprentice *arg0, struct Apprentice *arg1);
static void ReceiveApprenticeData(struct Apprentice *arg0, size_t arg1, u32 arg2);
@ -197,10 +198,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)
@ -212,10 +213,10 @@ static void PrepareUnknownExchangePacket(struct PlayerRecordsRS *dest)
memcpy(&dest->oldMan, sOldManSave, sizeof(dest->oldMan));
memcpy(dest->easyChatPairs, sEasyChatPairsSave, sizeof(dest->easyChatPairs));
sub_80E89F8(&dest->dayCareMail);
sub_81659DC(sBattleTowerSave, &dest->battleTowerRecord);
EmeraldBattleTowerRecordToRuby(sBattleTowerSave, &dest->battleTowerRecord);
if (GetMultiplayerId() == 0)
dest->battleTowerRecord.unk_11c8 = GetRecordMixingGift();
dest->giftItem = GetRecordMixingGift();
}
static void PrepareExchangePacketForRubySapphire(struct PlayerRecordsRS *dest)
@ -230,11 +231,11 @@ static void PrepareExchangePacketForRubySapphire(struct PlayerRecordsRS *dest)
memcpy(dest->easyChatPairs, sEasyChatPairsSave, sizeof(dest->easyChatPairs));
sub_80E89F8(&dest->dayCareMail);
SanitizeDayCareMailForRuby(&dest->dayCareMail);
sub_81659DC(sBattleTowerSave, &dest->battleTowerRecord);
EmeraldBattleTowerRecordToRuby(sBattleTowerSave, &dest->battleTowerRecord);
SanitizeRubyBattleTowerRecord(&dest->battleTowerRecord);
if (GetMultiplayerId() == 0)
dest->battleTowerRecord.unk_11c8 = GetRecordMixingGift();
dest->giftItem = GetRecordMixingGift();
}
static void PrepareExchangePacket(void)
@ -263,7 +264,7 @@ static void PrepareExchangePacket(void)
SanitizeEmeraldBattleTowerRecord(&sSentRecord->emerald.battleTowerRecord);
if (GetMultiplayerId() == 0)
sSentRecord->emerald.unk_1210 = GetRecordMixingGift();
sSentRecord->emerald.giftItem = GetRecordMixingGift();
sub_80E8110(sSentRecord->emerald.apprentice, gUnknown_03001154);
sub_80E8260(&sSentRecord->emerald.unk_12dc);
@ -283,7 +284,7 @@ static void ReceiveExchangePacket(u32 which)
ReceivePokeNewsData(sReceivedRecords->ruby.pokeNews, sizeof(struct PlayerRecordsRS), which);
ReceiveOldManData(&sReceivedRecords->ruby.oldMan, sizeof(struct PlayerRecordsRS), which);
ReceiveEasyChatPairsData(sReceivedRecords->ruby.easyChatPairs, sizeof(struct PlayerRecordsRS), which);
sub_80E7F68(&sReceivedRecords->ruby.battleTowerRecord.unk_11c8, which);
ReceiveGiftItem(&sReceivedRecords->ruby.giftItem, which);
}
else
{
@ -296,7 +297,7 @@ static void ReceiveExchangePacket(u32 which)
ReceiveEasyChatPairsData(sReceivedRecords->emerald.easyChatPairs, sizeof(struct PlayerRecordsEmerald), which);
ReceiveDaycareMailData(&sReceivedRecords->emerald.dayCareMail, sizeof(struct PlayerRecordsEmerald), which, sReceivedRecords->emerald.tvShows);
ReceiveBattleTowerData(&sReceivedRecords->emerald.battleTowerRecord, sizeof(struct PlayerRecordsEmerald), which);
sub_80E7F68(&sReceivedRecords->emerald.unk_1210, which);
ReceiveGiftItem(&sReceivedRecords->emerald.giftItem, which);
ReceiveLilycoveLadyData(&sReceivedRecords->emerald.lilycoveLady, sizeof(struct PlayerRecordsEmerald), which);
ReceiveApprenticeData(sReceivedRecords->emerald.apprentice, sizeof(struct PlayerRecordsEmerald), (u8) which);
sub_80E89AC(&sReceivedRecords->emerald.unk_12dc, sizeof(struct PlayerRecordsEmerald), (u8) which);
@ -667,7 +668,7 @@ static void ReceiveBattleTowerData(void *battleTowerRecord, size_t recordSize, u
ShufflePlayerIndices(mixIndices);
if (Link_AnyPartnersPlayingRubyOrSapphire())
{
if (sub_816587C((void *)battleTowerRecord + recordSize * mixIndices[which], (void *)battleTowerRecord + recordSize * which) == TRUE)
if (RubyBattleTowerRecordToEmerald((void *)battleTowerRecord + recordSize * mixIndices[which], (void *)battleTowerRecord + recordSize * which) == TRUE)
{
dest = (void *)battleTowerRecord + recordSize * which;
dest->language = gLinkPlayers[mixIndices[which]].language;
@ -676,7 +677,7 @@ static void ReceiveBattleTowerData(void *battleTowerRecord, size_t recordSize, u
}
else
{
memcpy((void *)battleTowerRecord + recordSize * which, (void *)battleTowerRecord + recordSize * mixIndices[which], sizeof(union BattleTowerRecord));
memcpy((void *)battleTowerRecord + recordSize * which, (void *)battleTowerRecord + recordSize * mixIndices[which], sizeof(struct EmeraldBattleTowerRecord));
dest = (void *)battleTowerRecord + recordSize * which;
for (i = 0; i < 4; i ++)
{
@ -686,7 +687,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)
@ -1460,7 +1461,7 @@ static void ReceiveDaycareMailData(struct RecordMixingDayCareMail *src, size_t r
}
#endif // NONMATCHING
static void sub_80E7F68(u16 *item, u8 which)
static void ReceiveGiftItem(u16 *item, u8 which)
{
if (which != 0 && *item != ITEM_NONE && GetPocketByItemId(*item) == POCKET_KEY_ITEMS)
{

View File

@ -402,73 +402,73 @@ u32 MoveRecordedBattleToSaveData(void)
{
for (i = 0; i < 8; i++)
{
battleSave->field_504[i] = gSaveBlock2Ptr->field_738[gTrainerBattleOpponent_A - 300].field_4[i];
battleSave->field_504[i] = gSaveBlock2Ptr->records[gTrainerBattleOpponent_A - 300].field_4[i];
}
battleSave->field_50C = gSaveBlock2Ptr->field_738[gTrainerBattleOpponent_A - 300].field_1;
battleSave->field_50C = gSaveBlock2Ptr->records[gTrainerBattleOpponent_A - 300].field_1;
if (sUnknown_0203CCE8 == 1)
{
for (i = 0; i < 6; i++)
{
battleSave->field_50E[i] = gSaveBlock2Ptr->field_738[gTrainerBattleOpponent_A - 300].field_28[i];
battleSave->field_50E[i] = gSaveBlock2Ptr->records[gTrainerBattleOpponent_A - 300].field_28[i];
}
}
else
{
for (i = 0; i < 6; i++)
{
battleSave->field_50E[i] = gSaveBlock2Ptr->field_738[gTrainerBattleOpponent_A - 300].field_1C[i];
battleSave->field_50E[i] = gSaveBlock2Ptr->records[gTrainerBattleOpponent_A - 300].field_1C[i];
}
}
battleSave->field_51A = gSaveBlock2Ptr->field_738[gTrainerBattleOpponent_A - 300].field_E4;
battleSave->field_51A = gSaveBlock2Ptr->records[gTrainerBattleOpponent_A - 300].field_E4;
}
else if (gTrainerBattleOpponent_B >= 300 && gTrainerBattleOpponent_B <= 399)
{
for (i = 0; i < 8; i++)
{
battleSave->field_504[i] = gSaveBlock2Ptr->field_738[gTrainerBattleOpponent_B - 300].field_4[i];
battleSave->field_504[i] = gSaveBlock2Ptr->records[gTrainerBattleOpponent_B - 300].field_4[i];
}
battleSave->field_50C = gSaveBlock2Ptr->field_738[gTrainerBattleOpponent_B - 300].field_1;
battleSave->field_50C = gSaveBlock2Ptr->records[gTrainerBattleOpponent_B - 300].field_1;
if (sUnknown_0203CCE8 == 1)
{
for (i = 0; i < 6; i++)
{
battleSave->field_50E[i] = gSaveBlock2Ptr->field_738[gTrainerBattleOpponent_B - 300].field_28[i];
battleSave->field_50E[i] = gSaveBlock2Ptr->records[gTrainerBattleOpponent_B - 300].field_28[i];
}
}
else
{
for (i = 0; i < 6; i++)
{
battleSave->field_50E[i] = gSaveBlock2Ptr->field_738[gTrainerBattleOpponent_B - 300].field_1C[i];
battleSave->field_50E[i] = gSaveBlock2Ptr->records[gTrainerBattleOpponent_B - 300].field_1C[i];
}
}
battleSave->field_51A = gSaveBlock2Ptr->field_738[gTrainerBattleOpponent_B - 300].field_E4;
battleSave->field_51A = gSaveBlock2Ptr->records[gTrainerBattleOpponent_B - 300].field_E4;
}
else if (gPartnerTrainerId >= 300 && gPartnerTrainerId <= 399)
{
for (i = 0; i < 8; i++)
{
battleSave->field_504[i] = gSaveBlock2Ptr->field_738[gPartnerTrainerId - 300].field_4[i];
battleSave->field_504[i] = gSaveBlock2Ptr->records[gPartnerTrainerId - 300].field_4[i];
}
battleSave->field_50C = gSaveBlock2Ptr->field_738[gPartnerTrainerId - 300].field_1;
battleSave->field_50C = gSaveBlock2Ptr->records[gPartnerTrainerId - 300].field_1;
if (sUnknown_0203CCE8 == 1)
{
for (i = 0; i < 6; i++)
{
battleSave->field_50E[i] = gSaveBlock2Ptr->field_738[gPartnerTrainerId - 300].field_28[i];
battleSave->field_50E[i] = gSaveBlock2Ptr->records[gPartnerTrainerId - 300].field_28[i];
}
}
else
{
for (i = 0; i < 6; i++)
{
battleSave->field_50E[i] = gSaveBlock2Ptr->field_738[gPartnerTrainerId - 300].field_1C[i];
battleSave->field_50E[i] = gSaveBlock2Ptr->records[gPartnerTrainerId - 300].field_1C[i];
}
}
battleSave->field_51A = gSaveBlock2Ptr->field_738[gPartnerTrainerId - 300].field_E4;
battleSave->field_51A = gSaveBlock2Ptr->records[gPartnerTrainerId - 300].field_E4;
}
*/

View File

@ -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;
}

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

@ -1544,7 +1544,7 @@ static void InterviewAfter_BravoTrainerBattleTowerProfile(void)
StringCopy(show->bravoTrainerTower.pokemonName, gSaveBlock2Ptr->frontier.field_BD8);
show->bravoTrainerTower.species = gSaveBlock2Ptr->frontier.field_BD4;
show->bravoTrainerTower.defeatedSpecies = gSaveBlock2Ptr->frontier.field_BD6;
show->bravoTrainerTower.numFights = sub_8164FCC(gSaveBlock2Ptr->frontier.field_D07, 0);
show->bravoTrainerTower.numFights = GetCurrentBattleTowerWinStreak(gSaveBlock2Ptr->frontier.field_D07, 0);
show->bravoTrainerTower.wonTheChallenge = gSaveBlock2Ptr->frontier.field_D06;
if (gSaveBlock2Ptr->frontier.field_D07 == 0)
{
@ -2540,8 +2540,8 @@ void sub_80EE8C8(u16 winStreak, u8 facility)
show->frontier.species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL);
break;
case 4:
show->frontier.species1 = GetMonData(&gSaveBlock1Ptr->playerParty[gSaveBlock2Ptr->frontier.field_CAA[0] - 1], MON_DATA_SPECIES, NULL);
show->frontier.species2 = GetMonData(&gSaveBlock1Ptr->playerParty[gSaveBlock2Ptr->frontier.field_CAA[1] - 1], MON_DATA_SPECIES, NULL);
show->frontier.species1 = GetMonData(&gSaveBlock1Ptr->playerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[0] - 1], MON_DATA_SPECIES, NULL);
show->frontier.species2 = GetMonData(&gSaveBlock1Ptr->playerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[1] - 1], MON_DATA_SPECIES, NULL);
break;
}
tv_store_id_3x(show);

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;

View File

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