Merge pull request #272 from DizzyEggg/final_battle_files_touches

Thoroughly document and label battle files
This commit is contained in:
Diegoisawesome 2018-07-16 13:35:17 -07:00 committed by GitHub
commit 06b3ce408f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
89 changed files with 3304 additions and 2671 deletions

View File

@ -19871,8 +19871,8 @@ _081A4C84:
.pool
thumb_func_end sub_81A4C30
thumb_func_start sub_81A4CB0
sub_81A4CB0: @ 81A4CB0
thumb_func_start GetFrontierBrainTrainerPicIndex
GetFrontierBrainTrainerPicIndex: @ 81A4CB0
push {lr}
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
@ -19881,7 +19881,7 @@ sub_81A4CB0: @ 81A4CB0
ands r0, r1
cmp r0, 0
beq _081A4CD0
bl sub_8185EA0
bl GetRecordedBattleFrontierFacility
lsls r0, 24
lsrs r0, 24
b _081A4CDA
@ -19893,7 +19893,7 @@ _081A4CD0:
lsrs r0, 16
_081A4CDA:
ldr r2, =gTrainers
ldr r1, =gUnknown_08611D30
ldr r1, =gFacilityToBrainTrainerId
lsls r0, 1
adds r0, r1
ldrh r1, [r0]
@ -19905,10 +19905,10 @@ _081A4CDA:
pop {r1}
bx r1
.pool
thumb_func_end sub_81A4CB0
thumb_func_end GetFrontierBrainTrainerPicIndex
thumb_func_start sub_81A4D00
sub_81A4D00: @ 81A4D00
thumb_func_start GetFrontierBrainTrainerClass
GetFrontierBrainTrainerClass: @ 81A4D00
push {lr}
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
@ -19917,7 +19917,7 @@ sub_81A4D00: @ 81A4D00
ands r0, r1
cmp r0, 0
beq _081A4D20
bl sub_8185EA0
bl GetRecordedBattleFrontierFacility
lsls r0, 24
lsrs r0, 24
b _081A4D2A
@ -19929,7 +19929,7 @@ _081A4D20:
lsrs r0, 16
_081A4D2A:
ldr r2, =gTrainers
ldr r1, =gUnknown_08611D30
ldr r1, =gFacilityToBrainTrainerId
lsls r0, 1
adds r0, r1
ldrh r1, [r0]
@ -19941,10 +19941,10 @@ _081A4D2A:
pop {r1}
bx r1
.pool
thumb_func_end sub_81A4D00
thumb_func_end GetFrontierBrainTrainerClass
thumb_func_start sub_81A4D50
sub_81A4D50: @ 81A4D50
thumb_func_start CopyFrontierBrainTrainerName
CopyFrontierBrainTrainerName: @ 81A4D50
push {r4,lr}
adds r4, r0, 0
ldr r0, =gBattleTypeFlags
@ -19954,7 +19954,7 @@ sub_81A4D50: @ 81A4D50
ands r0, r1
cmp r0, 0
beq _081A4D70
bl sub_8185EA0
bl GetRecordedBattleFrontierFacility
lsls r0, 24
lsrs r0, 24
b _081A4D7A
@ -19968,7 +19968,7 @@ _081A4D7A:
movs r3, 0
lsls r0, 1
ldr r2, =gTrainers
ldr r1, =gUnknown_08611D30
ldr r1, =gFacilityToBrainTrainerId
adds r0, r1
ldrh r1, [r0]
lsls r0, r1, 2
@ -19991,7 +19991,7 @@ _081A4D90:
pop {r0}
bx r0
.pool
thumb_func_end sub_81A4D50
thumb_func_end CopyFrontierBrainTrainerName
thumb_func_start sub_81A4DB8
sub_81A4DB8: @ 81A4DB8
@ -20483,7 +20483,7 @@ sub_81A51A8: @ 81A51A8
ands r0, r1
cmp r0, 0
beq _081A51D4
bl sub_8185EA0
bl GetRecordedBattleFrontierFacility
lsls r0, 24
lsrs r4, r0, 24
bl sub_8185EAC
@ -20646,29 +20646,29 @@ _081A5328:
ldr r4, =gDisplayedStringBattle
adds r0, r4, 0
movs r1, 0xF
bl BattleHandleAddTextPrinter
bl BattlePutTextOnWindow
ldr r0, =gText_Vs
movs r1, 0x10
bl BattleHandleAddTextPrinter
bl BattlePutTextOnWindow
ldr r0, =gText_OpponentMon1Name
bl BattleStringExpandPlaceholdersToDisplayedString
adds r0, r4, 0
movs r1, 0x11
bl BattleHandleAddTextPrinter
bl BattlePutTextOnWindow
ldr r0, =gText_Mind
movs r1, 0x12
bl BattleHandleAddTextPrinter
bl BattlePutTextOnWindow
ldr r0, =gText_Skill
movs r1, 0x13
bl BattleHandleAddTextPrinter
bl BattlePutTextOnWindow
ldr r0, =gText_Body
movs r1, 0x14
bl BattleHandleAddTextPrinter
bl BattlePutTextOnWindow
ldr r0, =gText_Judgement
bl BattleStringExpandPlaceholdersToDisplayedString
adds r0, r4, 0
movs r1, 0x15
bl BattleHandleAddTextPrinter
bl BattlePutTextOnWindow
b _081A553E
.pool
_081A53B4:
@ -20752,7 +20752,7 @@ _081A5464:
bl BattleStringExpandPlaceholdersToDisplayedString
ldr r0, =gDisplayedStringBattle
movs r1, 0x15
bl BattleHandleAddTextPrinter
bl BattlePutTextOnWindow
ldrb r0, [r5]
adds r0, 0x1
strb r0, [r5]

View File

@ -1353,7 +1353,7 @@ _08162AD0:
ldr r0, =0x000003fe
cmp r4, r0
bne _08162AE4
bl sub_81A4CB0
bl GetFrontierBrainTrainerPicIndex
lsls r0, 24
lsrs r0, 24
b _08162BCA
@ -1479,7 +1479,7 @@ _08162C08:
ldr r0, =0x000003fe
cmp r4, r0
bne _08162C1C
bl sub_81A4D00
bl GetFrontierBrainTrainerClass
lsls r0, 24
lsrs r0, 24
b _08162D1E
@ -1729,7 +1729,7 @@ _08162E54:
cmp r5, r0
bne _08162E68
adds r0, r6, 0
bl sub_81A4D50
bl CopyFrontierBrainTrainerName
b _08162F62
.pool
_08162E68:

View File

@ -6770,8 +6770,8 @@ _080DB1CC:
bl LoadCompressedPalette
adds r0, r5, 0
movs r1, 0
bl sub_806A068
ldr r4, =gUnknown_0202499C
bl SetMultiuseSpriteTemplateToPokemon
ldr r4, =gMultiuseSpriteTemplate
movs r0, 0x2
adds r1, r5, 0
movs r2, 0

View File

@ -1420,8 +1420,8 @@ _080F64F2:
bl LoadCompressedObjectPalette
adds r0, r6, 0
movs r1, 0x1
bl sub_806A068
ldr r0, =gUnknown_0202499C
bl SetMultiuseSpriteTemplateToPokemon
ldr r0, =gMultiuseSpriteTemplate
ldrh r1, [r4, 0x4]
strh r1, [r0, 0x2]
movs r1, 0x88

View File

@ -511,7 +511,7 @@
.byte \bank
.endm
.macro atk5F
.macro swapattackerwithtarget
.byte 0x5f
.endm
@ -525,7 +525,7 @@
.byte \bank
.endm
.macro atk62 bank
.macro hidepartystatussummary bank
.byte 0x62
.byte \bank
.endm
@ -1163,7 +1163,7 @@
.4byte \param0
.endm
.macro snatchsetbanks
.macro snatchsetbattlers
.byte 0xed
.endm

View File

@ -12158,7 +12158,7 @@ sub_81B672C: @ 81B672C
bl sub_81B1B5C
movs r0, 0x2
bl schedule_bg_copy_tilemap_to_vram
bl sub_805EAE8
bl HandleBattleLowHpMusicChange
ldr r1, =gTasks
lsls r0, r5, 2
adds r0, r5
@ -16079,8 +16079,8 @@ _081B89A6:
bx r1
thumb_func_end sub_81B8984
thumb_func_start sub_81B89AC
sub_81B89AC: @ 81B89AC
thumb_func_start OpenPartyMenuInBattle
OpenPartyMenuInBattle: @ 81B89AC
push {r4,lr}
sub sp, 0xC
adds r4, r0, 0
@ -16107,7 +16107,7 @@ sub_81B89AC: @ 81B89AC
pop {r0}
bx r0
.pool
thumb_func_end sub_81B89AC
thumb_func_end OpenPartyMenuInBattle
thumb_func_start sub_81B89F0
sub_81B89F0: @ 81B89F0
@ -16288,7 +16288,7 @@ _081B8B94:
ldrb r0, [r0, 0xB]
cmp r0, 0x4
bne _081B8BA8
bl sub_806E994
bl SetMonPreventsSwitchingString
b _081B8C46
.pool
_081B8BA8:

View File

@ -1092,7 +1092,7 @@ _081C4750:
bl LoadCompressedObjectPalette
ldrh r0, [r4, 0x4]
movs r1, 0x1
bl sub_806A068
bl SetMultiuseSpriteTemplateToPokemon
_081C4768:
ldrh r0, [r6]
adds r0, 0x1
@ -1116,7 +1116,7 @@ sub_81C4778: @ 81C4778
bne _081C47AE
adds r0, r1, 0
adds r0, 0xC
bl ShouldPlayNormalPokeCry
bl ShouldPlayNormalMonCry
cmp r0, 0x1
bne _081C47A4
ldrh r0, [r4, 0x2]
@ -1144,7 +1144,7 @@ sub_81C47B4: @ 81C47B4
ldr r0, =gUnknown_0203CF1C
ldr r6, [r0]
adds r6, 0x70
ldr r0, =gUnknown_0202499C
ldr r0, =gMultiuseSpriteTemplate
movs r1, 0x28
movs r2, 0x40
movs r3, 0x5
@ -5297,7 +5297,7 @@ sub_81C6BD8: @ 81C6BD8
movs r0, 0
movs r1, 0xA
movs r2, 0xD0
bl copy_textbox_border_tile_patterns_to_vram
bl LoadMessageBoxGfx
ldr r0, =gUnknown_0860F074
movs r1, 0xF0
movs r2, 0x20

View File

@ -11351,7 +11351,7 @@ sub_81CCA1C: @ 81CCA1C
lsrs r0, 24
movs r1, 0x42
movs r2, 0x40
bl box_border_load_tiles_and_pal
bl LoadUserWindowBorderGfx_
ldrb r0, [r5, 0x8]
movs r1, 0x42
movs r2, 0x4

View File

@ -10976,7 +10976,7 @@ _08018574:
movs r0, 0
movs r1, 0x1
movs r2, 0xF0
bl box_border_load_tiles_and_pal
bl LoadUserWindowBorderGfx_
movs r4, 0x20
str r4, [sp]
str r4, [sp, 0x4]
@ -15911,7 +15911,7 @@ _0801AD8C:
movs r0, 0
movs r1, 0x1
movs r2, 0xD0
bl box_border_load_tiles_and_pal
bl LoadUserWindowBorderGfx_
bl sub_819789C
ldr r0, =sub_801AC40
bl SetVBlankCallback
@ -27085,7 +27085,7 @@ sub_8020740: @ 8020740
movs r0, 0x3
movs r1, 0xA
movs r2, 0x20
bl box_border_load_tiles_and_pal
bl LoadUserWindowBorderGfx_
ldr r0, =gUnknown_0860F074
movs r1, 0xE0
movs r2, 0x20
@ -30171,7 +30171,7 @@ _0802210C:
ldr r4, =0x0000021d
adds r1, r4, 0
movs r2, 0xD0
bl box_border_load_tiles_and_pal
bl LoadUserWindowBorderGfx_
ldrb r0, [r5]
movs r1, 0
adds r2, r4, 0
@ -30370,7 +30370,7 @@ _08022296:
ldr r4, =0x0000021d
adds r1, r4, 0
movs r2, 0xD0
bl box_border_load_tiles_and_pal
bl LoadUserWindowBorderGfx_
ldrb r0, [r6, 0x2]
movs r1, 0
adds r2, r4, 0
@ -35221,7 +35221,7 @@ sub_80248B0: @ 80248B0
ldr r5, =0x0000021d
adds r1, r5, 0
movs r2, 0xD0
bl box_border_load_tiles_and_pal
bl LoadUserWindowBorderGfx_
ldrb r4, [r4]
bl sub_80247BC
adds r3, r0, 0
@ -41645,7 +41645,7 @@ sub_8027BEC: @ 8027BEC
adds r0, r7, 0
adds r1, r4, 0
movs r2, 0xD0
bl box_border_load_tiles_and_pal
bl LoadUserWindowBorderGfx_
adds r0, r7, 0
adds r1, r4, 0
movs r2, 0xD
@ -44214,7 +44214,7 @@ sub_802902C: @ 802902C
movs r0, 0
movs r1, 0xA
movs r2, 0xB0
bl box_border_load_tiles_and_pal
bl LoadUserWindowBorderGfx_
pop {r0}
bx r0
thumb_func_end sub_802902C
@ -54638,7 +54638,7 @@ sub_802E500: @ 802E500
adds r0, r4, 0
adds r1, r5, 0
movs r2, 0xD0
bl box_border_load_tiles_and_pal
bl LoadUserWindowBorderGfx_
adds r0, r4, 0
adds r1, r5, 0
movs r2, 0xD

View File

@ -737,8 +737,8 @@ _080F8DD8:
bl LoadCompressedObjectPalette
adds r0, r6, 0
movs r1, 0x1
bl sub_806A068
ldr r0, =gUnknown_0202499C
bl SetMultiuseSpriteTemplateToPokemon
ldr r0, =gMultiuseSpriteTemplate
ldrh r1, [r4, 0x4]
strh r1, [r0, 0x2]
mov r1, r9

View File

@ -1161,7 +1161,7 @@ BuyMenuInitWindows: @ 80E0468
movs r0, 0
movs r1, 0xA
movs r2, 0xE0
bl copy_textbox_border_tile_patterns_to_vram
bl LoadMessageBoxGfx
movs r0, 0
bl PutWindowTilemap
movs r0, 0x1

View File

@ -634,7 +634,7 @@ sub_812AA48: @ 812AA48
lsls r1, 2
movs r0, 0
movs r2, 0xF0
bl copy_textbox_border_tile_patterns_to_vram
bl LoadMessageBoxGfx
movs r1, 0x85
lsls r1, 2
movs r0, 0

View File

@ -241,7 +241,7 @@ _08077310:
movs r0, 0
movs r1, 0x14
movs r2, 0xC0
bl box_border_load_tiles_and_pal
bl LoadUserWindowBorderGfx_
movs r0, 0x2
movs r1, 0x1
movs r2, 0xE0
@ -7174,8 +7174,8 @@ _0807ADE0:
bl GetMonSpritePalStruct
ldrh r0, [r0, 0x4]
adds r1, r4, 0
bl sub_806A068
ldr r0, =gUnknown_0202499C
bl SetMultiuseSpriteTemplateToPokemon
ldr r0, =gMultiuseSpriteTemplate
movs r1, 0x78
movs r2, 0x3C
movs r3, 0x6

View File

@ -3382,11 +3382,11 @@ AI_Safari_Flee:
flee
AI_FirstBattle:
if_hp_equal AI_TARGET, 20, BattleAIScript_82DE34D
if_hp_less_than AI_TARGET, 20, BattleAIScript_82DE34D
if_hp_equal AI_TARGET, 20, AI_FirstBattle_Flee
if_hp_less_than AI_TARGET, 20, AI_FirstBattle_Flee
end
BattleAIScript_82DE34D:
AI_FirstBattle_Flee:
flee
AI_Ret:

View File

@ -1,5 +1,6 @@
#include "constants/moves.h"
#include "constants/species.h"
#include "constants/trainers.h"
.include "asm/macros.inc"
.include "constants/constants.inc"
@ -1049,8 +1050,10 @@ gUnknown_08611D08:: @ 8611D08
.4byte gUnknown_085EE3C4
.align 1
gUnknown_08611D30:: @ 8611D30
.2byte 0x0325, 0x0326, 0x0327, 0x0328, 0x0329, 0x032a, 0x032b, 0x0000
gFacilityToBrainTrainerId:: @ 8611D30
.2byte TRAINER_ANABEL, TRAINER_TUCKER, TRAINER_SPENSER
.2byte TRAINER_GRETA, TRAINER_NOLAND, TRAINER_LUCY
.2byte TRAINER_BRANDON
.align 2
gUnknown_08611D40:: @ 8611D40

View File

@ -2873,7 +2873,7 @@ BattleScript_FaintedMonTryChooseAnother::
jumpifnotbattletype BATTLE_TYPE_TRAINER, BattleScript_FaintedMonChooseAnother
jumpifbattletype BATTLE_TYPE_LINK, BattleScript_FaintedMonChooseAnother
jumpifbattletype BATTLE_TYPE_x2000000, BattleScript_FaintedMonChooseAnother
jumpifbattletype BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID, BattleScript_FaintedMonChooseAnother
jumpifbattletype BATTLE_TYPE_FRONTIER, BattleScript_FaintedMonChooseAnother
jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_FaintedMonChooseAnother
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_x400000, BattleScript_FaintedMonChooseAnother
jumpifbyte CMP_EQUAL, sBATTLE_STYLE, 0x1, BattleScript_FaintedMonChooseAnother
@ -2899,7 +2899,7 @@ BattleScript_FaintedMonTryChooseAnother::
switchindataupdate BS_ATTACKER
hpthresholds BS_ATTACKER
printstring STRINGID_SWITCHINMON
atk62 BS_ATTACKER
hidepartystatussummary BS_ATTACKER
switchinanim BS_ATTACKER, 0x0
waitstate
switchineffects BS_ATTACKER
@ -2910,7 +2910,7 @@ BattleScript_FaintedMonChooseAnother::
switchindataupdate BS_FAINTED
hpthresholds BS_FAINTED
printstring STRINGID_SWITCHINMON
atk62 BS_FAINTED
hidepartystatussummary BS_FAINTED
switchinanim BS_FAINTED, FALSE
waitstate
various7 BS_ATTACKER
@ -2933,7 +2933,7 @@ BattleScript_82DA908::
switchindataupdate BS_FAINTED
hpthresholds BS_FAINTED
printstring STRINGID_SWITCHINMON
atk62 BS_FAINTED
hidepartystatussummary BS_FAINTED
switchinanim BS_FAINTED, FALSE
waitstate
switchineffects 5
@ -2968,7 +2968,7 @@ BattleScript_PayDayMoneyAndPickUpItems::
BattleScript_LocalBattleLost::
jumpifbattletype BATTLE_TYPE_DOME, BattleScript_CheckDomeDrew
jumpifbattletype BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID, BattleScript_LocalBattleLostPrintTrainersWinText
jumpifbattletype BATTLE_TYPE_FRONTIER, BattleScript_LocalBattleLostPrintTrainersWinText
jumpifbattletype BATTLE_TYPE_x4000000, BattleScript_LocalBattleLostPrintTrainersWinText
jumpifbattletype BATTLE_TYPE_EREADER_TRAINER, BattleScript_LocalBattleLostEnd
jumpifhalfword CMP_EQUAL, gTrainerBattleOpponent_A, 0x400, BattleScript_LocalBattleLostEnd
@ -3120,10 +3120,10 @@ BattleScript_PursuitSwitchDmgSetMultihit::
setmultihit 0x2
BattleScript_PursuitSwitchDmgLoop::
jumpifnopursuitswitchdmg BattleScript_DoSwitchOut
atk5F
swapattackerwithtarget
trysetdestinybondtohappen
call BattleScript_PursuitDmgOnSwitchOut
atk5F
swapattackerwithtarget
BattleScript_DoSwitchOut::
decrementmultihit BattleScript_PursuitSwitchDmgLoop
switchoutabilities BS_ATTACKER
@ -3136,7 +3136,7 @@ BattleScript_DoSwitchOut::
switchindataupdate BS_ATTACKER
hpthresholds BS_ATTACKER
printstring STRINGID_SWITCHINMON
atk62 BS_ATTACKER
hidepartystatussummary BS_ATTACKER
switchinanim BS_ATTACKER, FALSE
waitstate
switchineffects BS_ATTACKER
@ -3230,7 +3230,7 @@ BattleScript_DamagingWeatherContinues::
playanimation2 BS_ATTACKER, sB_ANIM_ARG1, NULL
setbyte gBattleCommunication, 0x0
BattleScript_DamagingWeatherLoop::
copyarraywithindex gBattlerAttacker, gBattleTurnOrder, gBattleCommunication, 0x1
copyarraywithindex gBattlerAttacker, gBattlerByTurnOrder, gBattleCommunication, 0x1
weatherdamage
jumpifword CMP_EQUAL, gBattleMoveDamage, 0x0, BattleScript_DamagingWeatherLoopIncrement
printfromtable gSandStormHailDmgStringIds
@ -3710,12 +3710,12 @@ BattleScript_MagicCoatBounce::
BattleScript_SnatchedMove::
attackstring
ppreduce
snatchsetbanks
snatchsetbattlers
playanimation BS_TARGET, B_ANIM_SNATCH_MOVE, NULL
printstring STRINGID_PKMNSNATCHEDMOVE
waitmessage 0x40
orword gHitMarker, HITMARKER_ATTACKSTRING_PRINTED | HITMARKER_NO_PPDEDUCT | HITMARKER_x800000
atk5F
swapattackerwithtarget
return
BattleScript_EnduredMsg::
@ -3991,7 +3991,7 @@ BattleScript_DrizzleActivates::
pause 0x20
printstring STRINGID_PKMNMADEITRAIN
waitstate
playanimation BS_BANK_0, B_ANIM_RAIN_CONTINUES, NULL
playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES, NULL
call BattleScript_WeatherFormChanges
end3
@ -4019,7 +4019,7 @@ BattleScript_SandstreamActivates::
pause 0x20
printstring STRINGID_PKMNSXWHIPPEDUPSANDSTORM
waitstate
playanimation BS_BANK_0, B_ANIM_SANDSTORM_CONTINUES, NULL
playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES, NULL
call BattleScript_WeatherFormChanges
end3
@ -4085,7 +4085,7 @@ BattleScript_DroughtActivates::
pause 0x20
printstring STRINGID_PKMNSXINTENSIFIEDSUN
waitstate
playanimation BS_BANK_0, B_ANIM_SUN_CONTINUES, NULL
playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL
call BattleScript_WeatherFormChanges
end3
@ -4561,8 +4561,8 @@ BattleScript_82DB973::
end2
BattleScript_82DB992::
various16 BS_BANK_0
various17 BS_BANK_0
various16 BS_BATTLER_0
various17 BS_BATTLER_0
various9 BS_ATTACKER
various15 BS_ATTACKER
printstring STRINGID_TIEDOPPONENTBYREFEREE

View File

@ -44,7 +44,7 @@ gBattlescriptsForSafariActions:: @ 82DBD58
.4byte BattleScript_ActionWatchesCarefully
.4byte BattleScript_ActionGetNear
.4byte BattleScript_ActionThrowPokeblock
.4byte BattleScript_82DBEE3
.4byte BattleScript_ActionWallyThrow
BattleScript_BallThrow::
jumpifword CMP_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_WALLY_TUTORIAL, BattleScript_BallThrowByWally
@ -176,17 +176,17 @@ BattleScript_RunByUsingItem::
setbyte gBattleOutcome, B_OUTCOME_RAN
finishturn
BattleScript_ActionWatchesCarefully::
BattleScript_ActionWatchesCarefully:
printstring STRINGID_PKMNWATCHINGCAREFULLY
waitmessage 0x40
end2
BattleScript_ActionGetNear::
BattleScript_ActionGetNear:
printfromtable gSafariGetNearStringIds
waitmessage 0x40
end2
BattleScript_ActionThrowPokeblock::
BattleScript_ActionThrowPokeblock:
printstring STRINGID_THREWPOKEBLOCKATPKMN
waitmessage 0x40
playanimation BS_ATTACKER, B_ANIM_x4, NULL
@ -194,7 +194,7 @@ BattleScript_ActionThrowPokeblock::
waitmessage 0x40
end2
BattleScript_82DBEE3::
BattleScript_ActionWallyThrow:
printstring STRINGID_RETURNMON
waitmessage 0x40
returnatktoball

View File

@ -235,7 +235,7 @@ gUnknown_082FF704:: @ 82FF704
.2byte 0x0003, 0x0000, 0xffff, 0x0000
.align 2
gUnknown_082FF70C:: @ 82FF70C
gPlayerMonSpriteAnimsTable:: @ 82FF70C
.4byte gUnknown_082FF6EC
.4byte gUnknown_082FF6F4
.4byte gUnknown_082FF6FC
@ -4684,7 +4684,7 @@ gUnknown_0831AA00:: @ 831AA00
obj_tiles gUnknown_08D77B0C, 0x1000, 0x2710
.align 2
gUnknown_0831AA08:: @ 831AA08
gBattleBgTemplates:: @ 831AA08
.4byte 0x00000580, 0x000005c5, 0x000013e6, 0x000033ab
.align 2
@ -4743,7 +4743,7 @@ gUnknown_0831AAE0:: @ 831AAE0
null_window_template
.align 2
gUnknown_0831ABA0:: @ 831ABA0
gBattleWindowTemplates:: @ 831ABA0
.4byte gUnknown_0831AA18
.4byte gUnknown_0831AAE0
@ -4862,7 +4862,3 @@ gUnknown_0831ACC4:: @ 831ACC4
.align 2
gUnknown_0831ACDC:: @ 831ACDC
.4byte gUnknown_0831ACC4
.align 2
gUnknown_0831ACE0:: @ 831ACE0
.byte 0xe0, 0xf0, 0xf0, 0xe0, 0xe0, 0x00, 0x00, 0x00

View File

@ -4,6 +4,7 @@
// should they be included here or included individually by every file?
#include "constants/battle.h"
#include "battle_main.h"
#include "battle_message.h"
#include "battle_util.h"
#include "battle_script_commands.h"
#include "battle_ai_switch_items.h"
@ -15,12 +16,6 @@
#define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE)
#define GET_BATTLER_SIDE2(battler) (GET_BATTLER_POSITION(battler) & BIT_SIDE)
#define TRAINER_OPPONENT_3FE 0x3FE
#define TRAINER_OPPONENT_C00 0xC00
#define TRAINER_OPPONENT_800 0x800
#define STEVEN_PARTNER_ID 0xC03
#define SECRET_BASE_OPPONENT 0x400
// Battle Actions
// These determine what each battler will do in a turn
#define B_ACTION_USE_MOVE 0
@ -33,7 +28,7 @@
#define B_ACTION_SAFARI_GO_NEAR 7
#define B_ACTION_SAFARI_RUN 8
// The exact purposes of these are unclear
#define B_ACTION_UNKNOWN9 9
#define B_ACTION_WALLY_THROW 9
#define B_ACTION_EXEC_SCRIPT 10 // when executing an action
#define B_ACTION_CANCEL_PARTNER 12 // when choosing an action
#define B_ACTION_FINISHED 12 // when executing an action
@ -150,29 +145,29 @@ struct DisableStruct
/*0x08*/ u8 protectUses;
/*0x09*/ u8 stockpileCounter;
/*0x0A*/ u8 substituteHP;
/*0x0B*/ u8 disableTimer1 : 4;
/*0x0B*/ u8 disableTimer2 : 4;
/*0x0B*/ u8 disableTimer1:4;
/*0x0B*/ u8 disableTimer2:4;
/*0x0C*/ u8 encoredMovePos;
/*0x0D*/ u8 unkD;
/*0x0E*/ u8 encoreTimer1 : 4;
/*0x0E*/ u8 encoreTimer2 : 4;
/*0x0F*/ u8 perishSongTimer1 : 4;
/*0x0F*/ u8 perishSongTimer2 : 4;
/*0x0E*/ u8 encoreTimer1:4;
/*0x0E*/ u8 encoreTimer2:4;
/*0x0F*/ u8 perishSongTimer1:4;
/*0x0F*/ u8 perishSongTimer2:4;
/*0x10*/ u8 furyCutterCounter;
/*0x11*/ u8 rolloutCounter1 : 4;
/*0x11*/ u8 rolloutCounter2 : 4;
/*0x12*/ u8 chargeTimer1 : 4;
/*0x12*/ u8 chargeTimer2 : 4;
/*0x11*/ u8 rolloutCounter1:4;
/*0x11*/ u8 rolloutCounter2:4;
/*0x12*/ u8 chargeTimer1:4;
/*0x12*/ u8 chargeTimer2:4;
/*0x13*/ u8 tauntTimer1:4;
/*0x13*/ u8 tauntTimer2:4;
/*0x14*/ u8 battlerPreventingEscape;
/*0x15*/ u8 battlerWithSureHit;
/*0x16*/ u8 isFirstTurn;
/*0x17*/ u8 unk17;
/*0x18*/ u8 truantCounter : 1;
/*0x18*/ u8 truantUnknownBit : 1;
/*0x18*/ u8 unk18_a_2 : 2;
/*0x18*/ u8 unk18_b : 4;
/*0x18*/ u8 truantCounter:1;
/*0x18*/ u8 truantUnknownBit:1;
/*0x18*/ u8 unk18_a_2:2;
/*0x18*/ u8 unk18_b:4;
/*0x19*/ u8 rechargeCounter;
/*0x1A*/ u8 unk1A[2];
};
@ -182,7 +177,7 @@ struct ProtectStruct
/* field_0 */
u32 protected:1;
u32 endured:1;
u32 onlyStruggle:1;
u32 noValidMoves:1;
u32 helpingHand:1;
u32 bounceMove:1;
u32 stealMove:1;
@ -201,12 +196,12 @@ struct ProtectStruct
u32 flag2Unknown:1; // 0x2
u32 flinchImmobility:1; // 0x4
u32 notFirstStrike:1; // 0x8
u32 flag_x10 : 1; // 0x10
u32 flag_x20 : 1; // 0x20
u32 flag_x40 : 1; // 0x40
u32 flag_x80 : 1; // 0x80
u32 flag_x10:1; // 0x10
u32 flag_x20:1; // 0x20
u32 flag_x40:1; // 0x40
u32 flag_x80:1; // 0x80
/* field_3 */
u32 field3 : 8;
u32 field3:8;
/* field_4 */ u32 physicalDmg;
/* field_8 */ u32 specialDmg;
@ -217,14 +212,14 @@ struct ProtectStruct
struct SpecialStatus
{
u8 statLowered : 1; // 0x1
u8 lightningRodRedirected : 1; // 0x2
u8 restoredBankSprite: 1; // 0x4
u8 intimidatedPoke : 1; // 0x8
u8 traced : 1; // 0x10
u8 flag20 : 1;
u8 flag40 : 1;
u8 focusBanded : 1;
u8 statLowered:1; // 0x1
u8 lightningRodRedirected:1; // 0x2
u8 restoredBattlerSprite: 1; // 0x4
u8 intimidatedMon:1; // 0x8
u8 traced:1; // 0x10
u8 flag20:1;
u8 flag40:1;
u8 focusBanded:1;
u8 field1[3];
s32 dmg;
s32 physicalDmg;
@ -336,20 +331,20 @@ struct BattleResults
u8 unk5_0:1; // 0x5
u8 usedMasterBall:1; // 0x5
u8 caughtMonBall:4; // 0x5
u8 unk5_6:1; // 0x5
u8 shinyWildMon:1; // 0x5
u8 unk5_7:1; // 0x5
u16 playerMon1Species; // 0x6
u8 playerMon1Name[11]; // 0x8
u8 playerMon1Name[POKEMON_NAME_LENGTH + 1]; // 0x8
u8 battleTurnCounter; // 0x13
u8 playerMon2Name[11]; // 0x14
u8 field_1F; // 0x1F
u8 playerMon2Name[POKEMON_NAME_LENGTH + 1]; // 0x14
u8 pokeblockThrows; // 0x1F
u16 lastOpponentSpecies; // 0x20
u16 lastUsedMovePlayer; // 0x22
u16 lastUsedMoveOpponent; // 0x24
u16 playerMon2Species; // 0x26
u16 caughtMonSpecies; // 0x28
u8 caughtMonNick[10]; // 0x2A
u8 filler34[2]; // 0x34
u8 caughtMonNick[POKEMON_NAME_LENGTH + 1]; // 0x2A
u8 filler35[1]; // 0x35
u8 catchAttempts[11]; // 0x36
};
@ -428,7 +423,7 @@ struct BattleTv_Mon
struct BattleTv
{
struct BattleTv_Mon mon[2][6]; // [side][partyId]
struct BattleTv_Mon mon[2][PARTY_SIZE]; // [side][partyId]
struct BattleTv_Position pos[2][2]; // [side][flank]
struct BattleTv_Side side[2]; // [side]
};
@ -461,7 +456,7 @@ struct BattleStruct
u8 field_46;
u8 field_47;
u8 focusPunchBattlerId;
u8 field_49;
u8 battlerPreventingSwitchout;
u8 moneyMultiplier;
u8 savedTurnActionNumber;
u8 switchInAbilitiesCounter;
@ -478,10 +473,10 @@ struct BattleStruct
u8 runTries;
u8 caughtMonNick[11];
u8 field_78;
u8 field_79;
u8 field_7A;
u8 field_7B;
u8 field_7C;
u8 safariGoNearCounter;
u8 safariPkblThrowCounter;
u8 safariEscapeFactor;
u8 safariCatchFactor;
u8 field_7D;
u8 field_7E;
u8 formToChangeInto;
@ -514,7 +509,7 @@ struct BattleStruct
u8 field_A7;
u16 hpOnSwitchout[2];
u32 savedBattleTypeFlags;
u8 field_B0;
u8 abilityPreventingSwitchout;
u8 hpScale;
u8 synchronizeMoveEffect;
bool8 anyMonHasTransformed;
@ -525,7 +520,7 @@ struct BattleStruct
u8 AI_itemFlags[2];
u16 choicedMove[MAX_BATTLERS_COUNT];
u16 changedItems[MAX_BATTLERS_COUNT];
u8 intimidateBank;
u8 intimidateBattler;
u8 switchInItemsCounter;
u8 field_DA;
u8 turnSideTracker;
@ -560,8 +555,8 @@ struct BattleStruct
typeArg = gBattleMoves[move].type; \
}
#define IS_MOVE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY)
#define IS_MOVE_SPECIAL(moveType)(moveType > TYPE_MYSTERY)
#define IS_TYPE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY)
#define IS_TYPE_SPECIAL(moveType)(moveType > TYPE_MYSTERY)
#define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0))
@ -606,34 +601,22 @@ struct BattleScripting
u8 reshowMainState;
u8 reshowHelperState;
u8 field_23;
u8 field_24;
u8 windowsType; // 0 - normal, 1 - battle arena
u8 multiplayerId;
};
enum
{
BACK_PIC_BRENDAN,
BACK_PIC_MAY,
BACK_PIC_RED,
BACK_PIC_LEAF,
BACK_PIC_RS_BRENDAN,
BACK_PIC_RS_MAY,
BACK_PIC_WALLY,
BACK_PIC_STEVEN
};
// rom_80A5C6C
u8 GetBattlerSide(u8 battler);
u8 GetBattlerPosition(u8 bank);
u8 GetBattlerAtPosition(u8 bank);
u8 GetBattlerPosition(u8 battler);
u8 GetBattlerAtPosition(u8 battler);
struct BattleSpriteInfo
{
u16 invisible : 1; // 0x1
u16 lowHpSong : 1; // 0x2
u16 behindSubstitute : 1; // 0x4
u16 flag_x8 : 1; // 0x8
u16 hpNumbersNoBars : 1; // 0x10
u16 invisible:1; // 0x1
u16 lowHpSong:1; // 0x2
u16 behindSubstitute:1; // 0x4
u16 flag_x8:1; // 0x8
u16 hpNumbersNoBars:1; // 0x10
u16 transformSpecies;
};
@ -647,12 +630,12 @@ struct BattleAnimationInfo
u8 field_6;
u8 field_7;
u8 ballThrowCaseId;
u8 field_9_x1 : 1;
u8 field_9_x2 : 1;
u8 field_9_x1C : 3;
u8 field_9_x20 : 1;
u8 field_9_x40 : 1;
u8 field_9_x80 : 1;
u8 field_9_x1:1;
u8 field_9_x2:1;
u8 field_9_x1C:3;
u8 field_9_x20:1;
u8 field_9_x40:1;
u8 field_9_x80:1;
u8 field_A;
u8 field_B;
u8 field_C;
@ -663,21 +646,21 @@ struct BattleAnimationInfo
struct BattleHealthboxInfo
{
u8 flag_x1 : 1;
u8 flag_x2 : 1;
u8 flag_x4 : 1;
u8 ballAnimActive : 1; // 0x8
u8 statusAnimActive : 1; // x10
u8 animFromTableActive : 1; // x20
u8 specialAnimActive : 1; //x40
u8 flag_x80 : 1;
u8 field_1_x1 : 1;
u8 field_1_x1E : 4;
u8 field_1_x20 : 1;
u8 field_1_x40 : 1;
u8 field_1_x80 : 1;
u8 field_2;
u8 field_3;
u8 partyStatusSummaryShown:1;
u8 healthboxIsBouncing:1;
u8 battlerIsBouncing:1;
u8 ballAnimActive:1; // 0x8
u8 statusAnimActive:1; // x10
u8 animFromTableActive:1; // x20
u8 specialAnimActive:1; // x40
u8 flag_x80:1;
u8 field_1_x1:1;
u8 field_1_x1E:4;
u8 field_1_x20:1;
u8 field_1_x40:1;
u8 field_1_x80:1;
u8 healthboxBounceSpriteId;
u8 battlerBounceSpriteId;
u8 animationState;
u8 field_5;
u8 field_6;
@ -692,9 +675,9 @@ struct BattleBarInfo
{
u8 healthboxSpriteId;
s32 maxValue;
s32 currentValue;
s32 oldValue;
s32 receivedValue;
s32 field_10;
s32 currValue;
};
struct BattleSpriteData
@ -719,7 +702,11 @@ struct MonSpritesGfx
void *field_17C;
};
// all battle variables are declared in battle_main.c
// All battle variables are declared in battle_main.c
extern u8 gDisplayedStringBattle[300];
extern u8 gBattleTextBuff1[TEXT_BUFF_ARRAY_COUNT];
extern u8 gBattleTextBuff2[TEXT_BUFF_ARRAY_COUNT];
extern u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT];
extern u32 gBattleTypeFlags;
extern u8 gBattleTerrain;
extern u32 gUnknown_02022FF4;
@ -733,7 +720,7 @@ extern u8 gBattlersCount;
extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT];
extern u8 gBattlerPositions[MAX_BATTLERS_COUNT];
extern u8 gActionsByTurnOrder[MAX_BATTLERS_COUNT];
extern u8 gBattleTurnOrder[MAX_BATTLERS_COUNT];
extern u8 gBattlerByTurnOrder[MAX_BATTLERS_COUNT];
extern u8 gCurrentTurnActionNumber;
extern u8 gCurrentActionFuncId;
extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT];

View File

@ -1,13 +1,18 @@
#ifndef GUARD_BATTLE_AI_SCRIPT_COMMANDS_H
#define GUARD_BATTLE_AI_SCRIPT_COMMANDS_H
// return values for BattleAI_ChooseMoveOrAction
// 0 - 3 are move idx
#define AI_CHOICE_FLEE 4
#define AI_CHOICE_WATCH 5
void BattleAI_HandleItemUseBeforeAISetup(u8 defaultScoreMoves);
void BattleAI_SetupAIData(u8 defaultScoreMoves);
u8 BattleAI_ChooseMoveOrAction(void);
void ClearBattlerMoveHistory(u8 bank);
void RecordAbilityBattle(u8 bank, u8 abilityId);
void ClearBattlerAbilityHistory(u8 bank);
void RecordItemEffectBattle(u8 bank, u8 itemEffect);
void ClearBankItemEffectHistory(u8 bank);
void ClearBattlerMoveHistory(u8 battlerId);
void RecordAbilityBattle(u8 battlerId, u8 abilityId);
void ClearBattlerAbilityHistory(u8 battlerId);
void RecordItemEffectBattle(u8 battlerId, u8 itemEffect);
void ClearBattlerItemEffectHistory(u8 battlerId);
#endif // GUARD_BATTLE_AI_SCRIPT_COMMANDS_H

View File

@ -1,13 +1,13 @@
#ifndef GUARD_BATTLE_BG_H
#define GUARD_BATTLE_BG_H
void sub_8035658(void);
void BattleInitBgsAndWindows(void);
void sub_80356D0(void);
void ApplyPlayerChosenFrameToBattleMenu(void);
void LoadBattleMenuWindowGfx(void);
void DrawMainBattleBackground(void);
void LoadBattleTextboxAndBackground(void);
void sub_8035D74(u8 taskId);
void LoadBattleEntryBackground(void);
void DrawBattleEntryBackground(void);
bool8 LoadChosenBattleElement(u8 caseId);
#endif // GUARD_BATTLE_BG_H

View File

@ -65,6 +65,8 @@ enum
REQUEST_TOUGH_RIBBON_BATTLE,
};
// Special arguments for Battle Controller functions.
#define RESET_ACTION_MOVE_SELECTION 0
#define RESET_ACTION_SELECTION 1
#define RESET_MOVE_SELECTION 2
@ -76,14 +78,15 @@ enum
#define BALL_3_SHAKES_SUCCESS 4
#define BALL_TRAINER_BLOCK 5
#define RET_VALUE_LEVELLED_UP 11
#define INSTANT_HP_BAR_DROP 32767
// Special return values in gBattleBufferB from Battle Controller functions.
#define RET_VALUE_LEVELED_UP 11
struct UnusedControllerStruct
{
u8 field_0 : 7;
u8 flag_x80 : 1;
u8 field_0:7;
u8 flag_x80:1;
};
struct HpAndStatus
@ -160,8 +163,8 @@ enum
CONTROLLER_INTROSLIDE,
CONTROLLER_INTROTRAINERBALLTHROW,
CONTROLLER_DRAWPARTYSTATUSSUMMARY,
CONTROLLER_49,
CONTROLLER_50,
CONTROLLER_HIDEPARTYSTATUSSUMMARY,
CONTROLLER_ENDBOUNCE,
CONTROLLER_SPRITEINVISIBILITY,
CONTROLLER_BATTLEANIMATION,
CONTROLLER_LINKSTANDBYMSG,
@ -230,13 +233,13 @@ void BtlController_EmitFaintingCry(u8 bufferId);
void BtlController_EmitIntroSlide(u8 bufferId, u8 terrainId);
void BtlController_EmitIntroTrainerBallThrow(u8 bufferId);
void BtlController_EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2);
void BtlController_EmitCmd49(u8 bufferId);
void BtlController_EmitCmd50(u8 bufferId);
void BtlController_EmitHidePartyStatusSummary(u8 bufferId);
void BtlController_EmitEndBounceEffect(u8 bufferId);
void BtlController_EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible);
void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument);
void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2);
void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId);
void BtlController_EmitCmd55(u8 bufferId, u8 arg1);
void BtlController_EmitCmd55(u8 bufferId, u8 battleOutcome);
// player controller
void SetControllerToPlayer(void);

View File

@ -35,7 +35,7 @@ void ClearBehindSubstituteBit(u8 battlerId);
void HandleLowHpMusicChange(struct Pokemon *mon, u8 battlerId);
void BattleStopLowHpSound(void);
u8 GetMonHPBarLevel(struct Pokemon *mon);
void sub_805EAE8(void);
void HandleBattleLowHpMusicChange(void);
void sub_805EB9C(u8 affineMode);
void LoadAndCreateEnemyShadowSprites(void);
void SpriteCB_SetInvisible(struct Sprite *sprite);
@ -45,6 +45,6 @@ void sub_805EF14(void);
void ClearTemporarySpeciesSpriteData(u8 battlerId, bool8 dontClearSubstitute);
void AllocateMonSpritesGfx(void);
void FreeMonSpritesGfx(void);
bool32 ShouldPlayNormalPokeCry(struct Pokemon *mon);
bool32 ShouldPlayNormalMonCry(struct Pokemon *mon);
#endif // GUARD_BATTLE_GFX_SFX_UTIL

View File

@ -29,12 +29,18 @@ enum
#define TAG_HEALTHBOX_OPPONENT1_TILE 0xD701
#define TAG_HEALTHBOX_OPPONENT2_TILE 0xD702
#define TAG_HEALTHBAR_PLAYER1_TILE 0xD704
#define TAG_HEALTHBAR_OPPONENT1_TILE 0xD705
#define TAG_HEALTHBAR_PLAYER2_TILE 0xD706
#define TAG_HEALTHBAR_OPPONENT2_TILE 0xD707
#define TAG_HEALTHBOX_SAFARI_TILE 0xD70B
#define TAG_STATUS_SUMMARY_BAR_TILE 0xD70C
#define TAG_STATUS_SUMMARY_BALLS_TILE 0xD714
#define TAG_HEALTHBOX_PAL 0xD6FF
#define TAG_HEALTHBAR_PAL 0xD704
#define TAG_STATUS_SUMMARY_BAR_PAL 0xD710
#define TAG_STATUS_SUMMARY_BALLS_PAL 0xD712
@ -66,9 +72,9 @@ void InitBattlerHealthboxCoords(u8 bank);
void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent);
void SwapHpBarsWithHpText(void);
u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart);
void sub_8073C30(u8 taskId);
void Task_HidePartyStatusSummary(u8 taskId);
void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elementId);
s32 sub_8074AA0(u8 bank, u8 healthboxSpriteId, u8 whichBar, u8 arg3);
s32 MoveBattleBar(u8 bank, u8 healthboxSpriteId, u8 whichBar, u8 arg3);
u8 GetScaledHPFraction(s16 hp, s16 maxhp, u8 scale);
u8 GetHPBarLevel(s16 hp, s16 maxhp);

View File

@ -25,6 +25,10 @@ struct TrainerMoney
#define TYPE_FORESIGHT 0xFE
#define TYPE_ENDTABLE 0xFF
// defines for the 'DoBounceEffect' function
#define BOUNCE_MON 0x0
#define BOUNCE_HEALTHBOX 0x1
void CB2_InitBattle(void);
void BattleMainCB2(void);
void CB2_QuitRecordedBattle(void);
@ -38,15 +42,15 @@ u32 sub_80391E0(u8 arrayId, u8 caseId);
u32 sub_80397C4(u32 setId, u32 tableId);
void oac_poke_opponent(struct Sprite *sprite);
void SpriteCallbackDummy_2(struct Sprite *sprite);
void sub_8039934(struct Sprite *sprite);
void SpriteCB_FaintOpponentMon(struct Sprite *sprite);
void sub_8039AD8(struct Sprite *sprite);
void sub_8039B2C(struct Sprite *sprite);
void sub_8039B58(struct Sprite *sprite);
void sub_8039BB4(struct Sprite *sprite);
void sub_80105DC(struct Sprite *sprite);
void sub_8039C00(struct Sprite *sprite);
void dp11b_obj_instanciate(u8 battlerId, u8 b, s8 c, s8 d);
void dp11b_obj_free(u8 battlerId, bool8 b);
void DoBounceEffect(u8 battlerId, u8 b, s8 c, s8 d);
void EndBounceEffect(u8 battlerId, bool8 b);
void sub_8039E44(struct Sprite *sprite);
void sub_8039E60(struct Sprite *sprite);
void sub_8039E84(struct Sprite *sprite);
@ -80,6 +84,6 @@ extern const u8 gStatusConditionString_IceJpn[8];
extern const u8 gStatusConditionString_ConfusionJpn[8];
extern const u8 gStatusConditionString_LoveJpn[8];
extern const u8 * const gStatusConditionStringsTable[7][2];
extern const u8 *const gStatusConditionStringsTable[7][2];
#endif // GUARD_BATTLE_MAIN_H

View File

@ -1,8 +1,9 @@
#ifndef GUARD_BATTLE_MESSAGE_H
#define GUARD_BATTLE_MESSAGE_H
// for 0xFD
#define TEXT_BUFF_ARRAY_COUNT 16
// for 0xFD
#define B_TXT_BUFF1 0x0
#define B_TXT_BUFF2 0x1
#define B_TXT_COPY_VAR_1 0x2
@ -194,7 +195,7 @@
textVar[4] = B_BUFF_EOS; \
}
struct StringInfoBattle
struct BattleMsgData
{
u16 currentMove;
u16 originallyUsedMove;
@ -203,25 +204,20 @@ struct StringInfoBattle
u8 scrActive;
u8 unk1605E;
u8 hpScale;
u8 StringBank;
u8 itemEffectBattler;
u8 moveType;
u8 abilities[4];
u8 textBuffs[3][0x10];
u8 abilities[MAX_BATTLERS_COUNT];
u8 textBuffs[3][TEXT_BUFF_ARRAY_COUNT];
};
void BufferStringBattle(u16 stringID);
u32 BattleStringExpandPlaceholdersToDisplayedString(const u8* src);
u32 BattleStringExpandPlaceholders(const u8* src, u8* dst);
void BattleHandleAddTextPrinter(const u8* text, u8 arg1);
void BattlePutTextOnWindow(const u8* text, u8 arg1);
void SetPpNumbersPaletteInMoveSelection(void);
u8 GetCurrentPpToMaxPpState(u8 currentPp, u8 maxPp);
#define TEXT_BUFF_ARRAY_COUNT 16
extern u8 gDisplayedStringBattle[300];
extern u8 gBattleTextBuff1[TEXT_BUFF_ARRAY_COUNT];
extern u8 gBattleTextBuff2[TEXT_BUFF_ARRAY_COUNT];
extern u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT];
extern struct BattleMsgData *gBattleMsgDataPtr;
extern const u8* const gBattleStringsTable[];
extern const u8* const gStatNamesTable[];
@ -252,6 +248,13 @@ extern const u8 gText_BattleSwitchWhich4[];
extern const u8 gText_BattleSwitchWhich5[];
extern const u8 gText_SafariBalls[];
extern const u8 gText_SafariBallLeft[];
extern const u8 gText_Sleep[];
extern const u8 gText_Poison[];
extern const u8 gText_Burn[];
extern const u8 gText_Paralysis[];
extern const u8 gText_Ice[];
extern const u8 gText_Confusion[];
extern const u8 gText_Love[];
extern const u8 gText_SpaceAndSpace[];
extern const u8 gText_CommaSpace[];
extern const u8 gText_Space2[];

View File

@ -8,41 +8,36 @@
#define MOVE_LIMITATION_TAUNT (1 << 4)
#define MOVE_LIMITATION_IMPRISION (1 << 5)
#define ABILITYEFFECT_ON_SWITCHIN 0x0
#define ABILITYEFFECT_ENDTURN 0x1
#define ABILITYEFFECT_MOVES_BLOCK 0x2
#define ABILITYEFFECT_ABSORBING 0x3
#define ABILITYEFFECT_CONTACT 0x4
#define ABILITYEFFECT_IMMUNITY 0x5
#define ABILITYEFFECT_FORECAST 0x6
#define ABILITYEFFECT_SYNCHRONIZE 0x7
#define ABILITYEFFECT_ATK_SYNCHRONIZE 0x8
#define ABILITYEFFECT_INTIMIDATE1 0x9
#define ABILITYEFFECT_INTIMIDATE2 0xA
#define ABILITYEFFECT_TRACE 0xB
#define ABILITYEFFECT_CHECK_OTHER_SIDE 0xC
#define ABILITYEFFECT_CHECK_BANK_SIDE 0xD
#define ABILITYEFFECT_FIELD_SPORT 0xE
#define ABILITYEFFECT_CHECK_FIELD_EXCEPT_BANK 0xF
#define ABILITYEFFECT_COUNT_OTHER_SIDE 0x10
#define ABILITYEFFECT_COUNT_BANK_SIDE 0x11
#define ABILITYEFFECT_COUNT_ON_FIELD 0x12
#define ABILITYEFFECT_CHECK_ON_FIELD 0x13
#define ABILITYEFFECT_SWITCH_IN_WEATHER 0xFF
#define ABILITYEFFECT_ON_SWITCHIN 0x0
#define ABILITYEFFECT_ENDTURN 0x1
#define ABILITYEFFECT_MOVES_BLOCK 0x2
#define ABILITYEFFECT_ABSORBING 0x3
#define ABILITYEFFECT_CONTACT 0x4
#define ABILITYEFFECT_IMMUNITY 0x5
#define ABILITYEFFECT_FORECAST 0x6
#define ABILITYEFFECT_SYNCHRONIZE 0x7
#define ABILITYEFFECT_ATK_SYNCHRONIZE 0x8
#define ABILITYEFFECT_INTIMIDATE1 0x9
#define ABILITYEFFECT_INTIMIDATE2 0xA
#define ABILITYEFFECT_TRACE 0xB
#define ABILITYEFFECT_CHECK_OTHER_SIDE 0xC
#define ABILITYEFFECT_CHECK_BATTLER_SIDE 0xD
#define ABILITYEFFECT_FIELD_SPORT 0xE
#define ABILITYEFFECT_CHECK_FIELD_EXCEPT_BATTLER 0xF
#define ABILITYEFFECT_COUNT_OTHER_SIDE 0x10
#define ABILITYEFFECT_COUNT_BATTLER_SIDE 0x11
#define ABILITYEFFECT_COUNT_ON_FIELD 0x12
#define ABILITYEFFECT_CHECK_ON_FIELD 0x13
#define ABILITYEFFECT_SWITCH_IN_WEATHER 0xFF
#define ABILITY_ON_OPPOSING_FIELD(battlerId, abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, battlerId, abilityId, 0, 0))
#define ABILITY_ON_FIELD(abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, abilityId, 0, 0))
#define ABILITY_ON_FIELD2(abilityId)(AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, abilityId, 0, 0))
#define ITEMEFFECT_ON_SWITCH_IN 0x0
#define WEATHER_HAS_EFFECT ((!AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, ABILITY_CLOUD_NINE, 0, 0) && !AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, ABILITY_AIR_LOCK, 0, 0)))
#define WEATHER_HAS_EFFECT2 ((!AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_CLOUD_NINE, 0, 0) && !AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_AIR_LOCK, 0, 0)))
#define BS_GET_TARGET 0
#define BS_GET_ATTACKER 1
#define BS_GET_EFFECT_BANK 2
#define BS_GET_SCRIPTING_BANK 10
#define BS_GET_PLAYER1 11
#define BS_GET_OPPONENT1 12
#define BS_GET_PLAYER2 13
#define BS_GET_OPPONENT2 14
#define WEATHER_HAS_EFFECT ((!ABILITY_ON_FIELD(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD(ABILITY_AIR_LOCK)))
#define WEATHER_HAS_EFFECT2 ((!ABILITY_ON_FIELD2(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD2(ABILITY_AIR_LOCK)))
u8 GetBattlerForBattleScript(u8 caseId);
void PressurePPLose(u8 bankDef, u8 bankAtk, u16 move);
@ -70,7 +65,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void);
bool8 HandleFaintedMonActions(void);
void TryClearRageStatuses(void);
u8 AtkCanceller_UnableToUseMove(void);
bool8 sub_80423F4(u8 battlerId, u8 r1, u8 r2);
bool8 HasNoMonsToSwitch(u8 battlerId, u8 r1, u8 r2);
u8 CastformDataTypeChange(u8 battlerId);
u8 AbilityBattleEffects(u8 caseID, u8 battlerId, u8 ability, u8 special, u16 moveArg);
void BattleScriptExecute(const u8* BS_ptr);

View File

@ -80,4 +80,6 @@
#define ABILITY_CACOPHONY 76
#define ABILITY_AIR_LOCK 77
#define ABILITIES_COUNT 78
#endif // GUARD_CONSTANTS_ABILITIES_H

View File

@ -130,7 +130,7 @@
#define STATUS2_TORMENT 0x80000000
// Seems like per-battler statuses. Not quite sure how to categorize these
#define STATUS3_LEECHSEED_BANK 0x3
#define STATUS3_LEECHSEED_BATTLER 0x3
#define STATUS3_LEECHSEED 0x4
#define STATUS3_ALWAYS_HITS 0x18 // two bits
#define STATUS3_PERISH_SONG 0x20
@ -159,7 +159,7 @@
#define HITMARKER_NO_ATTACKSTRING 0x00000200
#define HITMARKER_ATTACKSTRING_PRINTED 0x00000400
#define HITMARKER_NO_PPDEDUCT 0x00000800
#define HITMARKER_PURSUIT_TRAP 0x00001000
#define HITMARKER_SWAP_ATTACKER_TARGET 0x00001000
#define HITMARKER_IGNORE_SAFEGUARD 0x00002000
#define HITMARKER_SYNCHRONISE_EFFECT 0x00004000
#define HITMARKER_RUN 0x00008000

View File

@ -0,0 +1,13 @@
#ifndef GUARD_CONSTANTS_BATTLE_FRONTIER_H
#define GUARD_CONSTANTS_BATTLE_FRONTIER_H
// Battle Frontier facility ids.
#define FRONTIER_FACILITY_TOWER 0
#define FRONTIER_FACILITY_DOME 1
#define FRONTIER_FACILITY_PALACE 2
#define FRONTIER_FACILITY_ARENA 3
#define FRONTIER_FACILITY_FACTORY 4
#define FRONTIER_FACILITY_PIKE 5
#define FRONTIER_FACILITY_PYRAMID 6
#endif // GUARD_CONSTANTS_BATTLE_FRONTIER_H

View File

@ -37,7 +37,7 @@
#define BS_ATTACKER 1
#define BS_EFFECT_BATTLER 2
#define BS_FAINTED 3
#define BS_BANK_0 7
#define BS_BATTLER_0 7
#define BS_ATTACKER_WITH_PARTNER 4 // for atk98_status_icon_update
#define BS_ATTACKER_SIDE 8 // for atk1E_jumpifability
#define BS_NOT_ATTACKER_SIDE 9 // for atk1E_jumpifability

View File

@ -462,8 +462,8 @@
#define ITEM_MAGMA_EMBLEM 375
#define ITEM_OLD_SEA_MAP 376
#define ITEM_LAST_ID 376
#define ITEM_FIELD_ARROW ITEM_LAST_ID + 1
#define ITEMS_COUNT 377
#define ITEM_FIELD_ARROW ITEMS_COUNT
#define FIRST_BERRY_INDEX ITEM_CHERI_BERRY
#define LAST_BERRY_INDEX ITEM_ENIGMA_BERRY

View File

@ -357,6 +357,6 @@
#define MOVE_DOOM_DESIRE 353
#define MOVE_PSYCHO_BOOST 354
#define LAST_MOVE_INDEX MOVE_PSYCHO_BOOST
#define MOVES_COUNT 355
#endif // GUARD_CONSTANTS_MOVES_H

View File

@ -857,7 +857,14 @@
#define TRAINER_BRENDAN_16 853
#define TRAINER_MAY_16 854
#define NO_OF_TRAINERS 854
#define TRAINERS_COUNT 855
// Special Trainer Ids.
#define TRAINER_FRONTIER_BRAIN 1022
#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
@ -953,6 +960,15 @@
#define TRAINER_PIC_RUBY_SAPPHIRE_BRENDAN 91
#define TRAINER_PIC_RUBY_SAPPHIRE_MAY 92
#define TRAINER_BACK_PIC_BRENDAN 0
#define TRAINER_BACK_PIC_MAY 1
#define TRAINER_BACK_PIC_RED 2
#define TRAINER_BACK_PIC_LEAF 3
#define TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN 4
#define TRAINER_BACK_PIC_RUBY_SAPPHIRE_MAY 5
#define TRAINER_BACK_PIC_WALLY 6
#define TRAINER_BACK_PIC_STEVEN 7
#define FACILITY_CLASS_HIKER 0x0
#define FACILITY_CLASS_TEAM_AQUA_1 0x1
#define FACILITY_CLASS_PKMN_BREEDER_1 0x2

View File

@ -1,7 +1,7 @@
#ifndef GUARD_DATA_BATTLE_MOVES
#define GUARD_DATA_BATTLE_MOVES
const struct BattleMove gBattleMoves[LAST_MOVE_INDEX + 1] =
const struct BattleMove gBattleMoves[MOVES_COUNT] =
{
{ // MOVE_NONE
.effect = EFFECT_HIT,

View File

@ -80,7 +80,7 @@ static const u8 gShellArmorAbilityDescription[] = _("Blocks critical hits.");
static const u8 gCacophonyAbilityDescription[] = _("Avoids sound-based moves.");
static const u8 gAirLockAbilityDescription[] = _("Negates weather effects.");
const u8 gAbilityNames[][ABILITY_NAME_LENGTH + 1] =
const u8 gAbilityNames[ABILITIES_COUNT][ABILITY_NAME_LENGTH + 1] =
{
_("-------"),
_("STENCH"),
@ -162,7 +162,7 @@ const u8 gAbilityNames[][ABILITY_NAME_LENGTH + 1] =
_("AIR LOCK"),
};
const u8 *const gAbilityDescriptionPointers[] =
const u8 *const gAbilityDescriptionPointers[ABILITIES_COUNT] =
{
gNoneAbilityDescription,
gStenchAbilityDescription,

View File

@ -582,6 +582,7 @@
#define BLDCNT_TGT1_BG3 (1 << 3)
#define BLDCNT_TGT1_OBJ (1 << 4)
#define BLDCNT_TGT1_BD (1 << 5)
#define BLDCNT_TGT1_ALL (BLDCNT_TGT1_BG0 | BLDCNT_TGT1_BG1 | BLDCNT_TGT1_BG2 | BLDCNT_TGT1_BG3 | BLDCNT_TGT1_OBJ | BLDCNT_TGT1_BD)
// Bits 6-7 select the special effect
#define BLDCNT_EFFECT_NONE (0 << 6) // no special effect
#define BLDCNT_EFFECT_BLEND (1 << 6) // 1st+2nd targets mixed (controlled by BLDALPHA)
@ -594,6 +595,7 @@
#define BLDCNT_TGT2_BG3 (1 << 11)
#define BLDCNT_TGT2_OBJ (1 << 12)
#define BLDCNT_TGT2_BD (1 << 13)
#define BLDCNT_TGT2_ALL (BLDCNT_TGT2_BG0 | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_OBJ | BLDCNT_TGT2_BD)
// BLDALPHA
#define BLDALPHA_BLEND(target1, target2) (((target2) << 8) | (target1))

View File

@ -35,12 +35,18 @@
// Converts a number to Q4.12 fixed-point format
#define Q_4_12(n) ((s16)((n) * 4096))
// Converts a number to Q24.8 fixed-point format
#define Q_24_8(n) ((s32)((n) * 256))
// Converts a Q8.8 fixed-point format number to a regular integer
#define Q_8_8_TO_INT(n) ((int)((n) / 256))
// Converts a Q4.12 fixed-point format number to a regular integer
#define Q_4_12_TO_INT(n) ((int)((n) / 4096))
// Converts a Q24.8 fixed-point format number to a regular integer
#define Q_24_8_TO_INT(n) ((int)((n) >> 8))
#define PARTY_SIZE 6
#define POKEMON_SLOTS_NUMBER 412

View File

@ -1,6 +1,8 @@
#ifndef GUARD_PARTY_MENU_H
#define GUARD_PARTY_MENU_H
#include "task.h"
enum
{
AILMENT_NONE,
@ -11,6 +13,16 @@ enum
AILMENT_BRN
};
enum
{
PARTY_CHOOSE_MON,
PARTY_MUST_CHOOSE_MON,
PARTY_CANT_SWITCH,
PARTY_USE_ITEM_ON,
PARTY_ABILITY_PREVENTS,
PARTY_GIVE_ITEM,
};
struct Struct203CEC8
{
u8 filler[0x9];
@ -38,5 +50,6 @@ void sub_81B1F18(u8 taskId, u8 pokemonIdx, s8 a, s16 hp, TaskFunc func);
void sub_81B1B5C(void *a, u8 b);
u8 sub_81B1BD4();
void sub_81B8448();
void OpenPartyMenuInBattle(u8 caseId);
#endif // GUARD_PARTY_MENU_H

View File

@ -438,7 +438,7 @@ extern u8 gPlayerPartyCount;
extern struct Pokemon gPlayerParty[PARTY_SIZE];
extern u8 gEnemyPartyCount;
extern struct Pokemon gEnemyParty[PARTY_SIZE];
extern struct SpriteTemplate gUnknown_0202499C;
extern struct SpriteTemplate gMultiuseSpriteTemplate;
extern struct PokemonStorage* gPokemonStoragePtr;
extern const struct BattleMove gBattleMoves[];
@ -505,9 +505,9 @@ u8 GetDefaultMoveTarget(u8 battlerId);
u8 GetMonGender(struct Pokemon *mon);
u8 GetBoxMonGender(struct BoxPokemon *boxMon);
u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality);
void sub_806A068(u16 species, u8 battlerPosition);
void sub_806A12C(u16 trainerSpriteId, u8 battlerPosition);
void sub_806A1C0(u16 arg0, u8 battlerPosition);
void SetMultiuseSpriteTemplateToPokemon(u16 species, u8 battlerPosition);
void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosition);
void SetMultiuseSpriteTemplateToTrainerFront(u16 arg0, u8 battlerPosition);
// These are full type signatures for GetMonData() and GetBoxMonData(),
// but they are not used since some code erroneously omits the third arg.
@ -556,7 +556,7 @@ void sub_806D544(u16 species, u32 personality, u8 *dest);
void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, u8 a4);
void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies);
bool8 sub_806D7EC(void);
bool16 sub_806D82C(u8 id);
bool16 GetLinkTrainerFlankId(u8 id);
s32 GetBattlerMultiplayerId(u16 a1);
u8 GetTrainerEncounterMusicId(u16 trainerOpponentId);
u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex);
@ -593,7 +593,7 @@ bool8 IsTradedMon(struct Pokemon *mon);
bool8 IsOtherTrainer(u32 otId, u8 *otName);
void MonRestorePP(struct Pokemon *mon);
void BoxMonRestorePP(struct BoxPokemon *boxMon);
void sub_806E994(void);
void SetMonPreventsSwitchingString(void);
void SetWildMonHeldItem(void);
bool8 IsMonShiny(struct Pokemon *mon);
bool8 IsShinyOtIdPersonality(u32 otId, u32 personality);

View File

@ -16,7 +16,7 @@ void sub_81851A8(u8 *arg0);
bool32 CanCopyRecordedBattleSaveData(void);
u32 MoveRecordedBattleToSaveData(void);
void PlayRecordedBattle(void (*CB2_After)(void));
u8 sub_8185EA0(void);
u8 GetRecordedBattleFrontierFacility(void);
u8 sub_8185EAC(void);
void RecordedBattle_SaveParties(void);
u8 GetActiveBattlerLinkPlayerGender(void);

View File

@ -2,7 +2,17 @@
#define GUARD_TEXT_H
#define CHAR_SPACE 0x00
#define CHAR_PLUS 0x2E
#define CHAR_0 0xA1
#define CHAR_1 0xA2
#define CHAR_2 0xA3
#define CHAR_3 0xA4
#define CHAR_4 0xA5
#define CHAR_5 0xA6
#define CHAR_6 0xA7
#define CHAR_7 0xA8
#define CHAR_8 0xA9
#define CHAR_9 0xAA
#define CHAR_QUESTION_MARK 0xAC
#define CHAR_PERIOD 0xAD
#define CHAR_HYPHEN 0xAE

View File

@ -12,11 +12,11 @@ struct TilesPal
extern const u8 gTextWindowFrame1_Gfx[];
extern const u16 gTextWindowFrame1_Pal[];
const struct TilesPal* GetWindowFrameTilesPal(u8 id);
void copy_textbox_border_tile_patterns_to_vram(u8 windowId, u16 destOffset, u8 palOffset);
const struct TilesPal *GetWindowFrameTilesPal(u8 id);
void LoadMessageBoxGfx(u8 windowId, u16 destOffset, u8 palOffset);
void LoadUserWindowBorderGfx(u8 windowId, u16 destOffset, u8 palOffset);
void LoadWindowGfx(u8 windowId, u8 frameId, u16 destOffset, u8 palOffset);
void box_border_load_tiles_and_pal(u8 windowId, u16 destOffset, u8 palOffset);
void LoadUserWindowBorderGfx_(u8 windowId, u16 destOffset, u8 palOffset);
void sub_8098858(u8 windowId, u16 tileNum, u8 palNum);
void sub_80989E0(u8 windowId, u16 tileNum, u8 palNum);
void rbox_fill_rectangle(u8 windowId);

File diff suppressed because it is too large Load Diff

View File

@ -19,18 +19,20 @@ static bool8 ShouldSwitchIfPerishSong(void)
if (gStatuses3[gActiveBattler] & STATUS3_PERISH_SONG
&& gDisableStructs[gActiveBattler].perishSongTimer1 == 0)
{
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = 6;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
return TRUE;
}
return FALSE;
else
{
return FALSE;
}
}
static bool8 ShouldSwitchIfWonderGuard(void)
{
u8 opposingPosition;
u8 opposingBank;
u8 opposingBattler;
u8 moveFlags;
s32 i, j;
s32 firstId;
@ -46,22 +48,22 @@ static bool8 ShouldSwitchIfWonderGuard(void)
if (gBattleMons[GetBattlerAtPosition(opposingPosition)].ability != ABILITY_WONDER_GUARD)
return FALSE;
// check if pokemon has a super effective move
for (opposingBank = GetBattlerAtPosition(opposingPosition), i = 0; i < 4; i++)
// Check if Pokemon has a super effective move.
for (opposingBattler = GetBattlerAtPosition(opposingPosition), i = 0; i < 4; i++)
{
move = gBattleMons[gActiveBattler].moves[i];
if (move == MOVE_NONE)
continue;
moveFlags = AI_TypeCalc(move, gBattleMons[opposingBank].species, gBattleMons[opposingBank].ability);
moveFlags = AI_TypeCalc(move, gBattleMons[opposingBattler].species, gBattleMons[opposingBattler].ability);
if (moveFlags & MOVE_RESULT_SUPER_EFFECTIVE)
return FALSE;
}
// get party information
// Get party information.
if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000))
{
if ((gActiveBattler & BIT_FLANK) == 0)
if ((gActiveBattler & BIT_FLANK) == B_FLANK_LEFT)
firstId = 0, lastId = 3;
else
firstId = 3, lastId = 6;
@ -76,7 +78,7 @@ static bool8 ShouldSwitchIfWonderGuard(void)
else
party = gEnemyParty;
// find a pokemon in the party that has a super effective move
// Find a Pokemon in the party that has a super effective move.
for (i = firstId; i < lastId; i++)
{
if (GetMonData(&party[i], MON_DATA_HP) == 0)
@ -88,19 +90,19 @@ static bool8 ShouldSwitchIfWonderGuard(void)
if (i == gBattlerPartyIndexes[gActiveBattler])
continue;
GetMonData(&party[i], MON_DATA_SPECIES); // unused return value
GetMonData(&party[i], MON_DATA_ALT_ABILITY); // unused return value
GetMonData(&party[i], MON_DATA_SPECIES); // Unused return value.
GetMonData(&party[i], MON_DATA_ALT_ABILITY); // Unused return value.
for (opposingBank = GetBattlerAtPosition(opposingPosition), j = 0; j < 4; j++)
for (opposingBattler = GetBattlerAtPosition(opposingPosition), j = 0; j < 4; j++)
{
move = GetMonData(&party[i], MON_DATA_MOVE1 + j);
if (move == MOVE_NONE)
continue;
moveFlags = AI_TypeCalc(move, gBattleMons[opposingBank].species, gBattleMons[opposingBank].ability);
moveFlags = AI_TypeCalc(move, gBattleMons[opposingBattler].species, gBattleMons[opposingBattler].ability);
if (moveFlags & MOVE_RESULT_SUPER_EFFECTIVE && Random() % 3 < 2)
{
// we found a mon
// We found a mon.
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = i;
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
return TRUE;
@ -108,12 +110,12 @@ static bool8 ShouldSwitchIfWonderGuard(void)
}
}
return FALSE; // at this point there is not a single pokemon in the party that has a super effective move against a pokemon with wonder guard
return FALSE; // There is not a single Pokemon in the party that has a super effective move against a mon with Wonder Guard.
}
static bool8 FindMonThatAbsorbsOpponentsMove(void)
{
u8 bankIn1, bankIn2;
u8 battlerIn1, battlerIn2;
u8 absorbingTypeAbility;
s32 firstId;
s32 lastId; // + 1
@ -131,16 +133,16 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
bankIn1 = gActiveBattler;
battlerIn1 = gActiveBattler;
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))])
bankIn2 = gActiveBattler;
battlerIn2 = gActiveBattler;
else
bankIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)));
battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)));
}
else
{
bankIn1 = gActiveBattler;
bankIn2 = gActiveBattler;
battlerIn1 = gActiveBattler;
battlerIn2 = gActiveBattler;
}
if (gBattleMoves[gLastLandedMoves[gActiveBattler]].type == TYPE_FIRE)
@ -157,7 +159,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000))
{
if ((gActiveBattler & BIT_FLANK) == 0)
if ((gActiveBattler & BIT_FLANK) == B_FLANK_LEFT)
firstId = 0, lastId = 3;
else
firstId = 3, lastId = 6;
@ -183,13 +185,13 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
continue;
if (GetMonData(&party[i], MON_DATA_SPECIES2) == SPECIES_EGG)
continue;
if (i == gBattlerPartyIndexes[bankIn1])
if (i == gBattlerPartyIndexes[battlerIn1])
continue;
if (i == gBattlerPartyIndexes[bankIn2])
if (i == gBattlerPartyIndexes[battlerIn2])
continue;
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn1))
if (i == *(gBattleStruct->monToSwitchIntoId + battlerIn1))
continue;
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn2))
if (i == *(gBattleStruct->monToSwitchIntoId + battlerIn2))
continue;
species = GetMonData(&party[i], MON_DATA_SPECIES);
@ -200,7 +202,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
if (absorbingTypeAbility == monAbility && Random() & 1)
{
// we found a mon
// we found a mon.
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = i;
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
return TRUE;
@ -221,13 +223,13 @@ static bool8 ShouldSwitchIfNaturalCure(void)
if ((gLastLandedMoves[gActiveBattler] == 0 || gLastLandedMoves[gActiveBattler] == 0xFFFF) && Random() & 1)
{
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = 6;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
return TRUE;
}
else if (gBattleMoves[gLastLandedMoves[gActiveBattler]].power == 0 && Random() & 1)
{
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = 6;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
return TRUE;
}
@ -236,9 +238,10 @@ static bool8 ShouldSwitchIfNaturalCure(void)
return TRUE;
if (FindMonWithFlagsAndSuperEffective(MOVE_RESULT_NOT_VERY_EFFECTIVE, 1))
return TRUE;
if (Random() & 1)
{
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = 6;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
return TRUE;
}
@ -249,15 +252,15 @@ static bool8 ShouldSwitchIfNaturalCure(void)
static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng)
{
u8 opposingPosition;
u8 opposingBank;
u8 opposingBattler;
s32 i;
u8 moveFlags;
u16 move;
opposingPosition = BATTLE_OPPOSITE(GetBattlerPosition(gActiveBattler));
opposingBank = GetBattlerAtPosition(opposingPosition);
opposingBattler = GetBattlerAtPosition(opposingPosition);
if (!(gAbsentBattlerFlags & gBitTable[opposingBank]))
if (!(gAbsentBattlerFlags & gBitTable[opposingBattler]))
{
for (i = 0; i < 4; i++)
{
@ -265,7 +268,7 @@ static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng)
if (move == MOVE_NONE)
continue;
moveFlags = AI_TypeCalc(move, gBattleMons[opposingBank].species, gBattleMons[opposingBank].ability);
moveFlags = AI_TypeCalc(move, gBattleMons[opposingBattler].species, gBattleMons[opposingBattler].ability);
if (moveFlags & MOVE_RESULT_SUPER_EFFECTIVE)
{
if (noRng)
@ -278,9 +281,9 @@ static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng)
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
return FALSE;
opposingBank = GetBattlerAtPosition(BATTLE_PARTNER(opposingPosition));
opposingBattler = GetBattlerAtPosition(BATTLE_PARTNER(opposingPosition));
if (!(gAbsentBattlerFlags & gBitTable[opposingBank]))
if (!(gAbsentBattlerFlags & gBitTable[opposingBattler]))
{
for (i = 0; i < 4; i++)
{
@ -288,7 +291,7 @@ static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng)
if (move == MOVE_NONE)
continue;
moveFlags = AI_TypeCalc(move, gBattleMons[opposingBank].species, gBattleMons[opposingBank].ability);
moveFlags = AI_TypeCalc(move, gBattleMons[opposingBattler].species, gBattleMons[opposingBattler].ability);
if (moveFlags & MOVE_RESULT_SUPER_EFFECTIVE)
{
if (noRng)
@ -318,7 +321,7 @@ static bool8 AreStatsRaised(void)
static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
{
u8 bankIn1, bankIn2;
u8 battlerIn1, battlerIn2;
s32 firstId;
s32 lastId; // + 1
struct Pokemon *party;
@ -337,16 +340,16 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
bankIn1 = gActiveBattler;
battlerIn1 = gActiveBattler;
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))])
bankIn2 = gActiveBattler;
battlerIn2 = gActiveBattler;
else
bankIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)));
battlerIn2 = GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)));
}
else
{
bankIn1 = gActiveBattler;
bankIn2 = gActiveBattler;
battlerIn1 = gActiveBattler;
battlerIn2 = gActiveBattler;
}
if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000))
@ -377,13 +380,13 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
continue;
if (GetMonData(&party[i], MON_DATA_SPECIES2) == SPECIES_EGG)
continue;
if (i == gBattlerPartyIndexes[bankIn1])
if (i == gBattlerPartyIndexes[battlerIn1])
continue;
if (i == gBattlerPartyIndexes[bankIn2])
if (i == gBattlerPartyIndexes[battlerIn2])
continue;
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn1))
if (i == *(gBattleStruct->monToSwitchIntoId + battlerIn1))
continue;
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn2))
if (i == *(gBattleStruct->monToSwitchIntoId + battlerIn2))
continue;
species = GetMonData(&party[i], MON_DATA_SPECIES);
@ -395,7 +398,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
moveFlags = AI_TypeCalc(gLastLandedMoves[gActiveBattler], species, monAbility);
if (moveFlags & flags)
{
bankIn1 = gLastHitBy[gActiveBattler];
battlerIn1 = gLastHitBy[gActiveBattler];
for (j = 0; j < 4; j++)
{
@ -403,7 +406,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
if (move == 0)
continue;
moveFlags = AI_TypeCalc(move, gBattleMons[bankIn1].species, gBattleMons[bankIn1].ability);
moveFlags = AI_TypeCalc(move, gBattleMons[battlerIn1].species, gBattleMons[battlerIn1].ability);
if (moveFlags & MOVE_RESULT_SUPER_EFFECTIVE && Random() % moduloPercent == 0)
{
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = i;
@ -419,23 +422,23 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
static bool8 ShouldSwitch(void)
{
u8 bankIn1, bankIn2;
u8 *activeBankPtr; // needed to match
u8 battlerIn1, battlerIn2;
u8 *activeBattlerPtr; // Needed to match.
s32 firstId;
s32 lastId; // + 1
struct Pokemon *party;
s32 i;
s32 availableToSwitch;
if (gBattleMons[*(activeBankPtr = &gActiveBattler)].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION))
if (gBattleMons[*(activeBattlerPtr = &gActiveBattler)].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION))
return FALSE;
if (gStatuses3[gActiveBattler] & STATUS3_ROOTED)
return FALSE;
if (AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gActiveBattler, ABILITY_SHADOW_TAG, 0, 0))
if (ABILITY_ON_OPPOSING_FIELD(gActiveBattler, ABILITY_SHADOW_TAG))
return FALSE;
if (AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gActiveBattler, ABILITY_ARENA_TRAP, 0, 0))
return FALSE; // misses the flying or levitate check
if (AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_MAGNET_PULL, 0, 0))
if (ABILITY_ON_OPPOSING_FIELD(gActiveBattler, ABILITY_ARENA_TRAP)) // Misses the flying type and Levitate check.
return FALSE;
if (ABILITY_ON_FIELD2(ABILITY_MAGNET_PULL))
{
if (gBattleMons[gActiveBattler].type1 == TYPE_STEEL)
return FALSE;
@ -448,21 +451,21 @@ static bool8 ShouldSwitch(void)
availableToSwitch = 0;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
bankIn1 = *activeBankPtr;
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(GetBattlerPosition(*activeBankPtr) ^ BIT_FLANK)])
bankIn2 = *activeBankPtr;
battlerIn1 = *activeBattlerPtr;
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(GetBattlerPosition(*activeBattlerPtr) ^ BIT_FLANK)])
battlerIn2 = *activeBattlerPtr;
else
bankIn2 = GetBattlerAtPosition(GetBattlerPosition(*activeBankPtr) ^ BIT_FLANK);
battlerIn2 = GetBattlerAtPosition(GetBattlerPosition(*activeBattlerPtr) ^ BIT_FLANK);
}
else
{
bankIn1 = *activeBankPtr;
bankIn2 = *activeBankPtr;
battlerIn1 = *activeBattlerPtr;
battlerIn2 = *activeBattlerPtr;
}
if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000))
{
if ((gActiveBattler & BIT_FLANK) == 0)
if ((gActiveBattler & BIT_FLANK) == B_FLANK_LEFT)
firstId = 0, lastId = 3;
else
firstId = 3, lastId = 6;
@ -485,13 +488,13 @@ static bool8 ShouldSwitch(void)
continue;
if (GetMonData(&party[i], MON_DATA_SPECIES2) == SPECIES_EGG)
continue;
if (i == gBattlerPartyIndexes[bankIn1])
if (i == gBattlerPartyIndexes[battlerIn1])
continue;
if (i == gBattlerPartyIndexes[bankIn2])
if (i == gBattlerPartyIndexes[battlerIn2])
continue;
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn1))
if (i == *(gBattleStruct->monToSwitchIntoId + battlerIn1))
continue;
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn2))
if (i == *(gBattleStruct->monToSwitchIntoId + battlerIn2))
continue;
availableToSwitch++;
@ -521,10 +524,10 @@ static bool8 ShouldSwitch(void)
void AI_TrySwitchOrUseItem(void)
{
struct Pokemon *party;
u8 bankIn1, bankIn2;
u8 battlerIn1, battlerIn2;
s32 firstId;
s32 lastId; // + 1
u8 bankIdentity = GetBattlerPosition(gActiveBattler);
u8 battlerIdentity = GetBattlerPosition(gActiveBattler);
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
party = gPlayerParty;
@ -535,25 +538,25 @@ void AI_TrySwitchOrUseItem(void)
{
if (ShouldSwitch())
{
if (*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) == 6)
if (*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) == PARTY_SIZE)
{
s32 monToSwitchId = GetMostSuitableMonToSwitchInto();
if (monToSwitchId == 6)
if (monToSwitchId == PARTY_SIZE)
{
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
{
bankIn1 = GetBattlerAtPosition(bankIdentity);
bankIn2 = bankIn1;
battlerIn1 = GetBattlerAtPosition(battlerIdentity);
battlerIn2 = battlerIn1;
}
else
{
bankIn1 = GetBattlerAtPosition(bankIdentity);
bankIn2 = GetBattlerAtPosition(bankIdentity ^ BIT_FLANK);
battlerIn1 = GetBattlerAtPosition(battlerIdentity);
battlerIn2 = GetBattlerAtPosition(battlerIdentity ^ BIT_FLANK);
}
if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000))
{
if ((gActiveBattler & BIT_FLANK) == 0)
if ((gActiveBattler & BIT_FLANK) == B_FLANK_LEFT)
firstId = 0, lastId = 3;
else
firstId = 3, lastId = 6;
@ -567,13 +570,13 @@ void AI_TrySwitchOrUseItem(void)
{
if (GetMonData(&party[monToSwitchId], MON_DATA_HP) == 0)
continue;
if (monToSwitchId == gBattlerPartyIndexes[bankIn1])
if (monToSwitchId == gBattlerPartyIndexes[battlerIn1])
continue;
if (monToSwitchId == gBattlerPartyIndexes[bankIn2])
if (monToSwitchId == gBattlerPartyIndexes[battlerIn2])
continue;
if (monToSwitchId == *(gBattleStruct->monToSwitchIntoId + bankIn1))
if (monToSwitchId == *(gBattleStruct->monToSwitchIntoId + battlerIn1))
continue;
if (monToSwitchId == *(gBattleStruct->monToSwitchIntoId + bankIn2))
if (monToSwitchId == *(gBattleStruct->monToSwitchIntoId + battlerIn2))
continue;
break;
@ -608,10 +611,10 @@ static void ModulateByTypeEffectiveness(u8 atkType, u8 defType1, u8 defType2, u8
}
else if (TYPE_EFFECT_ATK_TYPE(i) == atkType)
{
// check type1
// Check type1.
if (TYPE_EFFECT_DEF_TYPE(i) == defType1)
*var = (*var * TYPE_EFFECT_MULTIPLIER(i)) / 10;
// check type2
// Check type2.
if (TYPE_EFFECT_DEF_TYPE(i) == defType2 && defType1 != defType2)
*var = (*var * TYPE_EFFECT_MULTIPLIER(i)) / 10;
}
@ -621,10 +624,10 @@ static void ModulateByTypeEffectiveness(u8 atkType, u8 defType1, u8 defType2, u8
u8 GetMostSuitableMonToSwitchInto(void)
{
u8 opposingBank;
u8 bestDmg; // note : should be changed to u32 for obvious reasons
u8 opposingBattler;
u8 bestDmg; // Note : should be changed to u32 for obvious reasons.
u8 bestMonId;
u8 bankIn1, bankIn2;
u8 battlerIn1, battlerIn2;
s32 firstId;
s32 lastId; // + 1
struct Pokemon *party;
@ -632,34 +635,34 @@ u8 GetMostSuitableMonToSwitchInto(void)
u8 invalidMons;
u16 move;
if (*(gBattleStruct->monToSwitchIntoId + gActiveBattler) != 6)
if (*(gBattleStruct->monToSwitchIntoId + gActiveBattler) != PARTY_SIZE)
return *(gBattleStruct->monToSwitchIntoId + gActiveBattler);
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
return gBattlerPartyIndexes[gActiveBattler] + 1;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
bankIn1 = gActiveBattler;
battlerIn1 = gActiveBattler;
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)])
bankIn2 = gActiveBattler;
battlerIn2 = gActiveBattler;
else
bankIn2 = GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK);
battlerIn2 = GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK);
// UB: It considers the opponent only player's side even though it can battle alongside player;
opposingBank = Random() & BIT_FLANK;
if (gAbsentBattlerFlags & gBitTable[opposingBank])
opposingBank ^= BIT_FLANK;
// UB: It considers the opponent only player's side even though it can battle alongside player.
opposingBattler = Random() & BIT_FLANK;
if (gAbsentBattlerFlags & gBitTable[opposingBattler])
opposingBattler ^= BIT_FLANK;
}
else
{
opposingBank = GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_SIDE);
bankIn1 = gActiveBattler;
bankIn2 = gActiveBattler;
opposingBattler = GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_SIDE);
battlerIn1 = gActiveBattler;
battlerIn2 = gActiveBattler;
}
if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000))
{
if ((gActiveBattler & BIT_FLANK) == 0)
if ((gActiveBattler & BIT_FLANK) == B_FLANK_LEFT)
firstId = 0, lastId = 3;
else
firstId = 3, lastId = 6;
@ -676,27 +679,27 @@ u8 GetMostSuitableMonToSwitchInto(void)
invalidMons = 0;
while (invalidMons != 0x3F) // all mons are invalid
while (invalidMons != 0x3F) // All mons are invalid.
{
bestDmg = 0;
bestMonId = 6;
// find the mon which type is the most suitable offensively
// Find the mon whose type is the most suitable offensively.
for (i = firstId; i < lastId; i++)
{
u16 species = GetMonData(&party[i], MON_DATA_SPECIES);
if (species != SPECIES_NONE
&& GetMonData(&party[i], MON_DATA_HP) != 0
&& !(gBitTable[i] & invalidMons)
&& gBattlerPartyIndexes[bankIn1] != i
&& gBattlerPartyIndexes[bankIn2] != i
&& i != *(gBattleStruct->monToSwitchIntoId + bankIn1)
&& i != *(gBattleStruct->monToSwitchIntoId + bankIn2))
&& gBattlerPartyIndexes[battlerIn1] != i
&& gBattlerPartyIndexes[battlerIn2] != i
&& i != *(gBattleStruct->monToSwitchIntoId + battlerIn1)
&& i != *(gBattleStruct->monToSwitchIntoId + battlerIn2))
{
u8 type1 = gBaseStats[species].type1;
u8 type2 = gBaseStats[species].type2;
u8 typeDmg = 10;
ModulateByTypeEffectiveness(gBattleMons[opposingBank].type1, type1, type2, &typeDmg);
ModulateByTypeEffectiveness(gBattleMons[opposingBank].type2, type1, type2, &typeDmg);
ModulateByTypeEffectiveness(gBattleMons[opposingBattler].type1, type1, type2, &typeDmg);
ModulateByTypeEffectiveness(gBattleMons[opposingBattler].type2, type1, type2, &typeDmg);
if (bestDmg < typeDmg)
{
bestDmg = typeDmg;
@ -709,24 +712,24 @@ u8 GetMostSuitableMonToSwitchInto(void)
}
}
// ok, we know the mon has the right typing but does it have at least one super effective move?
if (bestMonId != 6)
// Ok, we know the mon has the right typing but does it have at least one super effective move?
if (bestMonId != PARTY_SIZE)
{
for (i = 0; i < 4; i++)
{
move = GetMonData(&party[bestMonId], MON_DATA_MOVE1 + i);
if (move != MOVE_NONE && TypeCalc(move, gActiveBattler, opposingBank) & MOVE_RESULT_SUPER_EFFECTIVE)
if (move != MOVE_NONE && TypeCalc(move, gActiveBattler, opposingBattler) & MOVE_RESULT_SUPER_EFFECTIVE)
break;
}
if (i != 4)
return bestMonId; // has both the typing and at least one super effective move
return bestMonId; // Has both the typing and at least one super effective move.
invalidMons |= gBitTable[bestMonId]; // sorry buddy, we want something better
invalidMons |= gBitTable[bestMonId]; // Sorry buddy, we want something better.
}
else
{
invalidMons = 0x3F; // no viable mon to switch
invalidMons = 0x3F; // No viable mon to switch.
}
}
@ -738,20 +741,20 @@ u8 GetMostSuitableMonToSwitchInto(void)
bestDmg = 0;
bestMonId = 6;
// if we couldn't find the best mon in terms of typing, find the one that deals most damage
// If we couldn't find the best mon in terms of typing, find the one that deals most damage.
for (i = firstId; i < lastId; i++)
{
if ((u16)(GetMonData(&party[i], MON_DATA_SPECIES)) == SPECIES_NONE)
continue;
if (GetMonData(&party[i], MON_DATA_HP) == 0)
continue;
if (gBattlerPartyIndexes[bankIn1] == i)
if (gBattlerPartyIndexes[battlerIn1] == i)
continue;
if (gBattlerPartyIndexes[bankIn2] == i)
if (gBattlerPartyIndexes[battlerIn2] == i)
continue;
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn1))
if (i == *(gBattleStruct->monToSwitchIntoId + battlerIn1))
continue;
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn2))
if (i == *(gBattleStruct->monToSwitchIntoId + battlerIn2))
continue;
for (j = 0; j < 4; j++)
@ -760,8 +763,8 @@ u8 GetMostSuitableMonToSwitchInto(void)
gBattleMoveDamage = 0;
if (move != MOVE_NONE && gBattleMoves[move].power != 1)
{
AI_CalcDmg(gActiveBattler, opposingBank);
TypeCalc(move, gActiveBattler, opposingBank);
AI_CalcDmg(gActiveBattler, opposingBattler);
TypeCalc(move, gActiveBattler, opposingBattler);
}
if (bestDmg < gBattleMoveDamage)
{
@ -774,21 +777,21 @@ u8 GetMostSuitableMonToSwitchInto(void)
return bestMonId;
}
// TODO: use PokemonItemEffect struct instead of u8 once it's documented
// TODO: use PokemonItemEffect struct instead of u8 once it's documented.
static u8 GetAI_ItemType(u8 itemId, const u8 *itemEffect) // NOTE: should take u16 as item Id argument
{
if (itemId == ITEM_FULL_RESTORE)
return AI_ITEM_FULL_RESTORE;
if (itemEffect[4] & 4)
else if (itemEffect[4] & 4)
return AI_ITEM_HEAL_HP;
if (itemEffect[3] & 0x3F)
else if (itemEffect[3] & 0x3F)
return AI_ITEM_CURE_CONDITION;
if (itemEffect[0] & 0x3F || itemEffect[1] != 0 || itemEffect[2] != 0)
else if (itemEffect[0] & 0x3F || itemEffect[1] != 0 || itemEffect[2] != 0)
return AI_ITEM_X_STAT;
if (itemEffect[3] & 0x80)
else if (itemEffect[3] & 0x80)
return AI_ITEM_GUARD_SPECS;
return AI_ITEM_NOT_RECOGNIZABLE;
else
return AI_ITEM_NOT_RECOGNIZABLE;
}
static bool8 ShouldUseItem(void)
@ -806,7 +809,7 @@ static bool8 ShouldUseItem(void)
else
party = gEnemyParty;
for (i = 0; i < 6; i++)
for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&party[i], MON_DATA_HP) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
@ -821,7 +824,7 @@ static bool8 ShouldUseItem(void)
u16 item;
const u8 *itemEffects;
u8 paramOffset;
u8 bankSide;
u8 battlerSide;
if (i != 0 && validMons > (gBattleResources->battleHistory->itemsNo - i) + 1)
continue;
@ -908,8 +911,8 @@ static bool8 ShouldUseItem(void)
shouldUse = TRUE;
break;
case AI_ITEM_GUARD_SPECS:
bankSide = GetBattlerSide(gActiveBattler);
if (gDisableStructs[gActiveBattler].isFirstTurn != 0 && gSideTimers[bankSide].mistTimer == 0)
battlerSide = GetBattlerSide(gActiveBattler);
if (gDisableStructs[gActiveBattler].isFirstTurn != 0 && gSideTimers[battlerSide].mistTimer == 0)
shouldUse = TRUE;
break;
case AI_ITEM_NOT_RECOGNIZABLE:

View File

@ -120,7 +120,7 @@ EWRAM_DATA static u16 sSoundAnimFramesToWait = 0;
EWRAM_DATA static u8 sMonAnimTaskIdArray[2] = {0};
EWRAM_DATA u8 gAnimMoveTurn = 0;
EWRAM_DATA static u8 sAnimBackgroundFadeState = 0;
EWRAM_DATA static u16 sAnimMoveIndex = 0; // set but unused.
EWRAM_DATA static u16 sAnimMoveIndex = 0; // Set but unused.
EWRAM_DATA u8 gBattleAnimAttacker = 0;
EWRAM_DATA u8 gBattleAnimTarget = 0;
EWRAM_DATA u16 gAnimBattlerSpecies[MAX_BATTLERS_COUNT] = {0};
@ -179,6 +179,7 @@ static void (* const sScriptCmdTable[])(void) =
ScriptCmd_stopsound
};
// code
void ClearBattleAnimationVars(void)
{
s32 i;
@ -192,11 +193,11 @@ void ClearBattleAnimationVars(void)
gAnimMovePower = 0;
gAnimFriendship = 0;
// clear index array.
// Clear index array.
for (i = 0; i < ANIM_SPRITE_INDEX_COUNT; i++)
sAnimSpriteIndexArray[i] |= 0xFFFF;
// clear anim args.
// Clear anim args.
for (i = 0; i < ANIM_ARGS_COUNT; i++)
gBattleAnimArgs[i] = 0;
@ -459,7 +460,7 @@ static void ScriptCmd_delay(void)
gAnimScriptCallback = WaitAnimFrameCount;
}
// wait for visual tasks to finish.
// Wait for visual tasks to finish.
static void ScriptCmd_waitforvisualfinish(void)
{
if (gAnimVisualTaskCount == 0)
@ -486,7 +487,7 @@ static void ScriptCmd_end(void)
s32 i;
bool32 continuousAnim = FALSE;
// keep waiting as long as there is animations to be done.
// Keep waiting as long as there are animations to be done.
if (gAnimVisualTaskCount != 0 || gAnimSoundTaskCount != 0
|| sMonAnimTaskIdArray[0] != 0xFF || sMonAnimTaskIdArray[1] != 0xFF)
{
@ -495,10 +496,10 @@ static void ScriptCmd_end(void)
return;
}
// finish the sound effects.
// Finish the sound effects.
if (IsSEPlaying())
{
if (++sSoundAnimFramesToWait <= 90) // wait 90 frames, then halt the sound effect.
if (++sSoundAnimFramesToWait <= 90) // Wait 90 frames, then halt the sound effect.
{
gAnimFramesToWait = 1;
return;
@ -510,7 +511,7 @@ static void ScriptCmd_end(void)
}
}
// the SE has halted, so set the SE Frame Counter to 0 and continue.
// The SE has halted, so set the SE Frame Counter to 0 and continue.
sSoundAnimFramesToWait = 0;
for (i = 0; i < ANIM_SPRITE_INDEX_COUNT; i++)
@ -523,7 +524,7 @@ static void ScriptCmd_end(void)
}
}
if (!continuousAnim) // may have been used for debug?
if (!continuousAnim) // May have been used for debug?
{
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 256);
if (!IsContest())
@ -592,12 +593,12 @@ static void ScriptCmd_monbg(void)
bool8 toBG_2;
u8 taskId;
u8 battlerId;
u8 animBank;
u8 animBattler;
sBattleAnimScriptPtr++;
animBank = sBattleAnimScriptPtr[0];
if (animBank & ANIM_TARGET)
animBattler = sBattleAnimScriptPtr[0];
if (animBattler & ANIM_TARGET)
battlerId = gBattleAnimTarget;
else
battlerId = gBattleAnimAttacker;
@ -655,7 +656,7 @@ bool8 IsBattlerSpriteVisible(u8 battlerId)
if (!IsBattlerSpritePresent(battlerId))
return FALSE;
if (IsContest())
return TRUE; // this line wont ever be reached.
return TRUE; // This line won't ever be reached.
if (!gBattleSpritesDataPtr->battlerData[battlerId].invisible || !gSprites[gBattlerSpriteIds[battlerId]].invisible)
return TRUE;
@ -847,32 +848,32 @@ static void task_pA_ma0A_obj_to_bg_pal(u8 taskId)
static void ScriptCmd_clearmonbg(void)
{
u8 animBankId;
u8 animBattlerId;
u8 battlerId;
u8 taskId;
sBattleAnimScriptPtr++;
animBankId = sBattleAnimScriptPtr[0];
animBattlerId = sBattleAnimScriptPtr[0];
if (animBankId == ANIM_ATTACKER)
animBankId = ANIM_ATK_PARTNER;
else if (animBankId == ANIM_TARGET)
animBankId = ANIM_DEF_PARTNER;
if (animBattlerId == ANIM_ATTACKER)
animBattlerId = ANIM_ATK_PARTNER;
else if (animBattlerId == ANIM_TARGET)
animBattlerId = ANIM_DEF_PARTNER;
if (animBankId == ANIM_ATTACKER || animBankId == ANIM_ATK_PARTNER)
if (animBattlerId == ANIM_ATTACKER || animBattlerId == ANIM_ATK_PARTNER)
battlerId = gBattleAnimAttacker;
else
battlerId = gBattleAnimTarget;
if (sMonAnimTaskIdArray[0] != 0xFF)
gSprites[gBattlerSpriteIds[battlerId]].invisible = 0;
if (animBankId > 1 && sMonAnimTaskIdArray[1] != 0xFF)
if (animBattlerId > 1 && sMonAnimTaskIdArray[1] != 0xFF)
gSprites[gBattlerSpriteIds[battlerId ^ BIT_FLANK]].invisible = 0;
else
animBankId = 0;
animBattlerId = 0;
taskId = CreateTask(sub_80A4980, 5);
gTasks[taskId].data[0] = animBankId;
gTasks[taskId].data[0] = animBattlerId;
gTasks[taskId].data[2] = battlerId;
sBattleAnimScriptPtr++;
@ -910,18 +911,18 @@ static void ScriptCmd_monbg_22(void)
{
bool8 toBG_2;
u8 battlerId;
u8 animBankId;
u8 animBattlerId;
sBattleAnimScriptPtr++;
animBankId = sBattleAnimScriptPtr[0];
animBattlerId = sBattleAnimScriptPtr[0];
if (animBankId == ANIM_ATTACKER)
animBankId = ANIM_ATK_PARTNER;
else if (animBankId == ANIM_TARGET)
animBankId = ANIM_DEF_PARTNER;
if (animBattlerId == ANIM_ATTACKER)
animBattlerId = ANIM_ATK_PARTNER;
else if (animBattlerId == ANIM_TARGET)
animBattlerId = ANIM_DEF_PARTNER;
if (animBankId == ANIM_ATTACKER || animBankId == ANIM_ATK_PARTNER)
if (animBattlerId == ANIM_ATTACKER || animBattlerId == ANIM_ATK_PARTNER)
battlerId = gBattleAnimAttacker;
else
battlerId = gBattleAnimTarget;
@ -938,7 +939,7 @@ static void ScriptCmd_monbg_22(void)
}
battlerId ^= BIT_FLANK;
if (animBankId > 1 && IsBattlerSpriteVisible(battlerId))
if (animBattlerId > 1 && IsBattlerSpriteVisible(battlerId))
{
u8 position = GetBattlerPosition(battlerId);
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
@ -954,32 +955,32 @@ static void ScriptCmd_monbg_22(void)
static void ScriptCmd_clearmonbg_23(void)
{
u8 animBankId;
u8 animBattlerId;
u8 battlerId;
u8 taskId;
sBattleAnimScriptPtr++;
animBankId = sBattleAnimScriptPtr[0];
animBattlerId = sBattleAnimScriptPtr[0];
if (animBankId == ANIM_ATTACKER)
animBankId = ANIM_ATK_PARTNER;
else if (animBankId == ANIM_TARGET)
animBankId = ANIM_DEF_PARTNER;
if (animBattlerId == ANIM_ATTACKER)
animBattlerId = ANIM_ATK_PARTNER;
else if (animBattlerId == ANIM_TARGET)
animBattlerId = ANIM_DEF_PARTNER;
if (animBankId == ANIM_ATTACKER || animBankId == ANIM_ATK_PARTNER)
if (animBattlerId == ANIM_ATTACKER || animBattlerId == ANIM_ATK_PARTNER)
battlerId = gBattleAnimAttacker;
else
battlerId = gBattleAnimTarget;
if (IsBattlerSpriteVisible(battlerId))
gSprites[gBattlerSpriteIds[battlerId]].invisible = 0;
if (animBankId > 1 && IsBattlerSpriteVisible(battlerId ^ BIT_FLANK))
if (animBattlerId > 1 && IsBattlerSpriteVisible(battlerId ^ BIT_FLANK))
gSprites[gBattlerSpriteIds[battlerId ^ BIT_FLANK]].invisible = 0;
else
animBankId = 0;
animBattlerId = 0;
taskId = CreateTask(sub_80A4BB0, 5);
gTasks[taskId].data[0] = animBankId;
gTasks[taskId].data[0] = animBattlerId;
gTasks[taskId].data[2] = battlerId;
sBattleAnimScriptPtr++;
@ -1419,18 +1420,18 @@ void Task_PanFromInitialToTarget(u8 taskId)
pan = currentPan + incrementPan;
gTasks[taskId].tCurrentPan = pan;
if (incrementPan == 0) // If we're not incrementing, just cancel the task immediately
if (incrementPan == 0) // If we're not incrementing, just cancel the task immediately.
{
destroyTask = TRUE;
}
else if (initialPanning < targetPanning) // Panning increasing
else if (initialPanning < targetPanning) // Panning increasing.
{
if (pan >= targetPanning) // Target reached
if (pan >= targetPanning) // Target reached.
destroyTask = TRUE;
}
else // Panning decreasing
else // Panning decreasing.
{
if (pan <= targetPanning) // Target reached
if (pan <= targetPanning) // Target reached.
destroyTask = TRUE;
}
@ -1684,14 +1685,14 @@ static void ScriptCmd_jumpifcontest(void)
static void ScriptCmd_monbgprio_28(void)
{
u8 wantedBank;
u8 wantedBattler;
u8 battlerId;
u8 battlerPosition;
wantedBank = sBattleAnimScriptPtr[1];
wantedBattler = sBattleAnimScriptPtr[1];
sBattleAnimScriptPtr += 2;
if (wantedBank != ANIM_ATTACKER)
if (wantedBattler != ANIM_ATTACKER)
battlerId = gBattleAnimTarget;
else
battlerId = gBattleAnimAttacker;
@ -1716,15 +1717,15 @@ static void ScriptCmd_monbgprio_29(void)
static void ScriptCmd_monbgprio_2A(void)
{
u8 wantedBank;
u8 wantedBattler;
u8 battlerPosition;
u8 battlerId;
wantedBank = sBattleAnimScriptPtr[1];
wantedBattler = sBattleAnimScriptPtr[1];
sBattleAnimScriptPtr += 2;
if (GetBattlerSide(gBattleAnimAttacker) != GetBattlerSide(gBattleAnimTarget))
{
if (wantedBank != ANIM_ATTACKER)
if (wantedBattler != ANIM_ATTACKER)
battlerId = gBattleAnimTarget;
else
battlerId = gBattleAnimAttacker;
@ -1762,16 +1763,16 @@ static void ScriptCmd_visible(void)
static void ScriptCmd_doublebattle_2D(void)
{
u8 wantedBank;
u8 wantedBattler;
u8 r4;
u8 spriteId;
wantedBank = sBattleAnimScriptPtr[1];
wantedBattler = sBattleAnimScriptPtr[1];
sBattleAnimScriptPtr += 2;
if (!IsContest() && IsDoubleBattle()
&& GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget))
{
if (wantedBank == ANIM_ATTACKER)
if (wantedBattler == ANIM_ATTACKER)
{
r4 = sub_80A8364(gBattleAnimAttacker);
spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
@ -1797,16 +1798,16 @@ static void ScriptCmd_doublebattle_2D(void)
static void ScriptCmd_doublebattle_2E(void)
{
u8 wantedBank;
u8 wantedBattler;
u8 r4;
u8 spriteId;
wantedBank = sBattleAnimScriptPtr[1];
wantedBattler = sBattleAnimScriptPtr[1];
sBattleAnimScriptPtr += 2;
if (!IsContest() && IsDoubleBattle()
&& GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget))
{
if (wantedBank == ANIM_ATTACKER)
if (wantedBattler == ANIM_ATTACKER)
{
r4 = sub_80A8364(gBattleAnimAttacker);
spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);

View File

@ -133,13 +133,13 @@ void sub_8158D8C(u8 taskId)
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
species = gContestResources->field_18->field_0;
else
DestroyAnimVisualTask(taskId); // UB: function should return upon destroying task
DestroyAnimVisualTask(taskId); // UB: function should return upon destroying task.
}
else
{
u8 battlerId;
// get wanted battler
// Get wanted battler.
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
battlerId = gBattleAnimAttacker;
else if (gBattleAnimArgs[0] == ANIM_TARGET)
@ -149,7 +149,7 @@ void sub_8158D8C(u8 taskId)
else
battlerId = BATTLE_PARTNER(gBattleAnimTarget);
// check if battler is visible
// Check if battler is visible.
if ((gBattleAnimArgs[0] == ANIM_TARGET || gBattleAnimArgs[0] == ANIM_DEF_PARTNER) && !IsBattlerSpriteVisible(battlerId))
{
DestroyAnimVisualTask(taskId);
@ -179,13 +179,13 @@ void sub_8158E9C(u8 taskId)
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
species = gContestResources->field_18->field_0;
else
DestroyAnimVisualTask(taskId); // UB: function should return upon destroying task
DestroyAnimVisualTask(taskId); // UB: function should return upon destroying task.
}
else
{
u8 battlerId;
// get wanted battler
// Get wanted battler.
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
battlerId = gBattleAnimAttacker;
else if (gBattleAnimArgs[0] == ANIM_TARGET)
@ -195,7 +195,7 @@ void sub_8158E9C(u8 taskId)
else
battlerId = BATTLE_PARTNER(gBattleAnimTarget);
// check if battler is visible
// Check if battler is visible.
if ((gBattleAnimArgs[0] == ANIM_TARGET || gBattleAnimArgs[0] == ANIM_DEF_PARTNER) && !IsBattlerSpriteVisible(battlerId))
{
DestroyAnimVisualTask(taskId);

View File

@ -32,8 +32,8 @@ struct BattleBackground
extern const struct SpriteTemplate gUnknown_0831A9D0;
extern const struct SpriteTemplate gUnknown_0831A9E8;
extern const struct CompressedSpriteSheet gUnknown_0831AA00;
extern const struct BgTemplate gUnknown_0831AA08[4];
extern const struct WindowTemplate *gUnknown_0831ABA0[];
extern const struct BgTemplate gBattleBgTemplates[4];
extern const struct WindowTemplate *const gBattleWindowTemplates[];
extern const struct BattleBackground gBattleTerrainTable[];
extern u16 gBattle_BG1_X;
@ -43,23 +43,23 @@ extern u16 gBattle_BG2_Y;
extern u8 GetCurrentMapBattleScene(void);
void sub_8035658(void)
void BattleInitBgsAndWindows(void)
{
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_0831AA08, ARRAY_COUNT(gUnknown_0831AA08));
InitBgsFromTemplates(0, gBattleBgTemplates, ARRAY_COUNT(gBattleBgTemplates));
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
{
gBattleScripting.field_24 = 1;
gBattleScripting.windowsType = 1;
SetBgTilemapBuffer(1, gUnknown_02023060);
SetBgTilemapBuffer(2, gUnknown_02023060);
}
else
{
gBattleScripting.field_24 = 0;
gBattleScripting.windowsType = 0;
}
InitWindows(gUnknown_0831ABA0[gBattleScripting.field_24]);
InitWindows(gBattleWindowTemplates[gBattleScripting.windowsType]);
DeactivateAllTextPrinters();
}
@ -67,14 +67,14 @@ void sub_80356D0(void)
{
DisableInterrupts(INTR_FLAG_HBLANK);
EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_VCOUNT | INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL);
sub_8035658();
BattleInitBgsAndWindows();
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJWIN_ON | DISPCNT_WIN0_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
}
void ApplyPlayerChosenFrameToBattleMenu(void)
void LoadBattleMenuWindowGfx(void)
{
LoadUserWindowBorderGfx(2, 0x12, 0x10);
LoadUserWindowBorderGfx(2, 0x22, 0x10);
@ -83,7 +83,7 @@ void ApplyPlayerChosenFrameToBattleMenu(void)
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
{
sub_81978B0(0x70);
copy_textbox_border_tile_patterns_to_vram(0, 0x30, 0x70);
LoadMessageBoxGfx(0, 0x30, 0x70);
gPlttBufferUnfaded[0x76] = 0;
CpuCopy16(&gPlttBufferUnfaded[0x76], &gPlttBufferFaded[0x76], 2);
}
@ -194,12 +194,12 @@ void LoadBattleTextboxAndBackground(void)
CopyToBgTilemapBuffer(0, gBattleTextboxTilemap, 0, 0);
CopyBgTilemapBufferToVram(0);
LoadCompressedPalette(gBattleTextboxPalette, 0, 0x40);
ApplyPlayerChosenFrameToBattleMenu();
LoadBattleMenuWindowGfx();
DrawMainBattleBackground();
}
static void sub_8035AE4(u8 taskId, u8 bank, u8 bgId, u8 destX, u8 destY)
static void sub_8035AE4(u8 taskId, u8 battlerId, u8 bgId, u8 destX, u8 destY)
{
s32 i;
u16 var = 0;
@ -209,7 +209,7 @@ static void sub_8035AE4(u8 taskId, u8 bank, u8 bgId, u8 destX, u8 destY)
{
if (gTasks[taskId].data[5] != 0)
{
switch (bank)
switch (battlerId)
{
case 0:
var = 0x3F & gTasks[taskId].data[3];
@ -227,7 +227,7 @@ static void sub_8035AE4(u8 taskId, u8 bank, u8 bgId, u8 destX, u8 destY)
}
else
{
switch (bank)
switch (battlerId)
{
case 0:
var = 0x3F & gTasks[taskId].data[3];
@ -254,7 +254,7 @@ static void sub_8035AE4(u8 taskId, u8 bank, u8 bgId, u8 destX, u8 destY)
}
else
{
if (bank == gBattleScripting.multiplayerId)
if (battlerId == gBattleScripting.multiplayerId)
var = gTasks[taskId].data[3];
else
var = gTasks[taskId].data[4];
@ -273,7 +273,7 @@ static void sub_8035C4C(void)
{
if (gBattleOutcome == B_OUTCOME_DREW)
{
BattleHandleAddTextPrinter(gText_Draw, 0x15);
BattlePutTextOnWindow(gText_Draw, 0x15);
}
else if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
@ -282,20 +282,20 @@ static void sub_8035C4C(void)
switch (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18)
{
case 0:
BattleHandleAddTextPrinter(gText_Win, 0x16);
BattleHandleAddTextPrinter(gText_Loss, 0x17);
BattlePutTextOnWindow(gText_Win, 0x16);
BattlePutTextOnWindow(gText_Loss, 0x17);
break;
case 1:
BattleHandleAddTextPrinter(gText_Win, 0x17);
BattleHandleAddTextPrinter(gText_Loss, 0x16);
BattlePutTextOnWindow(gText_Win, 0x17);
BattlePutTextOnWindow(gText_Loss, 0x16);
break;
case 2:
BattleHandleAddTextPrinter(gText_Win, 0x16);
BattleHandleAddTextPrinter(gText_Loss, 0x17);
BattlePutTextOnWindow(gText_Win, 0x16);
BattlePutTextOnWindow(gText_Loss, 0x17);
break;
case 3:
BattleHandleAddTextPrinter(gText_Win, 0x17);
BattleHandleAddTextPrinter(gText_Loss, 0x16);
BattlePutTextOnWindow(gText_Win, 0x17);
BattlePutTextOnWindow(gText_Loss, 0x16);
break;
}
}
@ -304,20 +304,20 @@ static void sub_8035C4C(void)
switch (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18)
{
case 0:
BattleHandleAddTextPrinter(gText_Win, 0x17);
BattleHandleAddTextPrinter(gText_Loss, 0x16);
BattlePutTextOnWindow(gText_Win, 0x17);
BattlePutTextOnWindow(gText_Loss, 0x16);
break;
case 1:
BattleHandleAddTextPrinter(gText_Win, 0x16);
BattleHandleAddTextPrinter(gText_Loss, 0x17);
BattlePutTextOnWindow(gText_Win, 0x16);
BattlePutTextOnWindow(gText_Loss, 0x17);
break;
case 2:
BattleHandleAddTextPrinter(gText_Win, 0x17);
BattleHandleAddTextPrinter(gText_Loss, 0x16);
BattlePutTextOnWindow(gText_Win, 0x17);
BattlePutTextOnWindow(gText_Loss, 0x16);
break;
case 3:
BattleHandleAddTextPrinter(gText_Win, 0x16);
BattleHandleAddTextPrinter(gText_Loss, 0x17);
BattlePutTextOnWindow(gText_Win, 0x16);
BattlePutTextOnWindow(gText_Loss, 0x17);
break;
}
}
@ -326,26 +326,26 @@ static void sub_8035C4C(void)
{
if (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18 != 0)
{
BattleHandleAddTextPrinter(gText_Win, 0x17);
BattleHandleAddTextPrinter(gText_Loss, 0x16);
BattlePutTextOnWindow(gText_Win, 0x17);
BattlePutTextOnWindow(gText_Loss, 0x16);
}
else
{
BattleHandleAddTextPrinter(gText_Win, 0x16);
BattleHandleAddTextPrinter(gText_Loss, 0x17);
BattlePutTextOnWindow(gText_Win, 0x16);
BattlePutTextOnWindow(gText_Loss, 0x17);
}
}
else
{
if (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18 != 0)
{
BattleHandleAddTextPrinter(gText_Win, 0x16);
BattleHandleAddTextPrinter(gText_Loss, 0x17);
BattlePutTextOnWindow(gText_Win, 0x16);
BattlePutTextOnWindow(gText_Loss, 0x17);
}
else
{
BattleHandleAddTextPrinter(gText_Win, 0x17);
BattleHandleAddTextPrinter(gText_Loss, 0x16);
BattlePutTextOnWindow(gText_Win, 0x17);
BattlePutTextOnWindow(gText_Loss, 0x16);
}
}
}
@ -369,19 +369,19 @@ void sub_8035D74(u8 taskId)
switch (linkPlayer->lp_field_18)
{
case 0:
BattleHandleAddTextPrinter(name, 0x11);
BattlePutTextOnWindow(name, 0x11);
sub_8035AE4(taskId, linkPlayer->lp_field_18, 1, 2, 4);
break;
case 1:
BattleHandleAddTextPrinter(name, 0x12);
BattlePutTextOnWindow(name, 0x12);
sub_8035AE4(taskId, linkPlayer->lp_field_18, 2, 2, 4);
break;
case 2:
BattleHandleAddTextPrinter(name, 0x13);
BattlePutTextOnWindow(name, 0x13);
sub_8035AE4(taskId, linkPlayer->lp_field_18, 1, 2, 8);
break;
case 3:
BattleHandleAddTextPrinter(name, 0x14);
BattlePutTextOnWindow(name, 0x14);
sub_8035AE4(taskId, linkPlayer->lp_field_18, 2, 2, 8);
break;
}
@ -397,10 +397,10 @@ void sub_8035D74(u8 taskId)
opponentId = playerId, playerId = opponentId_copy;
name = gLinkPlayers[playerId].name;
BattleHandleAddTextPrinter(name, 0xF);
BattlePutTextOnWindow(name, 0xF);
name = gLinkPlayers[opponentId].name;
BattleHandleAddTextPrinter(name, 0x10);
BattlePutTextOnWindow(name, 0x10);
sub_8035AE4(taskId, playerId, 1, 2, 7);
sub_8035AE4(taskId, opponentId, 2, 2, 7);
@ -458,7 +458,7 @@ void sub_8035D74(u8 taskId)
}
}
void LoadBattleEntryBackground(void)
void DrawBattleEntryBackground(void)
{
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
{
@ -479,7 +479,7 @@ void LoadBattleEntryBackground(void)
}
else if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_EREADER_TRAINER))
{
if (!(gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) || gPartnerTrainerId == STEVEN_PARTNER_ID)
if (!(gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) || gPartnerTrainerId == TRAINER_STEVEN_PARTNER)
{
LZDecompressVram(gBattleTerrainAnimTiles_Building, (void*)(VRAM + 0x4000));
LZDecompressVram(gBattleTerrainAnimTilemap_Building, (void*)(VRAM + 0xE000));
@ -741,7 +741,7 @@ bool8 LoadChosenBattleElement(u8 caseId)
}
break;
case 6:
ApplyPlayerChosenFrameToBattleMenu();
LoadBattleMenuWindowGfx();
break;
default:
ret = TRUE;

View File

@ -34,7 +34,6 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
extern void sub_81851A8(u8 *);
extern u16 sub_8068B48(void);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
@ -89,8 +88,8 @@ static void LinkOpponentHandleFaintingCry(void);
static void LinkOpponentHandleIntroSlide(void);
static void LinkOpponentHandleIntroTrainerBallThrow(void);
static void LinkOpponentHandleDrawPartyStatusSummary(void);
static void LinkOpponentHandleCmd49(void);
static void LinkOpponentHandleCmd50(void);
static void LinkOpponentHandleHidePartyStatusSummary(void);
static void LinkOpponentHandleEndBounceEffect(void);
static void LinkOpponentHandleSpriteInvisibility(void);
static void LinkOpponentHandleBattleAnimation(void);
static void LinkOpponentHandleLinkStandbyMsg(void);
@ -161,8 +160,8 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
LinkOpponentHandleIntroSlide,
LinkOpponentHandleIntroTrainerBallThrow,
LinkOpponentHandleDrawPartyStatusSummary,
LinkOpponentHandleCmd49,
LinkOpponentHandleCmd50,
LinkOpponentHandleHidePartyStatusSummary,
LinkOpponentHandleEndBounceEffect,
LinkOpponentHandleSpriteInvisibility,
LinkOpponentHandleBattleAnimation,
LinkOpponentHandleLinkStandbyMsg,
@ -191,7 +190,7 @@ static void LinkOpponentBufferRunCommand(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
LinkOpponentBufferExecCompleted();
@ -395,7 +394,7 @@ static void sub_8064B04(void)
static void CompleteOnHealthbarDone(void)
{
s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
@ -1135,9 +1134,9 @@ static void LinkOpponentHandleLoadMonSprite(void)
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
sub_806A068(species, GetBattlerPosition(gActiveBattler));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(gActiveBattler, 2),
GetBattlerSpriteDefault_Y(gActiveBattler),
sub_80A82E4(gActiveBattler));
@ -1168,10 +1167,10 @@ static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit)
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
sub_806A068(species, GetBattlerPosition(battlerId));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(
&gUnknown_0202499C,
&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));
@ -1302,8 +1301,8 @@ static void LinkOpponentHandleDrawTrainerPic(void)
}
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
xPos,
(8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40,
sub_80A82E4(gActiveBattler));
@ -1314,7 +1313,7 @@ static void LinkOpponentHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void LinkOpponentHandleTrainerSlide(void)
@ -1327,8 +1326,8 @@ static void LinkOpponentHandleTrainerSlide(void)
trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B);
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E);
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E);
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 96;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.x += 32;
@ -1366,7 +1365,7 @@ static void LinkOpponentHandleFaintAnimation(void)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT);
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039934;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon;
gBattlerControllerFuncs[gActiveBattler] = sub_8064C14;
}
}
@ -1475,7 +1474,7 @@ static void LinkOpponentHandlePrintString(void)
gBattle_BG0_Y = 0;
stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]);
BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
BattleTv_SetDataBasedOnString(*stringId);
}
@ -1716,8 +1715,8 @@ static void LinkOpponentHandleIntroTrainerBallThrow(void)
taskId = CreateTask(sub_8067618, 5);
gTasks[taskId].data[0] = gActiveBattler;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
gBattleSpritesDataPtr->animationData->field_9_x1 = 1;
gBattlerControllerFuncs[gActiveBattler] = nullsub_28;
@ -1762,7 +1761,7 @@ static void LinkOpponentHandleDrawPartyStatusSummary(void)
}
else
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1 = 1;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1;
if (gBattleBufferA[gActiveBattler][2] != 0)
{
@ -1796,14 +1795,14 @@ static void sub_806782C(void)
}
}
static void LinkOpponentHandleCmd49(void)
static void LinkOpponentHandleHidePartyStatusSummary(void)
{
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
LinkOpponentBufferExecCompleted();
}
static void LinkOpponentHandleCmd50(void)
static void LinkOpponentHandleEndBounceEffect(void)
{
LinkOpponentBufferExecCompleted();
}

View File

@ -12,6 +12,7 @@
#include "util.h"
#include "main.h"
#include "constants/songs.h"
#include "constants/trainers.h"
#include "sound.h"
#include "window.h"
#include "m4a.h"
@ -33,7 +34,6 @@ extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
extern void sub_81851A8(u8 *);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
@ -87,8 +87,8 @@ static void LinkPartnerHandleFaintingCry(void);
static void LinkPartnerHandleIntroSlide(void);
static void LinkPartnerHandleIntroTrainerBallThrow(void);
static void LinkPartnerHandleDrawPartyStatusSummary(void);
static void LinkPartnerHandleCmd49(void);
static void LinkPartnerHandleCmd50(void);
static void LinkPartnerHandleHidePartyStatusSummary(void);
static void LinkPartnerHandleEndBounceEffect(void);
static void LinkPartnerHandleSpriteInvisibility(void);
static void LinkPartnerHandleBattleAnimation(void);
static void LinkPartnerHandleLinkStandbyMsg(void);
@ -158,8 +158,8 @@ static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
LinkPartnerHandleIntroSlide,
LinkPartnerHandleIntroTrainerBallThrow,
LinkPartnerHandleDrawPartyStatusSummary,
LinkPartnerHandleCmd49,
LinkPartnerHandleCmd50,
LinkPartnerHandleHidePartyStatusSummary,
LinkPartnerHandleEndBounceEffect,
LinkPartnerHandleSpriteInvisibility,
LinkPartnerHandleBattleAnimation,
LinkPartnerHandleLinkStandbyMsg,
@ -188,7 +188,7 @@ static void LinkPartnerBufferRunCommand(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
LinkPartnerBufferExecCompleted();
@ -279,7 +279,7 @@ static void sub_814B290(void)
static void CompleteOnHealthbarDone(void)
{
s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
@ -1023,9 +1023,9 @@ static void LinkPartnerHandleLoadMonSprite(void)
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
sub_806A068(species, GetBattlerPosition(gActiveBattler));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(gActiveBattler, 2),
GetBattlerSpriteDefault_Y(gActiveBattler),
sub_80A82E4(gActiveBattler));
@ -1053,10 +1053,10 @@ static void sub_814CC98(u8 battlerId, bool8 dontClearSubstituteBit)
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBattlerPosition(battlerId));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(
&gUnknown_0202499C,
&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));
@ -1133,12 +1133,12 @@ static void LinkPartnerHandleDrawTrainerPic(void)
if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED
|| (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN)
{
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + BACK_PIC_RED;
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + TRAINER_BACK_PIC_RED;
}
else if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY
|| (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE)
{
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + BACK_PIC_RS_BRENDAN;
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN;
}
else
{
@ -1146,15 +1146,15 @@ static void LinkPartnerHandleDrawTrainerPic(void)
}
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, sub_80A82E4(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, sub_80A82E4(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void LinkPartnerHandleTrainerSlide(void)
@ -1299,7 +1299,7 @@ static void LinkPartnerHandlePrintString(void)
gBattle_BG0_Y = 0;
stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]);
BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
BattleTv_SetDataBasedOnString(*stringId);
}
@ -1545,12 +1545,12 @@ static void LinkPartnerHandleIntroTrainerBallThrow(void)
if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED
|| (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN)
{
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + BACK_PIC_RED;
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + TRAINER_BACK_PIC_RED;
}
else if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY
|| (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE)
{
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + BACK_PIC_RS_BRENDAN;
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender + TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN;
}
else
{
@ -1564,8 +1564,8 @@ static void LinkPartnerHandleIntroTrainerBallThrow(void)
taskId = CreateTask(sub_814DCCC, 5);
gTasks[taskId].data[0] = gActiveBattler;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
gBattleSpritesDataPtr->animationData->field_9_x1 = 1;
gBattlerControllerFuncs[gActiveBattler] = nullsub_112;
@ -1611,7 +1611,7 @@ static void LinkPartnerHandleDrawPartyStatusSummary(void)
}
else
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1 = 1;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1;
gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4], gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2]);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0;
@ -1631,14 +1631,14 @@ static void sub_814DE9C(void)
}
}
static void LinkPartnerHandleCmd49(void)
static void LinkPartnerHandleHidePartyStatusSummary(void)
{
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleCmd50(void)
static void LinkPartnerHandleEndBounceEffect(void)
{
LinkPartnerBufferExecCompleted();
}

View File

@ -16,6 +16,7 @@
#include "constants/songs.h"
#include "sound.h"
#include "constants/moves.h"
#include "constants/trainers.h"
#include "window.h"
#include "m4a.h"
#include "palette.h"
@ -37,9 +38,8 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
extern void sub_81A57E4(u8 battlerId, u16 stringId);
extern u8 sub_81A4CB0(void);
extern u8 GetFrontierBrainTrainerPicIndex(void);
extern u8 sub_81D5588(u16 trainerId);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
extern u8 GetEreaderTrainerFrontSpriteId(void);
@ -94,8 +94,8 @@ static void OpponentHandleFaintingCry(void);
static void OpponentHandleIntroSlide(void);
static void OpponentHandleIntroTrainerBallThrow(void);
static void OpponentHandleDrawPartyStatusSummary(void);
static void OpponentHandleCmd49(void);
static void OpponentHandleCmd50(void);
static void OpponentHandleHidePartyStatusSummary(void);
static void OpponentHandleEndBounceEffect(void);
static void OpponentHandleSpriteInvisibility(void);
static void OpponentHandleBattleAnimation(void);
static void OpponentHandleLinkStandbyMsg(void);
@ -166,8 +166,8 @@ static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
OpponentHandleIntroSlide,
OpponentHandleIntroTrainerBallThrow,
OpponentHandleDrawPartyStatusSummary,
OpponentHandleCmd49,
OpponentHandleCmd50,
OpponentHandleHidePartyStatusSummary,
OpponentHandleEndBounceEffect,
OpponentHandleSpriteInvisibility,
OpponentHandleBattleAnimation,
OpponentHandleLinkStandbyMsg,
@ -199,7 +199,7 @@ static void OpponentBufferRunCommand(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
OpponentBufferExecCompleted();
@ -391,7 +391,7 @@ static void sub_805F994(void)
static void CompleteOnHealthbarDone(void)
{
s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
if (hpValue != -1)
{
@ -1127,9 +1127,9 @@ static void OpponentHandleLoadMonSprite(void)
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
sub_806A068(species, GetBattlerPosition(gActiveBattler));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(gActiveBattler, 2),
GetBattlerSpriteDefault_Y(gActiveBattler),
sub_80A82E4(gActiveBattler));
@ -1162,9 +1162,9 @@ static void sub_80613DC(u8 battlerId, bool8 dontClearSubstituteBit)
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
sub_806A068(species, GetBattlerPosition(battlerId));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));
@ -1232,9 +1232,9 @@ static void OpponentHandleDrawTrainerPic(void)
{
trainerPicId = GetSecretBaseTrainerPicIndex();
}
else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_3FE)
else if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN)
{
trainerPicId = sub_81A4CB0();
trainerPicId = GetFrontierBrainTrainerPicIndex();
}
else if (gBattleTypeFlags & BATTLE_TYPE_x4000000)
{
@ -1293,8 +1293,8 @@ static void OpponentHandleDrawTrainerPic(void)
}
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
xPos,
(8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40,
sub_80A82E4(gActiveBattler));
@ -1305,7 +1305,7 @@ static void OpponentHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void OpponentHandleTrainerSlide(void)
@ -1316,9 +1316,9 @@ static void OpponentHandleTrainerSlide(void)
{
trainerPicId = GetSecretBaseTrainerPicIndex();
}
else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_3FE)
else if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN)
{
trainerPicId = sub_81A4CB0();
trainerPicId = GetFrontierBrainTrainerPicIndex();
}
else if (gBattleTypeFlags & BATTLE_TYPE_x4000000)
{
@ -1365,8 +1365,8 @@ static void OpponentHandleTrainerSlide(void)
}
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E);
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E);
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 96;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.x += 32;
@ -1403,7 +1403,7 @@ static void OpponentHandleFaintAnimation(void)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT);
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039934;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon;
gBattlerControllerFuncs[gActiveBattler] = sub_805FAC4;
}
}
@ -1511,7 +1511,7 @@ static void OpponentHandlePrintString(void)
gBattle_BG0_Y = 0;
stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]);
BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
sub_81A57E4(gActiveBattler, *stringId);
}
@ -1865,8 +1865,8 @@ static void OpponentHandleIntroTrainerBallThrow(void)
taskId = CreateTask(sub_8062828, 5);
gTasks[taskId].data[0] = gActiveBattler;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
gBattleSpritesDataPtr->animationData->field_9_x1 = 1;
gBattlerControllerFuncs[gActiveBattler] = nullsub_26;
@ -1916,7 +1916,7 @@ static void OpponentHandleDrawPartyStatusSummary(void)
}
else
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1 = 1;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1;
if (gBattleBufferA[gActiveBattler][2] != 0)
{
@ -1950,14 +1950,14 @@ static void sub_8062A2C(void)
}
}
static void OpponentHandleCmd49(void)
static void OpponentHandleHidePartyStatusSummary(void)
{
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
OpponentBufferExecCompleted();
}
static void OpponentHandleCmd50(void)
static void OpponentHandleEndBounceEffect(void)
{
OpponentBufferExecCompleted();
}

View File

@ -15,6 +15,7 @@
#include "constants/songs.h"
#include "sound.h"
#include "constants/moves.h"
#include "constants/trainers.h"
#include "window.h"
#include "m4a.h"
#include "palette.h"
@ -29,6 +30,7 @@
#include "battle_setup.h"
#include "item_use.h"
#include "recorded_battle.h"
#include "party_menu.h"
extern u8 gUnknown_0203CEE8;
extern u8 gUnknown_0203CEE9;
@ -38,15 +40,13 @@ extern u16 gBattle_BG0_Y;
extern s32 gUnknown_0203CD70;
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern struct SpriteTemplate gUnknown_0202499C;
extern struct SpriteTemplate gMultiuseSpriteTemplate;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_81B89AC(u8 arg0);
extern void sub_81AABB0(void);
extern void sub_806A068(u16, u8);
extern void sub_81A57E4(u8 battlerId, u16 stringId);
extern void sub_81851A8(u8 *);
@ -100,8 +100,8 @@ static void PlayerHandleFaintingCry(void);
static void PlayerHandleIntroSlide(void);
static void PlayerHandleIntroTrainerBallThrow(void);
static void PlayerHandleDrawPartyStatusSummary(void);
static void PlayerHandleCmd49(void);
static void PlayerHandleCmd50(void);
static void PlayerHandleHidePartyStatusSummary(void);
static void PlayerHandleEndBounceEffect(void);
static void PlayerHandleSpriteInvisibility(void);
static void PlayerHandleBattleAnimation(void);
static void PlayerHandleLinkStandbyMsg(void);
@ -120,13 +120,13 @@ static void MoveSelectionDisplayMoveType(void);
static void MoveSelectionDisplayMoveNames(void);
static void HandleMoveSwitchting(void);
static void sub_8058FC0(void);
static void sub_8059828(void);
static void WaitForMonSelection(void);
static void CompleteWhenChoseItem(void);
static void sub_8059544(u8 taskId);
static void Task_LaunchLvlUpAnim(u8 taskId);
static void Task_PrepareToGiveExpWithExpBar(u8 taskId);
static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId);
static void sub_8059400(u8 taskId);
static void sub_80595A4(u8 taskId);
static void Task_UpdateLvlInHealthbox(u8 taskId);
static void PrintLinkStandbyMsg(void);
static u32 CopyPlayerMonData(u8 monId, u8 *dst);
static void SetPlayerMonData(u8 monId);
@ -187,8 +187,8 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
PlayerHandleIntroSlide,
PlayerHandleIntroTrainerBallThrow,
PlayerHandleDrawPartyStatusSummary,
PlayerHandleCmd49,
PlayerHandleCmd50,
PlayerHandleHidePartyStatusSummary,
PlayerHandleEndBounceEffect,
PlayerHandleSpriteInvisibility,
PlayerHandleBattleAnimation,
PlayerHandleLinkStandbyMsg,
@ -250,10 +250,10 @@ static void HandleInputChooseAction(void)
{
u16 itemId = gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8);
dp11b_obj_instanciate(gActiveBattler, 1, 7, 1);
dp11b_obj_instanciate(gActiveBattler, 0, 7, 1);
DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1);
DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1);
if (gMain.newAndRepeatedKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2)
if (gMain.newAndRepeatedKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
gPlayerDpadHoldFrames++;
else
gPlayerDpadHoldFrames = 0;
@ -347,8 +347,8 @@ static void HandleInputChooseAction(void)
static void sub_80577F0(void) // unused
{
dp11b_obj_free(gActiveBattler, 1);
dp11b_obj_free(gActiveBattler, 0);
EndBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX);
EndBounceEffect(gActiveBattler, BOUNCE_MON);
gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseTarget;
}
@ -358,7 +358,7 @@ static void HandleInputChooseTarget(void)
u8 identities[4];
memcpy(identities, sTargetIdentities, ARRAY_COUNT(sTargetIdentities));
dp11b_obj_instanciate(gMultiUsePlayerCursor, 1, 0xF, 1);
DoBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX, 15, 1);
// what a weird loop
i = 0;
@ -367,7 +367,7 @@ static void HandleInputChooseTarget(void)
do
{
if (i != gMultiUsePlayerCursor)
dp11b_obj_free(i, 1);
EndBounceEffect(i, BOUNCE_HEALTHBOX);
i++;
} while (i < gBattlersCount);
}
@ -382,7 +382,7 @@ static void HandleInputChooseTarget(void)
PlaySE(SE_SELECT);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C;
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
dp11b_obj_free(gMultiUsePlayerCursor, 1);
EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
PlayerBufferExecCompleted();
}
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
@ -390,9 +390,9 @@ static void HandleInputChooseTarget(void)
PlaySE(SE_SELECT);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C;
gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove;
dp11b_obj_instanciate(gActiveBattler, 1, 7, 1);
dp11b_obj_instanciate(gActiveBattler, 0, 7, 1);
dp11b_obj_free(gMultiUsePlayerCursor, 1);
DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1);
DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1);
EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
}
else if (gMain.newKeys & (DPAD_LEFT | DPAD_UP))
{
@ -485,7 +485,7 @@ static void HandleInputChooseMove(void)
bool32 canSelectTarget = FALSE;
struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBattler][4]);
if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2)
if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
gPlayerDpadHoldFrames++;
else
gPlayerDpadHoldFrames = 0;
@ -620,7 +620,7 @@ static void HandleInputChooseMove(void)
gMultiUsePlayerCursor = gMoveSelectionCursor[gActiveBattler] + 1;
MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27);
BattleHandleAddTextPrinter(gText_BattleSwitchWhich, 0xB);
BattlePutTextOnWindow(gText_BattleSwitchWhich, 0xB);
gBattlerControllerFuncs[gActiveBattler] = HandleMoveSwitchting;
}
}
@ -916,7 +916,7 @@ void sub_80587B0(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
PlayerBufferExecCompleted();
@ -1120,7 +1120,7 @@ void c3_0802FDF4(u8 taskId)
static void CompleteOnHealthbarDone(void)
{
s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
@ -1143,16 +1143,16 @@ static void CompleteOnInactiveTextPrinter(void)
#define tExpTask_monId data[0]
#define tExpTask_gainedExp data[1]
#define tExpTask_bank data[2]
#define tExpTask_battler data[2]
#define tExpTask_frames data[10]
static void Task_GiveExpToMon(u8 taskId)
{
u32 monId = (u8)(gTasks[taskId].tExpTask_monId);
u8 battlerId = gTasks[taskId].tExpTask_bank;
u8 battlerId = gTasks[taskId].tExpTask_battler;
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[battlerId]) // give exp without the expbar
if (IsDoubleBattle() == TRUE || monId != gBattlerPartyIndexes[battlerId]) // Give exp without moving the expbar.
{
struct Pokemon *mon = &gPlayerParty[monId];
u16 species = GetMonData(mon, MON_DATA_SPECIES);
@ -1162,19 +1162,19 @@ static void Task_GiveExpToMon(u8 taskId)
if (currExp + gainedExp >= nextLvlExp)
{
u8 savedActiveBank;
u8 savedActiveBattler;
SetMonData(mon, MON_DATA_EXP, &nextLvlExp);
CalculateMonStats(mon);
gainedExp -= nextLvlExp - currExp;
savedActiveBank = gActiveBattler;
savedActiveBattler = gActiveBattler;
gActiveBattler = battlerId;
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
gActiveBattler = savedActiveBank;
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELED_UP, gainedExp);
gActiveBattler = savedActiveBattler;
if (IsDoubleBattle() == TRUE
&& ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[battlerId ^ BIT_FLANK]))
gTasks[taskId].func = sub_8059544;
gTasks[taskId].func = Task_LaunchLvlUpAnim;
else
gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter;
}
@ -1196,7 +1196,7 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId)
{
u8 monIndex = gTasks[taskId].tExpTask_monId;
s32 gainedExp = gTasks[taskId].tExpTask_gainedExp;
u8 battlerId = gTasks[taskId].tExpTask_bank;
u8 battlerId = gTasks[taskId].tExpTask_battler;
struct Pokemon *mon = &gPlayerParty[monIndex];
u8 level = GetMonData(mon, MON_DATA_LEVEL);
u16 species = GetMonData(mon, MON_DATA_SPECIES);
@ -1221,12 +1221,12 @@ static void sub_8059400(u8 taskId)
{
u8 monId = gTasks[taskId].tExpTask_monId;
s16 gainedExp = gTasks[taskId].tExpTask_gainedExp;
u8 battlerId = gTasks[taskId].tExpTask_bank;
s16 r4;
u8 battlerId = gTasks[taskId].tExpTask_battler;
s16 newExpPoints;
r4 = sub_8074AA0(battlerId, gHealthboxSpriteIds[battlerId], EXP_BAR, 0);
newExpPoints = MoveBattleBar(battlerId, gHealthboxSpriteIds[battlerId], EXP_BAR, 0);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[battlerId]);
if (r4 == -1)
if (newExpPoints == -1) // The bar has been filled with given exp points.
{
u8 level;
s32 currExp;
@ -1241,16 +1241,16 @@ static void sub_8059400(u8 taskId)
if (currExp + gainedExp >= expOnNextLvl)
{
u8 savedActiveBank;
u8 savedActiveBattler;
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &expOnNextLvl);
CalculateMonStats(&gPlayerParty[monId]);
gainedExp -= expOnNextLvl - currExp;
savedActiveBank = gActiveBattler;
savedActiveBattler = gActiveBattler;
gActiveBattler = battlerId;
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
gActiveBattler = savedActiveBank;
gTasks[taskId].func = sub_8059544;
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELED_UP, gainedExp);
gActiveBattler = savedActiveBattler;
gTasks[taskId].func = Task_LaunchLvlUpAnim;
}
else
{
@ -1263,27 +1263,27 @@ static void sub_8059400(u8 taskId)
}
}
static void sub_8059544(u8 taskId)
static void Task_LaunchLvlUpAnim(u8 taskId)
{
u8 battlerId = gTasks[taskId].tExpTask_bank;
u8 battlerId = gTasks[taskId].tExpTask_battler;
u8 monIndex = gTasks[taskId].tExpTask_monId;
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
battlerId ^= BIT_FLANK;
InitAndLaunchSpecialAnimation(battlerId, battlerId, battlerId, B_ANIM_LVL_UP);
gTasks[taskId].func = sub_80595A4;
gTasks[taskId].func = Task_UpdateLvlInHealthbox;
}
static void sub_80595A4(u8 taskId)
static void Task_UpdateLvlInHealthbox(u8 taskId)
{
u8 battlerId = gTasks[taskId].tExpTask_bank;
u8 battlerId = gTasks[taskId].tExpTask_battler;
if (!gBattleSpritesDataPtr->healthBoxesData[battlerId].specialAnimActive)
{
u8 monIndex = gTasks[taskId].tExpTask_monId;
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value.
if (IsDoubleBattle() == TRUE && monIndex == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])
UpdateHealthboxAttribute(gHealthboxSpriteIds[battlerId ^ BIT_FLANK], &gPlayerParty[monIndex], HEALTHBOX_ALL);
@ -1300,8 +1300,8 @@ static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId)
u8 battlerId;
monIndex = gTasks[taskId].tExpTask_monId;
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value
battlerId = gTasks[taskId].tExpTask_bank;
GetMonData(&gPlayerParty[monIndex], MON_DATA_LEVEL); // Unused return value.
battlerId = gTasks[taskId].tExpTask_battler;
gBattlerControllerFuncs[battlerId] = CompleteOnInactiveTextPrinter;
DestroyTask(taskId);
}
@ -1337,21 +1337,21 @@ static void CompleteOnInactiveTextPrinter2(void)
PlayerBufferExecCompleted();
}
static void sub_80597CC(void)
static void OpenPartyMenuToChooseMon(void)
{
if (!gPaletteFade.active)
{
u8 r4;
u8 caseId;
gBattlerControllerFuncs[gActiveBattler] = sub_8059828;
r4 = gTasks[gUnknown_03005D7C[gActiveBattler]].data[0];
gBattlerControllerFuncs[gActiveBattler] = WaitForMonSelection;
caseId = gTasks[gUnknown_03005D7C[gActiveBattler]].data[0];
DestroyTask(gUnknown_03005D7C[gActiveBattler]);
FreeAllWindowBuffers();
sub_81B89AC(r4);
OpenPartyMenuInBattle(caseId);
}
}
static void sub_8059828(void)
static void WaitForMonSelection(void)
{
if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active)
{
@ -1458,7 +1458,7 @@ static void MoveSelectionDisplayMoveNames(void)
{
MoveSelectionDestroyCursorAt(i);
StringCopy(gDisplayedStringBattle, gMoveNames[moveInfo->moves[i]]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, i + 3);
BattlePutTextOnWindow(gDisplayedStringBattle, i + 3);
if (moveInfo->moves[i] != MOVE_NONE)
gNumberOfMovesToChoose++;
}
@ -1467,7 +1467,7 @@ static void MoveSelectionDisplayMoveNames(void)
static void MoveSelectionDisplayPpString(void)
{
StringCopy(gDisplayedStringBattle, gText_MoveInterfacePP);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 7);
BattlePutTextOnWindow(gDisplayedStringBattle, 7);
}
static void MoveSelectionDisplayPpNumber(void)
@ -1485,7 +1485,7 @@ static void MoveSelectionDisplayPpNumber(void)
txtPtr++;
ConvertIntToDecimalStringN(txtPtr, moveInfo->maxPp[gMoveSelectionCursor[gActiveBattler]], STR_CONV_MODE_RIGHT_ALIGN, 2);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 9);
BattlePutTextOnWindow(gDisplayedStringBattle, 9);
}
static void MoveSelectionDisplayMoveType(void)
@ -1502,7 +1502,7 @@ static void MoveSelectionDisplayMoveType(void)
txtPtr++;
StringCopy(txtPtr, gTypeNames[gBattleMoves[moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]].type]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 10);
BattlePutTextOnWindow(gDisplayedStringBattle, 10);
}
static void MoveSelectionCreateCursorAt(u8 cursorPosition, u8 arg1)
@ -1573,7 +1573,7 @@ static void PrintLinkStandbyMsg(void)
{
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
BattleHandleAddTextPrinter(gText_LinkStandby, 0);
BattlePutTextOnWindow(gText_LinkStandby, 0);
}
}
@ -2199,10 +2199,10 @@ static void sub_805B258(u8 battlerId, bool8 dontClearSubstituteBit)
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBattlerPosition(battlerId));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(
&gUnknown_0202499C,
&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));
@ -2259,9 +2259,9 @@ static void DoSwitchOutAnimation(void)
}
}
// some explanation here
// in emerald it's possible to have a tag battle in the battle frontier facilities with AI
// which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) that use the back pic as well as animate it
// In emerald it's possible to have a tag battle in the battle frontier facilities with AI
// which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven)
// that use an animated back pic.
static void PlayerHandleDrawTrainerPic(void)
{
s16 xPos, yPos;
@ -2272,16 +2272,16 @@ static void PlayerHandleDrawTrainerPic(void)
if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_FIRE_RED
|| (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_LEAF_GREEN)
{
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RED;
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_RED;
}
else if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_RUBY
|| (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_SAPPHIRE)
{
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RS_BRENDAN;
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN;
}
else
{
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender;
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_BRENDAN;
}
}
else
@ -2291,12 +2291,12 @@ static void PlayerHandleDrawTrainerPic(void)
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
if ((GetBattlerPosition(gActiveBattler) & BIT_FLANK) != 0) // second mon
if ((GetBattlerPosition(gActiveBattler) & BIT_FLANK) != B_FLANK_LEFT) // Second mon, on the right.
xPos = 90;
else // first mon
else // First mon, on the left.
xPos = 32;
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != STEVEN_PARTNER_ID)
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER)
{
xPos = 90;
yPos = (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 80;
@ -2314,12 +2314,12 @@ static void PlayerHandleDrawTrainerPic(void)
}
// Use front pic table for any tag battles unless your partner is Steven.
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != STEVEN_PARTNER_ID)
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER)
{
trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender);
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A1C0(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerFront(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag);
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
@ -2329,12 +2329,12 @@ static void PlayerHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineMode = 0;
gSprites[gBattlerSpriteIds[gActiveBattler]].hFlip = 1;
}
// use the back pic in any other scenario
// Use the back pic in any other scenario.
else
{
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
@ -2342,7 +2342,7 @@ static void PlayerHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
}
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void PlayerHandleTrainerSlide(void)
@ -2354,26 +2354,26 @@ static void PlayerHandleTrainerSlide(void)
if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_FIRE_RED
|| (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_LEAF_GREEN)
{
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RED;
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_RED;
}
else if ((gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_RUBY
|| (gLinkPlayers[GetMultiplayerId()].version & 0xFF) == VERSION_SAPPHIRE)
{
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + BACK_PIC_RS_BRENDAN;
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN;
}
else
{
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender;
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_BRENDAN;
}
}
else
{
trainerPicId = gSaveBlock2Ptr->playerGender;
trainerPicId = gSaveBlock2Ptr->playerGender + TRAINER_BACK_PIC_BRENDAN;
}
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, 80, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, 30);
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 80, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, 30);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -96;
@ -2466,7 +2466,7 @@ static void PlayerHandleMoveAnimation(void)
gWeatherMoveAnim = gBattleBufferA[gActiveBattler][12] | (gBattleBufferA[gActiveBattler][13] << 8);
gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBattler][16];
gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality;
if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE
if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // Always returns FALSE.
{
PlayerBufferExecCompleted();
}
@ -2536,7 +2536,7 @@ static void PlayerHandlePrintString(void)
gBattle_BG0_Y = 0;
stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]);
BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2;
BattleTv_SetDataBasedOnString(*stringId);
sub_81A57E4(gActiveBattler, *stringId);
@ -2566,14 +2566,14 @@ static void PlayerHandleChooseAction(void)
gBattlerControllerFuncs[gActiveBattler] = HandleChooseActionAfterDma3;
BattleTv_ClearExplosionFaintCause();
BattleHandleAddTextPrinter(gText_BattleMenu, 2);
BattlePutTextOnWindow(gText_BattleMenu, 2);
for (i = 0; i < 4; i++)
ActionSelectionDestroyCursorAt(i);
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 1);
BattlePutTextOnWindow(gDisplayedStringBattle, 1);
}
static void PlayerHandleUnknownYesNoBox(void)
@ -2581,7 +2581,7 @@ static void PlayerHandleUnknownYesNoBox(void)
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
{
HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0);
BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 12);
BattlePutTextOnWindow(gText_BattleYesNoChoice, 12);
gMultiUsePlayerCursor = 1;
BattleCreateYesNoCursorAt(1);
gBattlerControllerFuncs[gActiveBattler] = PlayerHandleUnknownYesNoInput;
@ -2655,7 +2655,7 @@ static void PlayerHandleChoosePokemon(void)
for (i = 0; i < 3; i++)
gUnknown_0203CF00[i] = gBattleBufferA[gActiveBattler][4 + i];
if (gBattleTypeFlags & BATTLE_TYPE_ARENA && (gBattleBufferA[gActiveBattler][1] & 0xF) != 2)
if (gBattleTypeFlags & BATTLE_TYPE_ARENA && (gBattleBufferA[gActiveBattler][1] & 0xF) != PARTY_CANT_SWITCH)
{
BtlController_EmitChosenMonReturnValue(1, gBattlerPartyIndexes[gActiveBattler] + 1, gUnknown_0203CF00);
PlayerBufferExecCompleted();
@ -2664,11 +2664,11 @@ static void PlayerHandleChoosePokemon(void)
{
gUnknown_03005D7C[gActiveBattler] = CreateTask(TaskDummy, 0xFF);
gTasks[gUnknown_03005D7C[gActiveBattler]].data[0] = gBattleBufferA[gActiveBattler][1] & 0xF;
*(&gBattleStruct->field_49) = gBattleBufferA[gActiveBattler][1] >> 4;
*(&gBattleStruct->battlerPreventingSwitchout) = gBattleBufferA[gActiveBattler][1] >> 4;
*(&gBattleStruct->field_8B) = gBattleBufferA[gActiveBattler][2];
*(&gBattleStruct->field_B0) = gBattleBufferA[gActiveBattler][3];
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
gBattlerControllerFuncs[gActiveBattler] = sub_80597CC;
*(&gBattleStruct->abilityPreventingSwitchout) = gBattleBufferA[gActiveBattler][3];
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, 0);
gBattlerControllerFuncs[gActiveBattler] = OpenPartyMenuToChooseMon;
gBattlerInMenuId = gActiveBattler;
}
}
@ -2722,19 +2722,19 @@ static void PlayerHandleExpUpdate(void)
u8 taskId;
LoadBattleBarGfx(1);
GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); // unused return value
expPointsToGive = gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8);
GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES); // Unused return value.
expPointsToGive = T1_READ_16(&gBattleBufferA[gActiveBattler][2]);
taskId = CreateTask(Task_GiveExpToMon, 10);
gTasks[taskId].tExpTask_monId = monId;
gTasks[taskId].tExpTask_gainedExp = expPointsToGive;
gTasks[taskId].tExpTask_bank = gActiveBattler;
gTasks[taskId].tExpTask_battler = gActiveBattler;
gBattlerControllerFuncs[gActiveBattler] = nullsub_21;
}
}
#undef tExpTask_monId
#undef tExpTask_gainedExp
#undef tExpTask_bank
#undef tExpTask_battler
#undef tExpTask_frames
static void PlayerHandleStatusIconUpdate(void)
@ -2945,8 +2945,8 @@ static void PlayerHandleIntroTrainerBallThrow(void)
taskId = CreateTask(task05_08033660, 5);
gTasks[taskId].data[0] = gActiveBattler;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
gBattleSpritesDataPtr->animationData->field_9_x1 = 1;
gBattlerControllerFuncs[gActiveBattler] = nullsub_21;
@ -2971,7 +2971,7 @@ static void task05_08033660(u8 taskId)
}
else
{
u8 savedActiveBank = gActiveBattler;
u8 savedActiveBattler = gActiveBattler;
gActiveBattler = gTasks[taskId].data[0];
if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI))
@ -2990,7 +2990,7 @@ static void task05_08033660(u8 taskId)
gActiveBattler ^= BIT_FLANK;
}
gBattlerControllerFuncs[gActiveBattler] = sub_8058B40;
gActiveBattler = savedActiveBank;
gActiveBattler = savedActiveBattler;
DestroyTask(taskId);
}
}
@ -3003,7 +3003,7 @@ static void PlayerHandleDrawPartyStatusSummary(void)
}
else
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1 = 1;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1;
gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4], gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2]);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0;
@ -3023,17 +3023,17 @@ static void sub_805CE38(void)
}
}
static void PlayerHandleCmd49(void)
static void PlayerHandleHidePartyStatusSummary(void)
{
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
PlayerBufferExecCompleted();
}
static void PlayerHandleCmd50(void)
static void PlayerHandleEndBounceEffect(void)
{
dp11b_obj_free(gActiveBattler, 1);
dp11b_obj_free(gActiveBattler, 0);
EndBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX);
EndBounceEffect(gActiveBattler, BOUNCE_MON);
PlayerBufferExecCompleted();
}
@ -3072,8 +3072,8 @@ static void PlayerHandleLinkStandbyMsg(void)
PrintLinkStandbyMsg();
// fall through
case 1:
dp11b_obj_free(gActiveBattler, 1);
dp11b_obj_free(gActiveBattler, 0);
EndBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX);
EndBounceEffect(gActiveBattler, BOUNCE_MON);
break;
case 2:
PrintLinkStandbyMsg();

View File

@ -11,6 +11,7 @@
#include "util.h"
#include "main.h"
#include "constants/songs.h"
#include "constants/trainers.h"
#include "sound.h"
#include "window.h"
#include "m4a.h"
@ -34,7 +35,7 @@ extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_81358F4(void);
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
extern void SetMultiuseSpriteTemplateToPokemon(u16, u8);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
// this file's functions
@ -87,8 +88,8 @@ static void PlayerPartnerHandleFaintingCry(void);
static void PlayerPartnerHandleIntroSlide(void);
static void PlayerPartnerHandleIntroTrainerBallThrow(void);
static void PlayerPartnerHandleDrawPartyStatusSummary(void);
static void PlayerPartnerHandleCmd49(void);
static void PlayerPartnerHandleCmd50(void);
static void PlayerPartnerHandleHidePartyStatusSummary(void);
static void PlayerPartnerHandleEndBounceEffect(void);
static void PlayerPartnerHandleSpriteInvisibility(void);
static void PlayerPartnerHandleBattleAnimation(void);
static void PlayerPartnerHandleLinkStandbyMsg(void);
@ -164,8 +165,8 @@ static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
PlayerPartnerHandleIntroSlide,
PlayerPartnerHandleIntroTrainerBallThrow,
PlayerPartnerHandleDrawPartyStatusSummary,
PlayerPartnerHandleCmd49,
PlayerPartnerHandleCmd50,
PlayerPartnerHandleHidePartyStatusSummary,
PlayerPartnerHandleEndBounceEffect,
PlayerPartnerHandleSpriteInvisibility,
PlayerPartnerHandleBattleAnimation,
PlayerPartnerHandleLinkStandbyMsg,
@ -203,7 +204,7 @@ static void PlayerPartnerBufferRunCommand(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
PlayerPartnerBufferExecCompleted();
@ -294,7 +295,7 @@ static void sub_81BB1D4(void)
static void CompleteOnHealthbarDone(void)
{
s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
@ -344,7 +345,7 @@ static void Task_GiveExpToMon(u8 taskId)
gainedExp -= nextLvlExp - currExp;
savedActiveBank = gActiveBattler;
gActiveBattler = battlerId;
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELED_UP, gainedExp);
gActiveBattler = savedActiveBank;
if (IsDoubleBattle() == TRUE
@ -399,7 +400,7 @@ static void sub_81BB4E4(u8 taskId)
u8 battlerId = gTasks[taskId].tExpTask_bank;
s16 r4;
r4 = sub_8074AA0(battlerId, gHealthboxSpriteIds[battlerId], EXP_BAR, 0);
r4 = MoveBattleBar(battlerId, gHealthboxSpriteIds[battlerId], EXP_BAR, 0);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[battlerId]);
if (r4 == -1)
{
@ -423,7 +424,7 @@ static void sub_81BB4E4(u8 taskId)
gainedExp -= expOnNextLvl - currExp;
savedActiveBank = gActiveBattler;
gActiveBattler = battlerId;
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELED_UP, gainedExp);
gActiveBattler = savedActiveBank;
gTasks[taskId].func = sub_81BB628;
}
@ -1210,9 +1211,9 @@ static void PlayerPartnerHandleLoadMonSprite(void)
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
sub_806A068(species, GetBattlerPosition(gActiveBattler));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(gActiveBattler, 2),
GetBattlerSpriteDefault_Y(gActiveBattler),
sub_80A82E4(gActiveBattler));
@ -1240,10 +1241,10 @@ static void sub_81BD0E4(u8 battlerId, bool8 dontClearSubstituteBit)
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBattlerPosition(battlerId));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(
&gUnknown_0202499C,
&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));
@ -1308,9 +1309,9 @@ static void PlayerPartnerHandleDrawTrainerPic(void)
s16 xPos, yPos;
u32 trainerPicId;
if (gPartnerTrainerId == STEVEN_PARTNER_ID)
if (gPartnerTrainerId == TRAINER_STEVEN_PARTNER)
{
trainerPicId = BACK_PIC_STEVEN;
trainerPicId = TRAINER_BACK_PIC_STEVEN;
xPos = 90;
yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80;
}
@ -1322,11 +1323,11 @@ static void PlayerPartnerHandleDrawTrainerPic(void)
}
// Use back pic only if the partner is Steven
if (gPartnerTrainerId == STEVEN_PARTNER_ID)
if (gPartnerTrainerId == TRAINER_STEVEN_PARTNER)
{
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
@ -1336,8 +1337,8 @@ static void PlayerPartnerHandleDrawTrainerPic(void)
else // otherwise use front sprite
{
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A1C0(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerFront(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag);
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
@ -1348,7 +1349,7 @@ static void PlayerPartnerHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].hFlip = 1;
}
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void PlayerPartnerHandleTrainerSlide(void)
@ -1492,7 +1493,7 @@ static void PlayerPartnerHandlePrintString(void)
gBattle_BG0_Y = 0;
stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]);
BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2;
}
@ -1793,9 +1794,9 @@ static void PlayerPartnerHandleIntroTrainerBallThrow(void)
StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1);
paletteNum = AllocSpritePalette(0xD6F9);
if (gPartnerTrainerId == STEVEN_PARTNER_ID)
if (gPartnerTrainerId == TRAINER_STEVEN_PARTNER)
{
u8 spriteId = BACK_PIC_STEVEN;
u8 spriteId = TRAINER_BACK_PIC_STEVEN;
LoadCompressedPalette(gTrainerBackPicPaletteTable[spriteId].data, 0x100 + paletteNum * 16, 32);
}
else
@ -1810,8 +1811,8 @@ static void PlayerPartnerHandleIntroTrainerBallThrow(void)
taskId = CreateTask(sub_81BE2C8, 5);
gTasks[taskId].data[0] = gActiveBattler;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
gBattleSpritesDataPtr->animationData->field_9_x1 = 1;
gBattlerControllerFuncs[gActiveBattler] = nullsub_77;
@ -1857,7 +1858,7 @@ static void PlayerPartnerHandleDrawPartyStatusSummary(void)
}
else
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1 = 1;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1;
gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4], gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2]);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0;
@ -1877,14 +1878,14 @@ static void sub_81BE498(void)
}
}
static void PlayerPartnerHandleCmd49(void)
static void PlayerPartnerHandleHidePartyStatusSummary(void)
{
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
PlayerPartnerBufferExecCompleted();
}
static void PlayerPartnerHandleCmd50(void)
static void PlayerPartnerHandleEndBounceEffect(void)
{
PlayerPartnerBufferExecCompleted();
}

View File

@ -13,6 +13,7 @@
#include "util.h"
#include "main.h"
#include "constants/songs.h"
#include "constants/trainers.h"
#include "sound.h"
#include "window.h"
#include "m4a.h"
@ -36,7 +37,6 @@ extern u8 gUnknown_0203C7B4;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
extern u16 sub_8068B48(void);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
@ -90,8 +90,8 @@ static void RecordedOpponentHandleFaintingCry(void);
static void RecordedOpponentHandleIntroSlide(void);
static void RecordedOpponentHandleIntroTrainerBallThrow(void);
static void RecordedOpponentHandleDrawPartyStatusSummary(void);
static void RecordedOpponentHandleCmd49(void);
static void RecordedOpponentHandleCmd50(void);
static void RecordedOpponentHandleHidePartyStatusSummary(void);
static void RecordedOpponentHandleEndBounceEffect(void);
static void RecordedOpponentHandleSpriteInvisibility(void);
static void RecordedOpponentHandleBattleAnimation(void);
static void RecordedOpponentHandleLinkStandbyMsg(void);
@ -162,8 +162,8 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void
RecordedOpponentHandleIntroSlide,
RecordedOpponentHandleIntroTrainerBallThrow,
RecordedOpponentHandleDrawPartyStatusSummary,
RecordedOpponentHandleCmd49,
RecordedOpponentHandleCmd50,
RecordedOpponentHandleHidePartyStatusSummary,
RecordedOpponentHandleEndBounceEffect,
RecordedOpponentHandleSpriteInvisibility,
RecordedOpponentHandleBattleAnimation,
RecordedOpponentHandleLinkStandbyMsg,
@ -192,7 +192,7 @@ static void RecordedOpponentBufferRunCommand(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
RecordedOpponentBufferExecCompleted();
@ -377,7 +377,7 @@ static void sub_8186C48(void)
static void CompleteOnHealthbarDone(void)
{
s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
@ -1118,9 +1118,9 @@ static void RecordedOpponentHandleLoadMonSprite(void)
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
sub_806A068(species, GetBattlerPosition(gActiveBattler));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(gActiveBattler, 2),
GetBattlerSpriteDefault_Y(gActiveBattler),
sub_80A82E4(gActiveBattler));
@ -1153,9 +1153,9 @@ static void sub_81885D8(u8 battlerId, bool8 dontClearSubstituteBit)
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
sub_806A068(species, GetBattlerPosition(battlerId));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));
@ -1251,8 +1251,8 @@ static void RecordedOpponentHandleDrawTrainerPic(void)
}
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
xPos,
(8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40,
sub_80A82E4(gActiveBattler));
@ -1263,7 +1263,7 @@ static void RecordedOpponentHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void RecordedOpponentHandleTrainerSlide(void)
@ -1296,7 +1296,7 @@ static void RecordedOpponentHandleFaintAnimation(void)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT);
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039934;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon;
gBattlerControllerFuncs[gActiveBattler] = sub_8186D58;
}
}
@ -1404,7 +1404,7 @@ static void RecordedOpponentHandlePrintString(void)
gBattle_BG0_Y = 0;
stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]);
BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
}
@ -1658,8 +1658,8 @@ static void RecordedOpponentHandleIntroTrainerBallThrow(void)
taskId = CreateTask(sub_8189548, 5);
gTasks[taskId].data[0] = gActiveBattler;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
gBattleSpritesDataPtr->animationData->field_9_x1 = 1;
gBattlerControllerFuncs[gActiveBattler] = nullsub_70;
@ -1704,7 +1704,7 @@ static void RecordedOpponentHandleDrawPartyStatusSummary(void)
}
else
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1 = 1;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1;
if (gBattleBufferA[gActiveBattler][2] != 0)
{
@ -1738,14 +1738,14 @@ static void sub_818975C(void)
}
}
static void RecordedOpponentHandleCmd49(void)
static void RecordedOpponentHandleHidePartyStatusSummary(void)
{
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
RecordedOpponentBufferExecCompleted();
}
static void RecordedOpponentHandleCmd50(void)
static void RecordedOpponentHandleEndBounceEffect(void)
{
RecordedOpponentBufferExecCompleted();
}

View File

@ -36,7 +36,6 @@ extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
// this file's functions
@ -89,8 +88,8 @@ static void RecordedPlayerHandleFaintingCry(void);
static void RecordedPlayerHandleIntroSlide(void);
static void RecordedPlayerHandleIntroTrainerBallThrow(void);
static void RecordedPlayerHandleDrawPartyStatusSummary(void);
static void RecordedPlayerHandleCmd49(void);
static void RecordedPlayerHandleCmd50(void);
static void RecordedPlayerHandleHidePartyStatusSummary(void);
static void RecordedPlayerHandleEndBounceEffect(void);
static void RecordedPlayerHandleSpriteInvisibility(void);
static void RecordedPlayerHandleBattleAnimation(void);
static void RecordedPlayerHandleLinkStandbyMsg(void);
@ -160,8 +159,8 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void)
RecordedPlayerHandleIntroSlide,
RecordedPlayerHandleIntroTrainerBallThrow,
RecordedPlayerHandleDrawPartyStatusSummary,
RecordedPlayerHandleCmd49,
RecordedPlayerHandleCmd50,
RecordedPlayerHandleHidePartyStatusSummary,
RecordedPlayerHandleEndBounceEffect,
RecordedPlayerHandleSpriteInvisibility,
RecordedPlayerHandleBattleAnimation,
RecordedPlayerHandleLinkStandbyMsg,
@ -190,7 +189,7 @@ static void RecordedPlayerBufferRunCommand(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
RecordedPlayerBufferExecCompleted();
@ -363,7 +362,7 @@ static void sub_818A064(void)
static void CompleteOnHealthbarDone(void)
{
s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
@ -1107,9 +1106,9 @@ static void RecordedPlayerHandleLoadMonSprite(void)
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
sub_806A068(species, GetBattlerPosition(gActiveBattler));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(gActiveBattler, 2),
GetBattlerSpriteDefault_Y(gActiveBattler),
sub_80A82E4(gActiveBattler));
@ -1137,10 +1136,10 @@ static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit)
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBattlerPosition(battlerId));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(
&gUnknown_0202499C,
&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));
@ -1242,8 +1241,8 @@ static void RecordedPlayerHandleDrawTrainerPic(void)
{
trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender);
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A1C0(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerFront(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag);
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
@ -1256,8 +1255,8 @@ static void RecordedPlayerHandleDrawTrainerPic(void)
else
{
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
@ -1265,7 +1264,7 @@ static void RecordedPlayerHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
}
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void RecordedPlayerHandleTrainerSlide(void)
@ -1409,7 +1408,7 @@ static void RecordedPlayerHandlePrintString(void)
gBattle_BG0_Y = 0;
stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]);
BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
}
@ -1693,8 +1692,8 @@ static void RecordedPlayerHandleIntroTrainerBallThrow(void)
taskId = CreateTask(sub_818CC24, 5);
gTasks[taskId].data[0] = gActiveBattler;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
gBattleSpritesDataPtr->animationData->field_9_x1 = 1;
gBattlerControllerFuncs[gActiveBattler] = nullsub_120;
@ -1740,7 +1739,7 @@ static void RecordedPlayerHandleDrawPartyStatusSummary(void)
}
else
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1 = 1;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1;
gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4], gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2]);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0;
@ -1760,14 +1759,14 @@ static void sub_818CDF4(void)
}
}
static void RecordedPlayerHandleCmd49(void)
static void RecordedPlayerHandleHidePartyStatusSummary(void)
{
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
RecordedPlayerBufferExecCompleted();
}
static void RecordedPlayerHandleCmd50(void)
static void RecordedPlayerHandleEndBounceEffect(void)
{
RecordedPlayerBufferExecCompleted();
}

View File

@ -80,8 +80,8 @@ static void SafariHandleFaintingCry(void);
static void SafariHandleIntroSlide(void);
static void SafariHandleIntroTrainerBallThrow(void);
static void SafariHandleDrawPartyStatusSummary(void);
static void SafariHandleCmd49(void);
static void SafariHandleCmd50(void);
static void SafariHandleHidePartyStatusSummary(void);
static void SafariHandleEndBounceEffect(void);
static void SafariHandleSpriteInvisibility(void);
static void SafariHandleBattleAnimation(void);
static void SafariHandleLinkStandbyMsg(void);
@ -144,8 +144,8 @@ static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
SafariHandleIntroSlide,
SafariHandleIntroTrainerBallThrow,
SafariHandleDrawPartyStatusSummary,
SafariHandleCmd49,
SafariHandleCmd50,
SafariHandleHidePartyStatusSummary,
SafariHandleEndBounceEffect,
SafariHandleSpriteInvisibility,
SafariHandleBattleAnimation,
SafariHandleLinkStandbyMsg,
@ -239,7 +239,7 @@ static void HandleInputChooseAction(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
SafariBufferExecCompleted();
@ -358,9 +358,9 @@ static void SafariHandleReturnMonToBall(void)
static void SafariHandleDrawTrainerPic(void)
{
DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, gActiveBattler);
sub_806A12C(gSaveBlock2Ptr->playerGender, GetBattlerPosition(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerBack(gSaveBlock2Ptr->playerGender, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(
&gUnknown_0202499C,
&gMultiuseSpriteTemplate,
80,
(8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80,
30);
@ -368,7 +368,7 @@ static void SafariHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void SafariHandleTrainerSlide(void)
@ -427,7 +427,7 @@ static void SafariHandlePrintString(void)
gBattle_BG0_Y = 0;
stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]);
BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
}
@ -454,14 +454,14 @@ static void SafariHandleChooseAction(void)
s32 i;
gBattlerControllerFuncs[gActiveBattler] = HandleChooseActionAfterDma3;
BattleHandleAddTextPrinter(gText_SafariZoneMenu, 2);
BattlePutTextOnWindow(gText_SafariZoneMenu, 2);
for (i = 0; i < 4; i++)
ActionSelectionDestroyCursorAt(i);
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo2);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 1);
BattlePutTextOnWindow(gDisplayedStringBattle, 1);
}
static void SafariHandleUnknownYesNoBox(void)
@ -645,12 +645,12 @@ static void SafariHandleDrawPartyStatusSummary(void)
SafariBufferExecCompleted();
}
static void SafariHandleCmd49(void)
static void SafariHandleHidePartyStatusSummary(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleCmd50(void)
static void SafariHandleEndBounceEffect(void)
{
SafariBufferExecCompleted();
}

View File

@ -15,6 +15,7 @@
#include "constants/songs.h"
#include "sound.h"
#include "constants/moves.h"
#include "constants/trainers.h"
#include "window.h"
#include "m4a.h"
#include "palette.h"
@ -38,7 +39,6 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
// this file's functions
static void WallyHandleGetMonData(void);
@ -90,8 +90,8 @@ static void WallyHandleFaintingCry(void);
static void WallyHandleIntroSlide(void);
static void WallyHandleIntroTrainerBallThrow(void);
static void WallyHandleDrawPartyStatusSummary(void);
static void WallyHandleCmd49(void);
static void WallyHandleCmd50(void);
static void WallyHandleHidePartyStatusSummary(void);
static void WallyHandleEndBounceEffect(void);
static void WallyHandleSpriteInvisibility(void);
static void WallyHandleBattleAnimation(void);
static void WallyHandleLinkStandbyMsg(void);
@ -159,8 +159,8 @@ static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
WallyHandleIntroSlide,
WallyHandleIntroTrainerBallThrow,
WallyHandleDrawPartyStatusSummary,
WallyHandleCmd49,
WallyHandleCmd50,
WallyHandleHidePartyStatusSummary,
WallyHandleEndBounceEffect,
WallyHandleSpriteInvisibility,
WallyHandleBattleAnimation,
WallyHandleLinkStandbyMsg,
@ -253,7 +253,7 @@ static void WallyHandleActions(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
WallyBufferExecCompleted();
@ -349,7 +349,7 @@ static void sub_8168818(void)
static void CompleteOnHealthbarDone(void)
{
s16 hpValue = sub_8074AA0(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
@ -1037,26 +1037,26 @@ static void WallyHandleReturnMonToBall(void)
static void WallyHandleDrawTrainerPic(void)
{
DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBattler);
sub_806A12C(BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
DecompressTrainerBackPic(TRAINER_BACK_PIC_WALLY, gActiveBattler);
SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
80,
80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords),
80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].coords),
30);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void WallyHandleTrainerSlide(void)
{
DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBattler);
sub_806A12C(BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
DecompressTrainerBackPic(TRAINER_BACK_PIC_WALLY, gActiveBattler);
SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
80,
80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords),
80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].coords),
30);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -96;
@ -1179,7 +1179,7 @@ static void WallyHandlePrintString(void)
gBattle_BG0_Y = 0;
stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]);
BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
}
@ -1206,14 +1206,14 @@ static void WallyHandleChooseAction(void)
s32 i;
gBattlerControllerFuncs[gActiveBattler] = HandleChooseActionAfterDma3;
BattleHandleAddTextPrinter(gText_BattleMenu, 2);
BattlePutTextOnWindow(gText_BattleMenu, 2);
for (i = 0; i < 4; i++)
ActionSelectionDestroyCursorAt(i);
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillWallyDo);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 1);
BattlePutTextOnWindow(gDisplayedStringBattle, 1);
}
static void WallyHandleUnknownYesNoBox(void)
@ -1444,14 +1444,14 @@ static void WallyHandleIntroTrainerBallThrow(void)
StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1);
paletteNum = AllocSpritePalette(0xD6F8);
LoadCompressedPalette(gTrainerBackPicPaletteTable[BACK_PIC_WALLY].data, 0x100 + paletteNum * 16, 32);
LoadCompressedPalette(gTrainerBackPicPaletteTable[TRAINER_BACK_PIC_WALLY].data, 0x100 + paletteNum * 16, 32);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum;
taskId = CreateTask(sub_816AC04, 5);
gTasks[taskId].data[0] = gActiveBattler;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
gBattleSpritesDataPtr->animationData->field_9_x1 = 1;
gBattlerControllerFuncs[gActiveBattler] = nullsub_21;
@ -1465,8 +1465,8 @@ static void sub_816AA80(u8 battlerId)
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(&gUnknown_0202499C,
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));
@ -1511,18 +1511,18 @@ static void WallyHandleDrawPartyStatusSummary(void)
}
else
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1 = 1;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1;
gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4], gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2]);
WallyBufferExecCompleted();
}
}
static void WallyHandleCmd49(void)
static void WallyHandleHidePartyStatusSummary(void)
{
WallyBufferExecCompleted();
}
static void WallyHandleCmd50(void)
static void WallyHandleEndBounceEffect(void)
{
WallyBufferExecCompleted();
}

View File

@ -587,7 +587,7 @@ static void SetBattlePartyIds(void)
{
for (i = 0; i < gBattlersCount; i++)
{
for (j = 0; j < 6; j++)
for (j = 0; j < PARTY_SIZE; j++)
{
if (i < 2)
{
@ -1082,14 +1082,14 @@ void BtlController_EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 m
void BtlController_EmitPrintString(u8 bufferId, u16 stringID)
{
s32 i;
struct StringInfoBattle* stringInfo;
struct BattleMsgData* stringInfo;
sBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRING;
sBattleBuffersTransferData[1] = gBattleOutcome;
sBattleBuffersTransferData[2] = stringID;
sBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8;
stringInfo = (struct StringInfoBattle*)(&sBattleBuffersTransferData[4]);
stringInfo = (struct BattleMsgData*)(&sBattleBuffersTransferData[4]);
stringInfo->currentMove = gCurrentMove;
stringInfo->originallyUsedMove = gChosenMove;
stringInfo->lastItem = gLastUsedItem;
@ -1097,7 +1097,7 @@ void BtlController_EmitPrintString(u8 bufferId, u16 stringID)
stringInfo->scrActive = gBattleScripting.battler;
stringInfo->unk1605E = gBattleStruct->field_52;
stringInfo->hpScale = gBattleStruct->hpScale;
stringInfo->StringBank = gPotentialItemEffectBattler;
stringInfo->itemEffectBattler = gPotentialItemEffectBattler;
stringInfo->moveType = gBattleMoves[gCurrentMove].type;
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
@ -1108,20 +1108,20 @@ void BtlController_EmitPrintString(u8 bufferId, u16 stringID)
stringInfo->textBuffs[1][i] = gBattleTextBuff2[i];
stringInfo->textBuffs[2][i] = gBattleTextBuff3[i];
}
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct StringInfoBattle) + 4);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct BattleMsgData) + 4);
}
void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringID)
{
s32 i;
struct StringInfoBattle *stringInfo;
struct BattleMsgData *stringInfo;
sBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRINGPLAYERONLY;
sBattleBuffersTransferData[1] = CONTROLLER_PRINTSTRINGPLAYERONLY;
sBattleBuffersTransferData[2] = stringID;
sBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8;
stringInfo = (struct StringInfoBattle*)(&sBattleBuffersTransferData[4]);
stringInfo = (struct BattleMsgData*)(&sBattleBuffersTransferData[4]);
stringInfo->currentMove = gCurrentMove;
stringInfo->originallyUsedMove = gChosenMove;
stringInfo->lastItem = gLastUsedItem;
@ -1137,7 +1137,7 @@ void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringID)
stringInfo->textBuffs[1][i] = gBattleTextBuff2[i];
stringInfo->textBuffs[2][i] = gBattleTextBuff3[i];
}
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct StringInfoBattle) + 4);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct BattleMsgData) + 4);
}
void BtlController_EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2)
@ -1181,7 +1181,7 @@ void BtlController_EmitChooseItem(u8 bufferId, u8 *arg1)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4)
void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8 *arg4)
{
s32 i;
@ -1191,7 +1191,7 @@ void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 ability
sBattleBuffersTransferData[3] = abilityId;
for (i = 0; i < 3; i++)
sBattleBuffersTransferData[4 + i] = arg4[i];
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 8); // but only 7 bytes were written
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 8); // Only 7 bytes were written.
}
void BtlController_EmitCmd23(u8 bufferId)
@ -1449,26 +1449,26 @@ void BtlController_EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* h
sBattleBuffersTransferData[1] = arg2 & 0x7F;
sBattleBuffersTransferData[2] = (arg2 & 0x80) >> 7;
sBattleBuffersTransferData[3] = CONTROLLER_DRAWPARTYSTATUSSUMMARY;
for (i = 0; i < (s32)(sizeof(struct HpAndStatus) * 6); i++)
for (i = 0; i < (s32)(sizeof(struct HpAndStatus) * PARTY_SIZE); i++)
sBattleBuffersTransferData[4 + i] = *(i + (u8*)(hpAndStatus));
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct HpAndStatus) * 6 + 4);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct HpAndStatus) * PARTY_SIZE + 4);
}
void BtlController_EmitCmd49(u8 bufferId)
void BtlController_EmitHidePartyStatusSummary(u8 bufferId)
{
sBattleBuffersTransferData[0] = CONTROLLER_49;
sBattleBuffersTransferData[1] = CONTROLLER_49;
sBattleBuffersTransferData[2] = CONTROLLER_49;
sBattleBuffersTransferData[3] = CONTROLLER_49;
sBattleBuffersTransferData[0] = CONTROLLER_HIDEPARTYSTATUSSUMMARY;
sBattleBuffersTransferData[1] = CONTROLLER_HIDEPARTYSTATUSSUMMARY;
sBattleBuffersTransferData[2] = CONTROLLER_HIDEPARTYSTATUSSUMMARY;
sBattleBuffersTransferData[3] = CONTROLLER_HIDEPARTYSTATUSSUMMARY;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitCmd50(u8 bufferId)
void BtlController_EmitEndBounceEffect(u8 bufferId)
{
sBattleBuffersTransferData[0] = CONTROLLER_50;
sBattleBuffersTransferData[1] = CONTROLLER_50;
sBattleBuffersTransferData[2] = CONTROLLER_50;
sBattleBuffersTransferData[3] = CONTROLLER_50;
sBattleBuffersTransferData[0] = CONTROLLER_ENDBOUNCE;
sBattleBuffersTransferData[1] = CONTROLLER_ENDBOUNCE;
sBattleBuffersTransferData[2] = CONTROLLER_ENDBOUNCE;
sBattleBuffersTransferData[3] = CONTROLLER_ENDBOUNCE;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
@ -1511,10 +1511,10 @@ void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2);
}
void BtlController_EmitCmd55(u8 bufferId, u8 arg1)
void BtlController_EmitCmd55(u8 bufferId, u8 battleOutcome)
{
sBattleBuffersTransferData[0] = CONTROLLER_55;
sBattleBuffersTransferData[1] = arg1;
sBattleBuffersTransferData[1] = battleOutcome;
sBattleBuffersTransferData[2] = gSaveBlock2Ptr->frontier.field_CA9_b;
sBattleBuffersTransferData[3] = gSaveBlock2Ptr->frontier.field_CA9_b;
sBattleBuffersTransferData[5] = sBattleBuffersTransferData[4] = sub_81850DC(&sBattleBuffersTransferData[6]);

View File

@ -16,14 +16,15 @@ extern const struct CompressedSpriteSheet gTrainerBackPicTable[];
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const union AffineAnimCmd *const gUnknown_082FF618[];
extern const union AffineAnimCmd *const gUnknown_082FF694[];
extern const union AnimCmd *const gUnknown_082FF70C[];
extern const union AnimCmd *const gPlayerMonSpriteAnimsTable[];
extern const union AnimCmd *const *const gMonAnimationsSpriteAnimsPtrTable[NUM_SPECIES];
extern const union AnimCmd *const *const gUnknown_0830536C[];
extern const u8 gFacilityClassToPicIndex[];
// Static type declarations
struct BattleDomeCard {
struct BattleDomeCard
{
u8 *frames;
struct SpriteFrameImage *images;
u16 paletteTag;
@ -41,10 +42,12 @@ static EWRAM_DATA struct BattleDomeCard gUnknown_0203CD04[8] = {};
// .rodata
static const struct BattleDomeCard gUnknown_0860B058 = {};
static const struct OamData gUnknown_0860B064 = {
static const struct OamData gUnknown_0860B064 =
{
.size = 3
};
static const struct OamData gUnknown_0860B06C = {
static const struct OamData gUnknown_0860B06C =
{
.affineMode = 1, .size = 3
};
@ -158,7 +161,7 @@ static void uns_builder_assign_animtable1(bool8 isTrainer)
{
if (!isTrainer)
{
gUnknown_0203CCEC.anims = gUnknown_082FF70C;
gUnknown_0203CCEC.anims = gPlayerMonSpriteAnimsTable;
}
else
{

View File

@ -67,48 +67,48 @@ static void sub_805D7EC(struct Sprite *sprite);
static bool8 ShouldAnimBeDoneRegardlessOfSubsitute(u8 animId);
static void Task_ClearBitWhenBattleTableAnimDone(u8 taskId);
static void Task_ClearBitWhenSpecialAnimDone(u8 taskId);
static void ClearSpritesBankHealthboxAnimData(void);
static void ClearSpritesBattlerHealthboxAnimData(void);
// const rom data
static const struct CompressedSpriteSheet gUnknown_0832C0D0 =
static const struct CompressedSpriteSheet sSpriteSheet_SinglesPlayerHealthbox =
{
gUnknown_08C1F1C8, 0x1000, TAG_HEALTHBOX_PLAYER1_TILE
};
static const struct CompressedSpriteSheet gUnknown_0832C0D8 =
static const struct CompressedSpriteSheet sSpriteSheet_SinglesOpponentHealthbox =
{
gUnknown_08C1F46C, 0x1000, TAG_HEALTHBOX_OPPONENT1_TILE
};
static const struct CompressedSpriteSheet gUnknown_0832C0E0[2] =
static const struct CompressedSpriteSheet sSpriteSheets_DoublesPlayerHealthbox[2] =
{
{gUnknown_08C1F5E8, 0x800, TAG_HEALTHBOX_PLAYER1_TILE},
{gUnknown_08C1F5E8, 0x800, TAG_HEALTHBOX_PLAYER2_TILE}
};
static const struct CompressedSpriteSheet gUnknown_0832C0F0[2] =
static const struct CompressedSpriteSheet sSpriteSheets_DoublesOpponentHealthbox[2] =
{
{gUnknown_08C1F76C, 0x800, TAG_HEALTHBOX_OPPONENT1_TILE},
{gUnknown_08C1F76C, 0x800, TAG_HEALTHBOX_OPPONENT2_TILE}
};
static const struct CompressedSpriteSheet gUnknown_0832C100 =
static const struct CompressedSpriteSheet sSpriteSheet_SafariHealthbox =
{
gUnknown_08C1F8E8, 0x1000, TAG_HEALTHBOX_SAFARI_TILE
};
static const struct CompressedSpriteSheet gUnknown_0832C108[MAX_BATTLERS_COUNT] =
static const struct CompressedSpriteSheet sSpriteSheets_HealthBar[MAX_BATTLERS_COUNT] =
{
{gBlankGfxCompressed, 0x0100, 0xd704},
{gBlankGfxCompressed, 0x0120, 0xd705},
{gBlankGfxCompressed, 0x0100, 0xd706},
{gBlankGfxCompressed, 0x0120, 0xd707}
{gBlankGfxCompressed, 0x0100, TAG_HEALTHBAR_PLAYER1_TILE},
{gBlankGfxCompressed, 0x0120, TAG_HEALTHBAR_OPPONENT1_TILE},
{gBlankGfxCompressed, 0x0100, TAG_HEALTHBAR_PLAYER2_TILE},
{gBlankGfxCompressed, 0x0120, TAG_HEALTHBAR_OPPONENT2_TILE}
};
static const struct SpritePalette gUnknown_0832C128[2] =
static const struct SpritePalette sSpritePalettes_HealthBoxHealthBar[2] =
{
{gBattleInterface_BallStatusBarPal, TAG_HEALTHBOX_PAL},
{gBattleInterface_BallDisplayPal, 0xd704}
{gBattleInterface_BallDisplayPal, TAG_HEALTHBAR_PAL}
};
// code
@ -411,35 +411,35 @@ void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status)
#define tBattlerId data[0]
bool8 TryHandleLaunchBattleTableAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId, u16 argument)
bool8 TryHandleLaunchBattleTableAnimation(u8 activeBattler, u8 atkBattler, u8 defBattler, u8 tableId, u16 argument)
{
u8 taskId;
if (tableId == B_ANIM_CASTFORM_CHANGE && (argument & 0x80))
{
gBattleMonForms[activeBank] = (argument & ~(0x80));
gBattleMonForms[activeBattler] = (argument & ~(0x80));
return TRUE;
}
if (gBattleSpritesDataPtr->battlerData[activeBank].behindSubstitute
if (gBattleSpritesDataPtr->battlerData[activeBattler].behindSubstitute
&& !ShouldAnimBeDoneRegardlessOfSubsitute(tableId))
{
return TRUE;
}
if (gBattleSpritesDataPtr->battlerData[activeBank].behindSubstitute
if (gBattleSpritesDataPtr->battlerData[activeBattler].behindSubstitute
&& tableId == B_ANIM_SUBSTITUTE_FADE
&& gSprites[gBattlerSpriteIds[activeBank]].invisible)
&& gSprites[gBattlerSpriteIds[activeBattler]].invisible)
{
LoadBattleMonGfxAndAnimate(activeBank, TRUE, gBattlerSpriteIds[activeBank]);
ClearBehindSubstituteBit(activeBank);
LoadBattleMonGfxAndAnimate(activeBattler, TRUE, gBattlerSpriteIds[activeBattler]);
ClearBehindSubstituteBit(activeBattler);
return TRUE;
}
gBattleAnimAttacker = atkBank;
gBattleAnimTarget = defBank;
gBattleAnimAttacker = atkBattler;
gBattleAnimTarget = defBattler;
gBattleSpritesDataPtr->animationData->animArg = argument;
LaunchBattleAnimation(gBattleAnims_VariousTable, tableId, FALSE);
taskId = CreateTask(Task_ClearBitWhenBattleTableAnimDone, 10);
gTasks[taskId].tBattlerId = activeBank;
gTasks[taskId].tBattlerId = activeBattler;
gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].tBattlerId].animFromTableActive = 1;
return FALSE;
@ -475,15 +475,15 @@ static bool8 ShouldAnimBeDoneRegardlessOfSubsitute(u8 animId)
#define tBattlerId data[0]
void InitAndLaunchSpecialAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId)
void InitAndLaunchSpecialAnimation(u8 activeBattler, u8 atkBattler, u8 defBattler, u8 tableId)
{
u8 taskId;
gBattleAnimAttacker = atkBank;
gBattleAnimTarget = defBank;
gBattleAnimAttacker = atkBattler;
gBattleAnimTarget = defBattler;
LaunchBattleAnimation(gBattleAnims_Special, tableId, FALSE);
taskId = CreateTask(Task_ClearBitWhenSpecialAnimDone, 10);
gTasks[taskId].tBattlerId = activeBank;
gTasks[taskId].tBattlerId = activeBattler;
gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].tBattlerId].specialAnimActive = 1;
}
@ -499,7 +499,7 @@ static void Task_ClearBitWhenSpecialAnimDone(u8 taskId)
#undef tBattlerId
// great function to include newly added moves that don't have animation yet
// Great function to include newly added moves that don't have animation yet.
bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn)
{
return FALSE;
@ -679,29 +679,30 @@ void FreeTrainerFrontPicPalette(u16 frontPicId)
FreeSpritePaletteByTag(gTrainerFrontPicPaletteTable[frontPicId].tag);
}
void sub_805DFFC(void)
// Unused.
void BattleLoadAllHealthBoxesGfxAtOnce(void)
{
u8 numberOfBanks = 0;
u8 numberOfBattlers = 0;
u8 i;
LoadSpritePalette(&gUnknown_0832C128[0]);
LoadSpritePalette(&gUnknown_0832C128[1]);
LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[0]);
LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[1]);
if (!IsDoubleBattle())
{
LoadCompressedObjectPic(&gUnknown_0832C0D0);
LoadCompressedObjectPic(&gUnknown_0832C0D8);
numberOfBanks = 2;
LoadCompressedObjectPic(&sSpriteSheet_SinglesPlayerHealthbox);
LoadCompressedObjectPic(&sSpriteSheet_SinglesOpponentHealthbox);
numberOfBattlers = 2;
}
else
{
LoadCompressedObjectPic(&gUnknown_0832C0E0[0]);
LoadCompressedObjectPic(&gUnknown_0832C0E0[1]);
LoadCompressedObjectPic(&gUnknown_0832C0F0[0]);
LoadCompressedObjectPic(&gUnknown_0832C0F0[1]);
numberOfBanks = 4;
LoadCompressedObjectPic(&sSpriteSheets_DoublesPlayerHealthbox[0]);
LoadCompressedObjectPic(&sSpriteSheets_DoublesPlayerHealthbox[1]);
LoadCompressedObjectPic(&sSpriteSheets_DoublesOpponentHealthbox[0]);
LoadCompressedObjectPic(&sSpriteSheets_DoublesOpponentHealthbox[1]);
numberOfBattlers = 4;
}
for (i = 0; i < numberOfBanks; i++)
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[i]]);
for (i = 0; i < numberOfBattlers; i++)
LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[i]]);
}
bool8 BattleLoadAllHealthBoxesGfx(u8 state)
@ -712,45 +713,45 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state)
{
if (state == 1)
{
LoadSpritePalette(&gUnknown_0832C128[0]);
LoadSpritePalette(&gUnknown_0832C128[1]);
LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[0]);
LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[1]);
}
else if (!IsDoubleBattle())
{
if (state == 2)
{
if (gBattleTypeFlags & BATTLE_TYPE_SAFARI)
LoadCompressedObjectPic(&gUnknown_0832C100);
LoadCompressedObjectPic(&sSpriteSheet_SafariHealthbox);
else
LoadCompressedObjectPic(&gUnknown_0832C0D0);
LoadCompressedObjectPic(&sSpriteSheet_SinglesPlayerHealthbox);
}
else if (state == 3)
LoadCompressedObjectPic(&gUnknown_0832C0D8);
LoadCompressedObjectPic(&sSpriteSheet_SinglesOpponentHealthbox);
else if (state == 4)
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[0]]);
LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[0]]);
else if (state == 5)
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[1]]);
LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[1]]);
else
retVal = TRUE;
}
else
{
if (state == 2)
LoadCompressedObjectPic(&gUnknown_0832C0E0[0]);
LoadCompressedObjectPic(&sSpriteSheets_DoublesPlayerHealthbox[0]);
else if (state == 3)
LoadCompressedObjectPic(&gUnknown_0832C0E0[1]);
LoadCompressedObjectPic(&sSpriteSheets_DoublesPlayerHealthbox[1]);
else if (state == 4)
LoadCompressedObjectPic(&gUnknown_0832C0F0[0]);
LoadCompressedObjectPic(&sSpriteSheets_DoublesOpponentHealthbox[0]);
else if (state == 5)
LoadCompressedObjectPic(&gUnknown_0832C0F0[1]);
LoadCompressedObjectPic(&sSpriteSheets_DoublesOpponentHealthbox[1]);
else if (state == 6)
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[0]]);
LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[0]]);
else if (state == 7)
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[1]]);
LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[1]]);
else if (state == 8)
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[2]]);
LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[2]]);
else if (state == 9)
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[3]]);
LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[3]]);
else
retVal = TRUE;
}
@ -771,7 +772,7 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *battlerId)
switch (*state1)
{
case 0:
ClearSpritesBankHealthboxAnimData();
ClearSpritesBattlerHealthboxAnimData();
(*state1)++;
break;
case 1:
@ -849,7 +850,7 @@ void ClearSpritesHealthboxAnimData(void)
memset(gBattleSpritesDataPtr->animationData, 0, sizeof(struct BattleAnimationInfo));
}
static void ClearSpritesBankHealthboxAnimData(void)
static void ClearSpritesBattlerHealthboxAnimData(void)
{
ClearSpritesHealthboxAnimData();
memset(gBattleSpritesDataPtr->battlerData, 0, sizeof(struct BattleSpriteInfo) * MAX_BATTLERS_COUNT);
@ -868,7 +869,7 @@ void CopyBattleSpriteInvisibility(u8 battlerId)
gBattleSpritesDataPtr->battlerData[battlerId].invisible = gSprites[gBattlerSpriteIds[battlerId]].invisible;
}
void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform)
void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform)
{
u16 paletteOffset;
u32 personalityValue;
@ -878,16 +879,16 @@ void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform)
if (notTransform)
{
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bankAtk]], gBattleSpritesDataPtr->animationData->animArg);
paletteOffset = 0x100 + bankAtk * 16;
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerAtk]], gBattleSpritesDataPtr->animationData->animArg);
paletteOffset = 0x100 + battlerAtk * 16;
LoadPalette(gBattleStruct->castformPalette[gBattleSpritesDataPtr->animationData->animArg], paletteOffset, 32);
gBattleMonForms[bankAtk] = gBattleSpritesDataPtr->animationData->animArg;
if (gBattleSpritesDataPtr->battlerData[bankAtk].transformSpecies != SPECIES_NONE)
gBattleMonForms[battlerAtk] = gBattleSpritesDataPtr->animationData->animArg;
if (gBattleSpritesDataPtr->battlerData[battlerAtk].transformSpecies != SPECIES_NONE)
{
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32);
}
gSprites[gBattlerSpriteIds[bankAtk]].pos1.y = GetBattlerSpriteDefault_Y(bankAtk);
gSprites[gBattlerSpriteIds[battlerAtk]].pos1.y = GetBattlerSpriteDefault_Y(battlerAtk);
}
else
{
@ -909,48 +910,48 @@ void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform)
}
else
{
position = GetBattlerPosition(bankAtk);
position = GetBattlerPosition(battlerAtk);
if (GetBattlerSide(bankDef) == B_SIDE_OPPONENT)
targetSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bankDef]], MON_DATA_SPECIES);
if (GetBattlerSide(battlerDef) == B_SIDE_OPPONENT)
targetSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerDef]], MON_DATA_SPECIES);
else
targetSpecies = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bankDef]], MON_DATA_SPECIES);
targetSpecies = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerDef]], MON_DATA_SPECIES);
if (GetBattlerSide(bankAtk) == B_SIDE_PLAYER)
if (GetBattlerSide(battlerAtk) == B_SIDE_PLAYER)
{
personalityValue = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bankAtk]], MON_DATA_PERSONALITY);
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[bankAtk]], MON_DATA_OT_ID);
personalityValue = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[targetSpecies],
gMonSpritesGfxPtr->sprites[position],
targetSpecies,
gTransformedPersonalities[bankAtk]);
gTransformedPersonalities[battlerAtk]);
}
else
{
personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bankAtk]], MON_DATA_PERSONALITY);
otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[bankAtk]], MON_DATA_OT_ID);
personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[targetSpecies],
gMonSpritesGfxPtr->sprites[position],
targetSpecies,
gTransformedPersonalities[bankAtk]);
gTransformedPersonalities[battlerAtk]);
}
}
src = gMonSpritesGfxPtr->sprites[position];
dst = (void *)(VRAM + 0x10000 + gSprites[gBattlerSpriteIds[bankAtk]].oam.tileNum * 32);
dst = (void *)(VRAM + 0x10000 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32);
DmaCopy32(3, src, dst, 0x800);
paletteOffset = 0x100 + bankAtk * 16;
paletteOffset = 0x100 + battlerAtk * 16;
lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue);
LZDecompressWram(lzPaletteData, gDecompressionBuffer);
LoadPalette(gDecompressionBuffer, paletteOffset, 32);
if (targetSpecies == SPECIES_CASTFORM)
{
gSprites[gBattlerSpriteIds[bankAtk]].anims = gMonAnimationsSpriteAnimsPtrTable[targetSpecies];
gSprites[gBattlerSpriteIds[battlerAtk]].anims = gMonAnimationsSpriteAnimsPtrTable[targetSpecies];
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[0]);
LoadPalette(gBattleStruct->castformPalette[0] + gBattleMonForms[bankDef] * 16, paletteOffset, 32);
LoadPalette(gBattleStruct->castformPalette[0] + gBattleMonForms[battlerDef] * 16, paletteOffset, 32);
}
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
@ -958,12 +959,12 @@ void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform)
if (!IsContest())
{
gBattleSpritesDataPtr->battlerData[bankAtk].transformSpecies = targetSpecies;
gBattleMonForms[bankAtk] = gBattleMonForms[bankDef];
gBattleSpritesDataPtr->battlerData[battlerAtk].transformSpecies = targetSpecies;
gBattleMonForms[battlerAtk] = gBattleMonForms[battlerDef];
}
gSprites[gBattlerSpriteIds[bankAtk]].pos1.y = GetBattlerSpriteDefault_Y(bankAtk);
StartSpriteAnim(&gSprites[gBattlerSpriteIds[bankAtk]], gBattleMonForms[bankAtk]);
gSprites[gBattlerSpriteIds[battlerAtk]].pos1.y = GetBattlerSpriteDefault_Y(battlerAtk);
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerAtk]], gBattleMonForms[battlerAtk]);
}
}
@ -1068,11 +1069,11 @@ void HandleLowHpMusicChange(struct Pokemon *mon, u8 battlerId)
void BattleStopLowHpSound(void)
{
u8 playerBank = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
u8 playerBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
gBattleSpritesDataPtr->battlerData[playerBank].lowHpSong = 0;
gBattleSpritesDataPtr->battlerData[playerBattler].lowHpSong = 0;
if (IsDoubleBattle())
gBattleSpritesDataPtr->battlerData[playerBank ^ BIT_FLANK].lowHpSong = 0;
gBattleSpritesDataPtr->battlerData[playerBattler ^ BIT_FLANK].lowHpSong = 0;
m4aSongNumStop(SE_HINSI);
}
@ -1085,19 +1086,19 @@ u8 GetMonHPBarLevel(struct Pokemon *mon)
return GetHPBarLevel(hp, maxHP);
}
void sub_805EAE8(void)
void HandleBattleLowHpMusicChange(void)
{
if (gMain.inBattle)
{
u8 playerBank1 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
u8 playerBank2 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
u8 bank1PartyId = pokemon_order_func(gBattlerPartyIndexes[playerBank1]);
u8 bank2PartyId = pokemon_order_func(gBattlerPartyIndexes[playerBank2]);
u8 playerBattler1 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
u8 playerBattler2 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
u8 battler1PartyId = pokemon_order_func(gBattlerPartyIndexes[playerBattler1]);
u8 battler2PartyId = pokemon_order_func(gBattlerPartyIndexes[playerBattler2]);
if (GetMonData(&gPlayerParty[bank1PartyId], MON_DATA_HP) != 0)
HandleLowHpMusicChange(&gPlayerParty[bank1PartyId], playerBank1);
if (IsDoubleBattle() && GetMonData(&gPlayerParty[bank2PartyId], MON_DATA_HP) != 0)
HandleLowHpMusicChange(&gPlayerParty[bank2PartyId], playerBank2);
if (GetMonData(&gPlayerParty[battler1PartyId], MON_DATA_HP) != 0)
HandleLowHpMusicChange(&gPlayerParty[battler1PartyId], playerBattler1);
if (IsDoubleBattle() && GetMonData(&gPlayerParty[battler2PartyId], MON_DATA_HP) != 0)
HandleLowHpMusicChange(&gPlayerParty[battler2PartyId], playerBattler2);
}
}
@ -1147,14 +1148,14 @@ void SpriteCB_EnemyShadow(struct Sprite *shadowSprite)
{
bool8 invisible = FALSE;
u8 battlerId = shadowSprite->tBattlerId;
struct Sprite *bankSprite = &gSprites[gBattlerSpriteIds[battlerId]];
struct Sprite *battlerSprite = &gSprites[gBattlerSpriteIds[battlerId]];
if (!bankSprite->inUse || !IsBattlerSpritePresent(battlerId))
if (!battlerSprite->inUse || !IsBattlerSpritePresent(battlerId))
{
shadowSprite->callback = SpriteCB_SetInvisible;
return;
}
if (gAnimScriptActive || bankSprite->invisible)
if (gAnimScriptActive || battlerSprite->invisible)
invisible = TRUE;
else if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE
&& gEnemyMonElevation[gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies] == 0)
@ -1163,8 +1164,8 @@ void SpriteCB_EnemyShadow(struct Sprite *shadowSprite)
if (gBattleSpritesDataPtr->battlerData[battlerId].behindSubstitute)
invisible = TRUE;
shadowSprite->pos1.x = bankSprite->pos1.x;
shadowSprite->pos2.x = bankSprite->pos2.x;
shadowSprite->pos1.x = battlerSprite->pos1.x;
shadowSprite->pos2.x = battlerSprite->pos2.x;
shadowSprite->invisible = invisible;
}
@ -1177,7 +1178,7 @@ void SpriteCB_SetInvisible(struct Sprite *sprite)
void SetBattlerShadowSpriteCallback(u8 battlerId, u16 species)
{
// The player's shadow is never seen
// The player's shadow is never seen.
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
return;
@ -1270,7 +1271,7 @@ void FreeMonSpritesGfx(void)
FREE_AND_SET_NULL(gMonSpritesGfxPtr);
}
bool32 ShouldPlayNormalPokeCry(struct Pokemon *mon)
bool32 ShouldPlayNormalMonCry(struct Pokemon *mon)
{
s16 hp, maxHP;
s32 barLevel;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,7 @@
#include "constants/songs.h"
#include "constants/trainers.h"
#include "constants/battle_anim.h"
#include "constants/map_types.h"
#include "text.h"
#include "sound.h"
#include "pokedex.h"
@ -40,6 +41,7 @@
#include "constants/battle_string_ids.h"
#include "battle_setup.h"
#include "overworld.h"
#include "party_menu.h"
extern u16 gBattle_BG1_X;
extern u16 gBattle_BG1_Y;
@ -67,7 +69,6 @@ extern bool8 sub_81B1250(void); // ?
extern bool8 InBattlePike(void);
extern bool8 InBattlePyramid(void);
extern u16 GetBattlePyramidPickupItemId(void);
extern u8 Overworld_GetMapTypeOfSaveblockLocation(void);
extern u8 sub_813B21C(void);
extern u16 get_unknown_box_id(void);
@ -185,10 +186,10 @@ static void atk5B_yesnoboxstoplearningmove(void);
static void atk5C_hitanimation(void);
static void atk5D_getmoneyreward(void);
static void atk5E(void);
static void atk5F(void);
static void atk5F_swapattackerwithtarget(void);
static void atk60_incrementgamestat(void);
static void atk61_drawpartystatussummary(void);
static void atk62(void);
static void atk62_hidepartystatussummary(void);
static void atk63_jumptorandomattack(void);
static void atk64_statusanimation(void);
static void atk65_status2animation(void);
@ -327,7 +328,7 @@ static void atkE9_setweatherballtype(void);
static void atkEA_tryrecycleitem(void);
static void atkEB_settypetoterrain(void);
static void atkEC_pursuitrelated(void);
static void atkEF_snatchsetbanks(void);
static void atkEF_snatchsetbattlers(void);
static void atkEE_removelightscreenreflect(void);
static void atkEF_handleballthrow(void);
static void atkF0_givecaughtmon(void);
@ -437,10 +438,10 @@ void (* const gBattleScriptingCommandsTable[])(void) =
atk5C_hitanimation,
atk5D_getmoneyreward,
atk5E,
atk5F,
atk5F_swapattackerwithtarget,
atk60_incrementgamestat,
atk61_drawpartystatussummary,
atk62,
atk62_hidepartystatussummary,
atk63_jumptorandomattack,
atk64_statusanimation,
atk65_status2animation,
@ -579,7 +580,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
atkEA_tryrecycleitem,
atkEB_settypetoterrain,
atkEC_pursuitrelated,
atkEF_snatchsetbanks,
atkEF_snatchsetbattlers,
atkEE_removelightscreenreflect,
atkEF_handleballthrow,
atkF0_givecaughtmon,
@ -989,11 +990,11 @@ static void atk00_attackcanceler(void)
for (i = 0; i < gBattlersCount; i++)
{
if ((gProtectStructs[gBattleTurnOrder[i]].stealMove) && gBattleMoves[gCurrentMove].flags & FLAG_SNATCH_AFFECTED)
if ((gProtectStructs[gBattlerByTurnOrder[i]].stealMove) && gBattleMoves[gCurrentMove].flags & FLAG_SNATCH_AFFECTED)
{
PressurePPLose(gBattlerAttacker, gBattleTurnOrder[i], MOVE_SNATCH);
gProtectStructs[gBattleTurnOrder[i]].stealMove = 0;
gBattleScripting.battler = gBattleTurnOrder[i];
PressurePPLose(gBattlerAttacker, gBattlerByTurnOrder[i], MOVE_SNATCH);
gProtectStructs[gBattlerByTurnOrder[i]].stealMove = 0;
gBattleScripting.battler = gBattlerByTurnOrder[i];
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SnatchedMove;
return;
@ -1172,7 +1173,7 @@ static void atk01_accuracycheck(void)
calc = (calc * 130) / 100; // 1.3 compound eyes boost
if (WEATHER_HAS_EFFECT && gBattleMons[gBattlerTarget].ability == ABILITY_SAND_VEIL && gBattleWeather & WEATHER_SANDSTORM_ANY)
calc = (calc * 80) / 100; // 1.2 sand veil loss
if (gBattleMons[gBattlerAttacker].ability == ABILITY_HUSTLE && type < 9)
if (gBattleMons[gBattlerAttacker].ability == ABILITY_HUSTLE && IS_TYPE_PHYSICAL(type))
calc = (calc * 80) / 100; // 1.2 hustle loss
if (gBattleMons[gBattlerTarget].item == ITEM_ENIGMA_BERRY)
@ -1944,7 +1945,7 @@ static void atk0C_datahpupdate(void)
if (!gSpecialStatuses[gActiveBattler].dmg && !(gHitMarker & HITMARKER_x100000))
gSpecialStatuses[gActiveBattler].dmg = gHpDealt;
if (IS_MOVE_PHYSICAL(moveType) && !(gHitMarker & HITMARKER_x100000) && gCurrentMove != MOVE_PAIN_SPLIT)
if (IS_TYPE_PHYSICAL(moveType) && !(gHitMarker & HITMARKER_x100000) && gCurrentMove != MOVE_PAIN_SPLIT)
{
gProtectStructs[gActiveBattler].physicalDmg = gHpDealt;
gSpecialStatuses[gActiveBattler].physicalDmg = gHpDealt;
@ -1959,7 +1960,7 @@ static void atk0C_datahpupdate(void)
gSpecialStatuses[gActiveBattler].physicalBattlerId = gBattlerTarget;
}
}
else if (!IS_MOVE_PHYSICAL(moveType) && !(gHitMarker & HITMARKER_x100000))
else if (!IS_TYPE_PHYSICAL(moveType) && !(gHitMarker & HITMARKER_x100000))
{
gProtectStructs[gActiveBattler].specialDmg = gHpDealt;
gSpecialStatuses[gActiveBattler].specialDmg = gHpDealt;
@ -2216,7 +2217,7 @@ u8 GetBattlerTurnOrderNum(u8 battlerId)
s32 i;
for (i = 0; i < gBattlersCount; i++)
{
if (gBattleTurnOrder[i] == battlerId)
if (gBattlerByTurnOrder[i] == battlerId)
break;
}
return i;
@ -3112,7 +3113,7 @@ static void atk1E_jumpifability(void)
if (gBattlescriptCurrInstr[1] == BS_ATTACKER_SIDE)
{
battlerId = AbilityBattleEffects(ABILITYEFFECT_CHECK_BANK_SIDE, gBattlerAttacker, ability, 0, 0);
battlerId = AbilityBattleEffects(ABILITYEFFECT_CHECK_BATTLER_SIDE, gBattlerAttacker, ability, 0, 0);
if (battlerId)
{
gLastUsedAbility = ability;
@ -3448,7 +3449,7 @@ static void atk23_getexp(void)
if (gBattleControllerExecFlags == 0)
{
gActiveBattler = gBattleStruct->expGetterBattlerId;
if (gBattleBufferB[gActiveBattler][0] == CONTROLLER_TWORETURNVALUES && gBattleBufferB[gActiveBattler][1] == RET_VALUE_LEVELLED_UP)
if (gBattleBufferB[gActiveBattler][0] == CONTROLLER_TWORETURNVALUES && gBattleBufferB[gActiveBattler][1] == RET_VALUE_LEVELED_UP)
{
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId)
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
@ -3534,7 +3535,7 @@ static void atk24(void)
if (gBattleControllerExecFlags)
return;
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId == STEVEN_PARTNER_ID)
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId == TRAINER_STEVEN_PARTNER)
{
for (i = 0; i < 3; i++)
{
@ -4648,14 +4649,14 @@ static void atk49_moveend(void)
BtlController_EmitSpriteInvisibility(0, FALSE);
MarkBattlerForControllerExec(gActiveBattler);
gStatuses3[gBattlerAttacker] &= ~(STATUS3_SEMI_INVULNERABLE);
gSpecialStatuses[gBattlerAttacker].restoredBankSprite = 1;
gSpecialStatuses[gBattlerAttacker].restoredBattlerSprite = 1;
gBattleScripting.atk49_state++;
return;
}
gBattleScripting.atk49_state++;
break;
case 10: // make target sprite visible
if (!gSpecialStatuses[gBattlerTarget].restoredBankSprite && gBattlerTarget < gBattlersCount
if (!gSpecialStatuses[gBattlerTarget].restoredBattlerSprite && gBattlerTarget < gBattlersCount
&& !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE))
{
gActiveBattler = gBattlerTarget;
@ -4676,12 +4677,12 @@ static void atk49_moveend(void)
gBattleScripting.atk49_state++;
break;
case 14: // This case looks interesting, although I am not certain what it does. Probably fine tunes edge cases.
if (gHitMarker & HITMARKER_PURSUIT_TRAP)
if (gHitMarker & HITMARKER_SWAP_ATTACKER_TARGET)
{
gActiveBattler = gBattlerAttacker;
gBattlerAttacker = gBattlerTarget;
gBattlerTarget = gActiveBattler;
gHitMarker &= ~(HITMARKER_PURSUIT_TRAP);
gHitMarker &= ~(HITMARKER_SWAP_ATTACKER_TARGET);
}
if (gHitMarker & HITMARKER_ATTACKSTRING_PRINTED)
{
@ -5034,7 +5035,7 @@ static void atk4F_jumpifcantswitch(void)
party = gPlayerParty;
i = 0;
if (sub_806D82C(GetBattlerMultiplayerId(gActiveBattler)) == TRUE)
if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(gActiveBattler)) == TRUE)
i = 3;
}
else
@ -5055,7 +5056,7 @@ static void atk4F_jumpifcantswitch(void)
party = gPlayerParty;
i = 0;
if (sub_806D82C(GetBattlerMultiplayerId(gActiveBattler)) == TRUE)
if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(gActiveBattler)) == TRUE)
i = 3;
}
@ -5144,7 +5145,7 @@ static void sub_804CF10(u8 arg0)
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = 6;
gBattleStruct->field_93 &= ~(gBitTable[gActiveBattler]);
BtlController_EmitChoosePokemon(0, 1, arg0, 0, gBattleStruct->field_60[gActiveBattler]);
BtlController_EmitChoosePokemon(0, PARTY_MUST_CHOOSE_MON, arg0, 0, gBattleStruct->field_60[gActiveBattler]);
MarkBattlerForControllerExec(gActiveBattler);
}
@ -5167,7 +5168,7 @@ static void atk50_openpartyscreen(void)
{
if (gHitMarker & HITMARKER_FAINTED(gActiveBattler))
{
if (sub_80423F4(gActiveBattler, 6, 6))
if (HasNoMonsToSwitch(gActiveBattler, 6, 6))
{
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
@ -5196,7 +5197,7 @@ static void atk50_openpartyscreen(void)
if (gBitTable[0] & hitmarkerFaintBits)
{
gActiveBattler = 0;
if (sub_80423F4(0, 6, 6))
if (HasNoMonsToSwitch(0, 6, 6))
{
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
@ -5218,7 +5219,7 @@ static void atk50_openpartyscreen(void)
if (gBitTable[2] & hitmarkerFaintBits && !(gBitTable[0] & hitmarkerFaintBits))
{
gActiveBattler = 2;
if (sub_80423F4(2, 6, 6))
if (HasNoMonsToSwitch(2, 6, 6))
{
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
@ -5239,7 +5240,7 @@ static void atk50_openpartyscreen(void)
if (gBitTable[1] & hitmarkerFaintBits)
{
gActiveBattler = 1;
if (sub_80423F4(1, 6, 6))
if (HasNoMonsToSwitch(1, 6, 6))
{
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
@ -5261,7 +5262,7 @@ static void atk50_openpartyscreen(void)
if (gBitTable[3] & hitmarkerFaintBits && !(gBitTable[1] & hitmarkerFaintBits))
{
gActiveBattler = 3;
if (sub_80423F4(3, 6, 6))
if (HasNoMonsToSwitch(3, 6, 6))
{
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
@ -5324,7 +5325,7 @@ static void atk50_openpartyscreen(void)
if (gBitTable[2] & hitmarkerFaintBits && gBitTable[0] & hitmarkerFaintBits)
{
gActiveBattler = 2;
if (sub_80423F4(2, gBattleBufferB[0][1], 6))
if (HasNoMonsToSwitch(2, gBattleBufferB[0][1], 6))
{
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
@ -5340,7 +5341,7 @@ static void atk50_openpartyscreen(void)
if (gBitTable[3] & hitmarkerFaintBits && hitmarkerFaintBits & gBitTable[1])
{
gActiveBattler = 3;
if (sub_80423F4(3, gBattleBufferB[1][1], 6))
if (HasNoMonsToSwitch(3, gBattleBufferB[1][1], 6))
{
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
@ -5383,16 +5384,16 @@ static void atk50_openpartyscreen(void)
else
{
if (gBattlescriptCurrInstr[1] & 0x80)
hitmarkerFaintBits = 0; // used here as the caseId for the EmitChoose function
hitmarkerFaintBits = PARTY_CHOOSE_MON; // Used here as the caseId for the EmitChoose function.
else
hitmarkerFaintBits = 1;
hitmarkerFaintBits = PARTY_MUST_CHOOSE_MON;
battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(0x80));
if (gSpecialStatuses[battlerId].flag40)
{
gBattlescriptCurrInstr += 6;
}
else if (sub_80423F4(battlerId, 6, 6))
else if (HasNoMonsToSwitch(battlerId, 6, 6))
{
gActiveBattler = battlerId;
gAbsentBattlerFlags |= gBitTable[gActiveBattler];
@ -5556,7 +5557,7 @@ static void atk52_switchineffects(void)
for (i = 0; i < gBattlersCount; i++)
{
if (gBattleTurnOrder[i] == gActiveBattler)
if (gBattlerByTurnOrder[i] == gActiveBattler)
gActionsByTurnOrder[i] = B_ACTION_CANCEL_PARTNER;
}
@ -5687,7 +5688,7 @@ static void atk5A_yesnoboxlearnmove(void)
{
case 0:
HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0);
BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC);
BattlePutTextOnWindow(gText_BattleYesNoChoice, 0xC);
gBattleScripting.learnMoveState++;
gBattleCommunication[CURSOR_POSITION] = 0;
BattleCreateYesNoCursorAt(0);
@ -5804,7 +5805,7 @@ static void atk5B_yesnoboxstoplearningmove(void)
{
case 0:
HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0);
BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC);
BattlePutTextOnWindow(gText_BattleYesNoChoice, 0xC);
gBattleScripting.learnMoveState++;
gBattleCommunication[CURSOR_POSITION] = 0;
BattleCreateYesNoCursorAt(0);
@ -5871,7 +5872,7 @@ static u32 GetTrainerMoneyToGive(u16 trainerId)
u32 lastMonLevel = 0;
u32 moneyReward = 0;
if (trainerId == SECRET_BASE_OPPONENT)
if (trainerId == TRAINER_SECRET_BASE)
{
moneyReward = 20 * gBattleResources->secretBase->party.levels[0] * gBattleStruct->moneyMultiplier;
}
@ -5950,7 +5951,7 @@ static void atk5E(void)
if (gBattleControllerExecFlags == 0)
{
s32 i;
struct BattlePokemon* bufferPoke = (struct BattlePokemon*) &gBattleBufferB[gActiveBattler][4];
struct BattlePokemon *bufferPoke = (struct BattlePokemon*) &gBattleBufferB[gActiveBattler][4];
for (i = 0; i < 4; i++)
{
gBattleMons[gActiveBattler].moves[i] = bufferPoke->moves[i];
@ -5962,16 +5963,16 @@ static void atk5E(void)
}
}
static void atk5F(void)
static void atk5F_swapattackerwithtarget(void)
{
gActiveBattler = gBattlerAttacker;
gBattlerAttacker = gBattlerTarget;
gBattlerTarget = gActiveBattler;
if (gHitMarker & HITMARKER_PURSUIT_TRAP)
gHitMarker &= ~(HITMARKER_PURSUIT_TRAP);
if (gHitMarker & HITMARKER_SWAP_ATTACKER_TARGET)
gHitMarker &= ~(HITMARKER_SWAP_ATTACKER_TARGET);
else
gHitMarker |= HITMARKER_PURSUIT_TRAP;
gHitMarker |= HITMARKER_SWAP_ATTACKER_TARGET;
gBattlescriptCurrInstr++;
}
@ -5987,8 +5988,8 @@ static void atk60_incrementgamestat(void)
static void atk61_drawpartystatussummary(void)
{
s32 i;
struct Pokemon* party;
struct HpAndStatus hpStatuses[6];
struct Pokemon *party;
struct HpAndStatus hpStatuses[PARTY_SIZE];
if (gBattleControllerExecFlags)
return;
@ -6000,7 +6001,7 @@ static void atk61_drawpartystatussummary(void)
else
party = gEnemyParty;
for (i = 0; i < 6; i++)
for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&party[i], MON_DATA_SPECIES2) == SPECIES_NONE
|| GetMonData(&party[i], MON_DATA_SPECIES2) == SPECIES_EGG)
@ -6021,10 +6022,10 @@ static void atk61_drawpartystatussummary(void)
gBattlescriptCurrInstr += 2;
}
static void atk62(void)
static void atk62_hidepartystatussummary(void)
{
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
BtlController_EmitCmd49(0);
BtlController_EmitHidePartyStatusSummary(0);
MarkBattlerForControllerExec(gActiveBattler);
gBattlescriptCurrInstr += 2;
@ -6100,7 +6101,7 @@ static void atk67_yesnobox(void)
{
case 0:
HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0);
BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC);
BattlePutTextOnWindow(gText_BattleYesNoChoice, 0xC);
gBattleCommunication[0]++;
gBattleCommunication[CURSOR_POSITION] = 0;
BattleCreateYesNoCursorAt(0);
@ -6631,7 +6632,7 @@ static void atk76_various(void)
gBattleCommunication[0] = 0;
break;
case VARIOUS_RESET_INTIMIDATE_TRACE_BITS:
gSpecialStatuses[gActiveBattler].intimidatedPoke = 0;
gSpecialStatuses[gActiveBattler].intimidatedMon = 0;
gSpecialStatuses[gActiveBattler].traced = 0;
break;
case VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP:
@ -6720,7 +6721,7 @@ static void atk76_various(void)
break;
case 16:
BattleStringExpandPlaceholdersToDisplayedString(gRefereeStringsTable[gBattlescriptCurrInstr[1]]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0x16);
BattlePutTextOnWindow(gDisplayedStringBattle, 0x16);
break;
case 17:
if (IsTextPrinterActive(0x16))
@ -7507,7 +7508,7 @@ static void atk8F_forcerandomswitch(void)
else if ((gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
|| (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_x2000000))
{
if (sub_806D82C(GetBattlerMultiplayerId(gBattlerTarget)) == 1)
if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(gBattlerTarget)) == 1)
{
firstMonId = 3;
lastMonId = 6;
@ -8125,7 +8126,7 @@ static void atk9E_metronome(void)
s32 i;
gCurrentMove = (Random() & 0x1FF) + 1;
if (gCurrentMove > LAST_MOVE_INDEX)
if (gCurrentMove >= MOVES_COUNT)
continue;
for (i = 0; i < 4; i++); // ?
@ -8595,7 +8596,7 @@ static void atkAE_healpartystatus(void)
if (gCurrentMove == MOVE_HEAL_BELL)
{
struct Pokemon* party;
struct Pokemon *party;
s32 i;
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
@ -8633,7 +8634,7 @@ static void atkAE_healpartystatus(void)
}
}
for (i = 0; i < 6; i++)
for (i = 0; i < PARTY_SIZE; i++)
{
u16 species = GetMonData(&party[i], MON_DATA_SPECIES2);
u8 abilityBit = GetMonData(&party[i], MON_DATA_ALT_ABILITY);
@ -8957,7 +8958,7 @@ static void atkBA_jumpifnopursuitswitchdmg(void)
for (i = 0; i < gBattlersCount; i++)
{
if (gBattleTurnOrder[i] == gBattlerTarget)
if (gBattlerByTurnOrder[i] == gBattlerTarget)
gActionsByTurnOrder[i] = 11;
}
@ -9045,7 +9046,7 @@ static void atkBE_rapidspinfree(void)
else if (gStatuses3[gBattlerAttacker] & STATUS3_LEECHSEED)
{
gStatuses3[gBattlerAttacker] &= ~(STATUS3_LEECHSEED);
gStatuses3[gBattlerAttacker] &= ~(STATUS3_LEECHSEED_BANK);
gStatuses3[gBattlerAttacker] &= ~(STATUS3_LEECHSEED_BATTLER);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_LeechSeedFree;
}
@ -9761,7 +9762,7 @@ static void atkE1_trygetintimidatetarget(void)
{
u8 side;
gBattleScripting.battler = gBattleStruct->intimidateBank;
gBattleScripting.battler = gBattleStruct->intimidateBattler;
side = GetBattlerSide(gBattleScripting.battler);
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gBattleMons[gBattleScripting.battler].ability)
@ -10053,7 +10054,7 @@ static void atkEC_pursuitrelated(void)
}
}
static void atkEF_snatchsetbanks(void)
static void atkEF_snatchsetbattlers(void)
{
gEffectBattler = gBattlerAttacker;
@ -10116,7 +10117,7 @@ static void atkEF_handleballthrow(void)
u8 catchRate;
if (gLastUsedItem == ITEM_SAFARI_BALL)
catchRate = gBattleStruct->field_7C * 1275 / 100;
catchRate = gBattleStruct->safariCatchFactor * 1275 / 100;
else
catchRate = gBaseStats[gBattleMons[gBattlerTarget].species].catchRate;
@ -10131,7 +10132,7 @@ static void atkEF_handleballthrow(void)
ballMultiplier = 10;
break;
case ITEM_DIVE_BALL:
if (Overworld_GetMapTypeOfSaveblockLocation() == 5)
if (Overworld_GetMapTypeOfSaveblockLocation() == MAP_TYPE_UNDERWATER)
ballMultiplier = 35;
else
ballMultiplier = 10;
@ -10406,7 +10407,7 @@ static void atkF3_trygivecaughtmonnick(void)
{
case 0:
HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0);
BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC);
BattlePutTextOnWindow(gText_BattleYesNoChoice, 0xC);
gBattleCommunication[MULTIUSE_STATE]++;
gBattleCommunication[CURSOR_POSITION] = 0;
BattleCreateYesNoCursorAt(0);

View File

@ -799,7 +799,7 @@ static u8 GetTrainerBattleTransition(void)
u8 enemyLevel;
u8 playerLevel;
if (gTrainerBattleOpponent_A == SECRET_BASE_OPPONENT)
if (gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
return B_TRANSITION_CHAMPION;
if (gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_ELITE_FOUR)
@ -1089,14 +1089,14 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
switch (sTrainerBattleMode)
{
case 3:
case TRAINER_BATTLE_NORMAL_NO_INTRO_TEXT:
TrainerBattleLoadArgs(sOrdinaryNoIntroBattleParams, data);
return EventScript_2713C2;
case 4:
case TRAINER_BATTLE_DOUBLE:
TrainerBattleLoadArgs(sDoubleBattleParams, data);
SetMapVarsToTrainer();
return EventScript_TryDoDoubleTrainerBattle;
case 2:
case TRAINER_BATTLE_CONTINUE_SCRIPT:
if (gApproachingTrainerId == 0)
{
TrainerBattleLoadArgs(sContinueScriptBattleParams, data);
@ -1107,26 +1107,26 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
TrainerBattleLoadArgs(sTrainerBContinueScriptBattleParams, data);
}
return EventScript_271362;
case 1:
case TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC:
TrainerBattleLoadArgs(sContinueScriptBattleParams, data);
SetMapVarsToTrainer();
return EventScript_271362;
case 6:
case 8:
case TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE:
case TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC:
TrainerBattleLoadArgs(sContinueScriptDoubleBattleParams, data);
SetMapVarsToTrainer();
return EventScript_TryDoDoubleTrainerBattle;
case 7:
case TRAINER_BATTLE_REMATCH_DOUBLE:
TrainerBattleLoadArgs(sDoubleBattleParams, data);
SetMapVarsToTrainer();
gTrainerBattleOpponent_A = GetRematchTrainerId(gTrainerBattleOpponent_A);
return EventScript_TryDoDoubleRematchBattle;
case 5:
case TRAINER_BATTLE_REMATCH:
TrainerBattleLoadArgs(sOrdinaryBattleParams, data);
SetMapVarsToTrainer();
gTrainerBattleOpponent_A = GetRematchTrainerId(gTrainerBattleOpponent_A);
return EventScript_2713D1;
case 9:
case TRAINER_BATTLE_9:
if (gApproachingTrainerId == 0)
{
TrainerBattleLoadArgs(sOrdinaryBattleParams, data);
@ -1139,13 +1139,13 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
gTrainerBattleOpponent_B = sub_81A9AA8(gSpecialVar_LastTalked);
}
return EventScript_271362;
case 10:
case TRAINER_BATTLE_SET_TRAINER_A:
TrainerBattleLoadArgs(sOrdinaryBattleParams, data);
return NULL;
case 11:
case TRAINER_BATTLE_SET_TRAINER_B:
TrainerBattleLoadArgs(sTrainerBOrdinaryBattleParams, data);
return NULL;
case 12:
case TRAINER_BATTLE_12:
if (gApproachingTrainerId == 0)
{
TrainerBattleLoadArgs(sOrdinaryBattleParams, data);
@ -1306,7 +1306,7 @@ void BattleSetup_StartTrainerBattle(void)
static void CB2_EndTrainerBattle(void)
{
if (gTrainerBattleOpponent_A == SECRET_BASE_OPPONENT)
if (gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
{
SetMainCallback2(CB2_ReturnToFieldContinueScript);
}
@ -1330,7 +1330,7 @@ static void CB2_EndTrainerBattle(void)
static void CB2_EndRematchBattle(void)
{
if (gTrainerBattleOpponent_A == SECRET_BASE_OPPONENT)
if (gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
{
SetMainCallback2(CB2_ReturnToFieldContinueScript);
}
@ -1498,7 +1498,7 @@ const u8 *GetTrainerALoseText(void)
{
const u8 *string;
if (gTrainerBattleOpponent_A == SECRET_BASE_OPPONENT)
if (gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
string = GetSecretBaseTrainerLoseText();
else
string = sTrainerADefeatSpeech;
@ -1592,11 +1592,11 @@ static bool32 UpdateRandomTrainerRematches(const struct RematchTrainer *table, u
{
if (gSaveBlock1Ptr->trainerRematches[i] != 0)
{
// Trainer already wants a rematch. Don't bother updating it
// Trainer already wants a rematch. Don't bother updating it.
ret = TRUE;
}
else if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i)
&& (Random() % 100) <= 30) // 31% chance of getting a rematch
&& (Random() % 100) <= 30) // 31% chance of getting a rematch.
{
SetRematchIdForTrainer(table, i);
ret = TRUE;

View File

@ -9,8 +9,6 @@
#include "battle_message.h"
#include "tv.h"
extern struct StringInfoBattle *gStringInfo;
// this file's functions
static bool8 sub_817E0B8(u16 stringId);
static void AddMovePoints(u8 caseId, u16 arg1, u8 arg2, u8 arg3);
@ -223,7 +221,7 @@ void BattleTv_SetDataBasedOnString(u16 stringId)
atkSide = GetBattlerSide(gBattlerAttacker);
defSide = GetBattlerSide(gBattlerTarget);
effSide = GetBattlerSide(gEffectBattler);
scriptingSide = GetBattlerSide(gStringInfo->scrActive);
scriptingSide = GetBattlerSide(gBattleMsgDataPtr->scrActive);
if (atkSide == B_SIDE_PLAYER)
atkMon = &gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]];
@ -235,7 +233,7 @@ void BattleTv_SetDataBasedOnString(u16 stringId)
else
defMon = &gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]];
moveSlot = GetBattlerMoveSlotId(gBattlerAttacker, gStringInfo->currentMove);
moveSlot = GetBattlerMoveSlotId(gBattlerAttacker, gBattleMsgDataPtr->currentMove);
if (moveSlot >= 4 && sub_817E0B8(stringId) && stringId > BATTLESTRINGS_ID_ADDER)
{
@ -480,8 +478,8 @@ void BattleTv_SetDataBasedOnString(u16 stringId)
break;
case STRINGID_PKMNFASTASLEEP:
if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].slpMonId != 0
&& gStringInfo->currentMove != MOVE_SNORE
&& gStringInfo->currentMove != MOVE_SLEEP_TALK)
&& gBattleMsgDataPtr->currentMove != MOVE_SNORE
&& gBattleMsgDataPtr->currentMove != MOVE_SLEEP_TALK)
AddMovePoints(9, 3, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].slpMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].slpMoveSlot);
break;
case STRINGID_PKMNWASFROZEN:
@ -798,8 +796,8 @@ void TryPutLinkBattleTvShowOnAir(void)
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
if ((playerBestMonId < 3 && !sub_806D82C(gBattleScripting.multiplayerId))
|| (playerBestMonId >= 3 && sub_806D82C(gBattleScripting.multiplayerId)))
if ((playerBestMonId < 3 && !GetLinkTrainerFlankId(gBattleScripting.multiplayerId))
|| (playerBestMonId >= 3 && GetLinkTrainerFlankId(gBattleScripting.multiplayerId)))
{
j = (opponentBestMonId < 3) ? 0 : 1;
PutBattleUpdateOnTheAir(sub_806EF84(j, gBattleScripting.multiplayerId), moveId, playerBestSpecies, opponentBestSpecies);
@ -1080,7 +1078,7 @@ _0817E5C8:\n\
ldr r0, =gBattleScripting\n\
adds r0, 0x25\n\
ldrb r0, [r0]\n\
bl sub_806D82C\n\
bl GetLinkTrainerFlankId\n\
lsls r0, 16\n\
cmp r0, 0\n\
beq _0817E630\n\
@ -1090,7 +1088,7 @@ _0817E620:\n\
ldr r0, =gBattleScripting\n\
adds r0, 0x25\n\
ldrb r0, [r0]\n\
bl sub_806D82C\n\
bl GetLinkTrainerFlankId\n\
lsls r0, 16\n\
cmp r0, 0\n\
beq _0817E670\n\

View File

@ -46,7 +46,7 @@ u8 GetBattlerForBattleScript(u8 caseId)
case BS_EFFECT_BATTLER:
ret = gEffectBattler;
break;
case BS_BANK_0:
case BS_BATTLER_0:
ret = 0;
break;
case BS_SCRIPTING:
@ -292,7 +292,7 @@ void sub_803FA70(u8 battler)
}
}
void BattleScriptPush(const u8* bsPtr)
void BattleScriptPush(const u8 *bsPtr)
{
gBattleResources->battleScriptsStack->ptr[gBattleResources->battleScriptsStack->size++] = bsPtr;
}
@ -453,14 +453,14 @@ bool8 AreAllMovesUnusable(void)
u8 unusable;
unusable = CheckMoveLimitations(gActiveBattler, 0, 0xFF);
if (unusable == 0xF) // all moves are unusable
if (unusable == 0xF) // All moves are unusable.
{
gProtectStructs[gActiveBattler].onlyStruggle = 1;
gProtectStructs[gActiveBattler].noValidMoves = 1;
gSelectionBattleScripts[gActiveBattler] = BattleScript_NoMovesLeft;
}
else
{
gProtectStructs[gActiveBattler].onlyStruggle = 0;
gProtectStructs[gActiveBattler].noValidMoves = 0;
}
return (unusable == 0xF);
@ -470,11 +470,11 @@ u8 GetImprisonedMovesCount(u8 battlerId, u16 move)
{
s32 i;
u8 imprisionedMoves = 0;
u8 bankSide = GetBattlerSide(battlerId);
u8 battlerSide = GetBattlerSide(battlerId);
for (i = 0; i < gBattlersCount; i++)
{
if (bankSide != GetBattlerSide(i) && gStatuses3[i] & STATUS3_IMPRISONED_OTHERS)
if (battlerSide != GetBattlerSide(i) && gStatuses3[i] & STATUS3_IMPRISONED_OTHERS)
{
s32 j;
for (j = 0; j < 4; j++)
@ -504,21 +504,21 @@ u8 UpdateTurnCounters(void)
do
{
u8 sideBank;
u8 side;
switch (gBattleStruct->turnCountersTracker)
{
case 0:
for (i = 0; i < gBattlersCount; i++)
{
gBattleTurnOrder[i] = i;
gBattlerByTurnOrder[i] = i;
}
for (i = 0; i < gBattlersCount - 1; i++)
{
s32 j;
for (j = i + 1; j < gBattlersCount; j++)
{
if (GetWhoStrikesFirst(gBattleTurnOrder[i], gBattleTurnOrder[j], 0))
if (GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], 0))
SwapTurnOrder(i, j);
}
}
@ -533,13 +533,13 @@ u8 UpdateTurnCounters(void)
case 1:
while (gBattleStruct->turnSideTracker < 2)
{
sideBank = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].reflectBattlerId;
if (gSideStatuses[sideBank] & SIDE_STATUS_REFLECT)
side = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[side].reflectBattlerId;
if (gSideStatuses[side] & SIDE_STATUS_REFLECT)
{
if (--gSideTimers[sideBank].reflectTimer == 0)
if (--gSideTimers[side].reflectTimer == 0)
{
gSideStatuses[sideBank] &= ~SIDE_STATUS_REFLECT;
gSideStatuses[side] &= ~SIDE_STATUS_REFLECT;
BattleScriptExecute(BattleScript_SideStatusWoreOff);
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_REFLECT);
effect++;
@ -558,15 +558,15 @@ u8 UpdateTurnCounters(void)
case 2:
while (gBattleStruct->turnSideTracker < 2)
{
sideBank = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].lightscreenBattlerId;
if (gSideStatuses[sideBank] & SIDE_STATUS_LIGHTSCREEN)
side = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[side].lightscreenBattlerId;
if (gSideStatuses[side] & SIDE_STATUS_LIGHTSCREEN)
{
if (--gSideTimers[sideBank].lightscreenTimer == 0)
if (--gSideTimers[side].lightscreenTimer == 0)
{
gSideStatuses[sideBank] &= ~SIDE_STATUS_LIGHTSCREEN;
gSideStatuses[side] &= ~SIDE_STATUS_LIGHTSCREEN;
BattleScriptExecute(BattleScript_SideStatusWoreOff);
gBattleCommunication[MULTISTRING_CHOOSER] = sideBank;
gBattleCommunication[MULTISTRING_CHOOSER] = side;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_LIGHT_SCREEN);
effect++;
}
@ -584,14 +584,14 @@ u8 UpdateTurnCounters(void)
case 3:
while (gBattleStruct->turnSideTracker < 2)
{
sideBank = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].mistBattlerId;
if (gSideTimers[sideBank].mistTimer != 0
&& --gSideTimers[sideBank].mistTimer == 0)
side = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[side].mistBattlerId;
if (gSideTimers[side].mistTimer != 0
&& --gSideTimers[side].mistTimer == 0)
{
gSideStatuses[sideBank] &= ~SIDE_STATUS_MIST;
gSideStatuses[side] &= ~SIDE_STATUS_MIST;
BattleScriptExecute(BattleScript_SideStatusWoreOff);
gBattleCommunication[MULTISTRING_CHOOSER] = sideBank;
gBattleCommunication[MULTISTRING_CHOOSER] = side;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_MIST);
effect++;
}
@ -608,13 +608,13 @@ u8 UpdateTurnCounters(void)
case 4:
while (gBattleStruct->turnSideTracker < 2)
{
sideBank = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[sideBank].safeguardBattlerId;
if (gSideStatuses[sideBank] & SIDE_STATUS_SAFEGUARD)
side = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[side].safeguardBattlerId;
if (gSideStatuses[side] & SIDE_STATUS_SAFEGUARD)
{
if (--gSideTimers[sideBank].safeguardTimer == 0)
if (--gSideTimers[side].safeguardTimer == 0)
{
gSideStatuses[sideBank] &= ~SIDE_STATUS_SAFEGUARD;
gSideStatuses[side] &= ~SIDE_STATUS_SAFEGUARD;
BattleScriptExecute(BattleScript_SafeguardEnds);
effect++;
}
@ -632,7 +632,7 @@ u8 UpdateTurnCounters(void)
case 5:
while (gBattleStruct->turnSideTracker < gBattlersCount)
{
gActiveBattler = gBattleTurnOrder[gBattleStruct->turnSideTracker];
gActiveBattler = gBattlerByTurnOrder[gBattleStruct->turnSideTracker];
if (gWishFutureKnock.wishCounter[gActiveBattler] != 0
&& --gWishFutureKnock.wishCounter[gActiveBattler] == 0
&& gBattleMons[gActiveBattler].hp != 0)
@ -755,7 +755,7 @@ u8 TurnBasedEffects(void)
gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_x20);
while (gBattleStruct->turnEffectsBattlerId < gBattlersCount && gBattleStruct->turnEffectsTracker <= TURNBASED_MAX_CASE)
{
gActiveBattler = gBattlerAttacker = gBattleTurnOrder[gBattleStruct->turnEffectsBattlerId];
gActiveBattler = gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->turnEffectsBattlerId];
if (gAbsentBattlerFlags & gBitTable[gActiveBattler])
{
gBattleStruct->turnEffectsBattlerId++;
@ -795,10 +795,10 @@ u8 TurnBasedEffects(void)
break;
case 3: // leech seed
if ((gStatuses3[gActiveBattler] & STATUS3_LEECHSEED)
&& gBattleMons[gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BANK].hp != 0
&& gBattleMons[gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BATTLER].hp != 0
&& gBattleMons[gActiveBattler].hp != 0)
{
gBattlerTarget = gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BANK; //funny how the 'target' is actually the battlerId that receives HP
gBattlerTarget = gStatuses3[gActiveBattler] & STATUS3_LEECHSEED_BATTLER; // Notice gBattlerTarget is actually the HP receiver.
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
@ -848,8 +848,8 @@ u8 TurnBasedEffects(void)
case 7: // spooky nightmares
if ((gBattleMons[gActiveBattler].status2 & STATUS2_NIGHTMARE) && gBattleMons[gActiveBattler].hp != 0)
{
// R/S does not perform this sleep check, which causes the nighmare effect to
// persist even after the affected Pokemon has been awakened by Shed Skin
// R/S does not perform this sleep check, which causes the nightmare effect to
// persist even after the affected Pokemon has been awakened by Shed Skin.
if (gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP)
{
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 4;
@ -983,7 +983,7 @@ u8 TurnBasedEffects(void)
case 12: // disable
if (gDisableStructs[gActiveBattler].disableTimer1 != 0)
{
int i;
s32 i;
for (i = 0; i < 4; i++)
{
if (gDisableStructs[gActiveBattler].disabledMove == gBattleMons[gActiveBattler].moves[i])
@ -1121,7 +1121,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void)
case 1:
while (gBattleStruct->wishPerishSongBattlerId < gBattlersCount)
{
gActiveBattler = gBattlerAttacker = gBattleTurnOrder[gBattleStruct->wishPerishSongBattlerId];
gActiveBattler = gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->wishPerishSongBattlerId];
if (gAbsentBattlerFlags & gBitTable[gActiveBattler])
{
gBattleStruct->wishPerishSongBattlerId++;
@ -1184,7 +1184,7 @@ bool8 HandleFaintedMonActions(void)
return FALSE;
do
{
int i;
s32 i;
switch (gBattleStruct->faintedActionsState)
{
case 0:
@ -1192,7 +1192,7 @@ bool8 HandleFaintedMonActions(void)
gBattleStruct->faintedActionsState++;
for (i = 0; i < gBattlersCount; i++)
{
if (gAbsentBattlerFlags & gBitTable[i] && !sub_80423F4(i, 6, 6))
if (gAbsentBattlerFlags & gBitTable[i] && !HasNoMonsToSwitch(i, 6, 6))
gAbsentBattlerFlags &= ~(gBitTable[i]);
}
// fall through
@ -1256,7 +1256,7 @@ bool8 HandleFaintedMonActions(void)
void TryClearRageStatuses(void)
{
int i;
s32 i;
for (i = 0; i < gBattlersCount; i++)
{
if ((gBattleMons[i].status2 & STATUS2_RAGE) && gChosenMoveByBattler[i] != MOVE_RAGE)
@ -1467,7 +1467,9 @@ u8 AtkCanceller_UnableToUseMove(void)
{
gBattleScripting.battler = CountTrailingZeroBits((gBattleMons[gBattlerAttacker].status2 & STATUS2_INFATUATION) >> 0x10);
if (Random() & 1)
{
BattleScriptPushCursor();
}
else
{
BattleScriptPush(BattleScript_MoveUsedIsParalyzedCantAttack);
@ -1485,7 +1487,9 @@ u8 AtkCanceller_UnableToUseMove(void)
{
gBattleMons[gBattlerAttacker].status2 -= 0x100;
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_BIDE)
{
gBattlescriptCurrInstr = BattleScript_BideStoringEnergy;
}
else
{
// This is removed in Emerald for some reason
@ -1500,7 +1504,9 @@ u8 AtkCanceller_UnableToUseMove(void)
gBattlescriptCurrInstr = BattleScript_BideAttack;
}
else
{
gBattlescriptCurrInstr = BattleScript_BideNoEnergyToAttack;
}
}
effect = 1;
}
@ -1535,29 +1541,31 @@ u8 AtkCanceller_UnableToUseMove(void)
return effect;
}
bool8 sub_80423F4(u8 battler, u8 r1, u8 r2)
bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2)
{
struct Pokemon* party;
u8 r7;
u8 r6;
struct Pokemon *party;
u8 id1, id2;
s32 i;
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
return FALSE;
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
{
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
r6 = ((battler & 2) / 2);
for (i = r6 * 3; i < r6 * 3 + 3; i++)
id1 = ((battler & BIT_FLANK) / 2);
for (i = id1 * 3; i < id1 * 3 + 3; i++)
{
if (GetMonData(&party[i], MON_DATA_HP) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG)
break;
}
return (i == r6 * 3 + 3);
return (i == id1 * 3 + 3);
}
else if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
@ -1566,86 +1574,95 @@ bool8 sub_80423F4(u8 battler, u8 r1, u8 r2)
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
{
party = gPlayerParty;
r7 = GetBattlerMultiplayerId(battler);
r6 = sub_806D82C(r7);
id2 = GetBattlerMultiplayerId(battler);
id1 = GetLinkTrainerFlankId(id2);
}
else
{
// FIXME: Compiler insists on moving r4 into r1 before doing the eor
// FIXME: Compiler insists on moving r4 into r1 before doing the eor.
#ifndef NONMATCHING
register u32 var asm("r1");
register u32 var asm("r1");
#else
u32 var;
u32 var;
#endif // NONMATCHING
party = gEnemyParty;
var = battler ^ 1;
r6 = (var != 0) ? 1 : 0;
var = battler ^ BIT_SIDE;
if (var == 0)
id1 = 0;
else
id1 = 1;
}
}
else
{
r7 = GetBattlerMultiplayerId(battler);
id2 = GetBattlerMultiplayerId(battler);
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
r6 = sub_806D82C(r7);
id1 = GetLinkTrainerFlankId(id2);
}
for (i = r6 * 3; i < r6 * 3 + 3; i++)
for (i = id1 * 3; i < id1 * 3 + 3; i++)
{
if (GetMonData(&party[i], MON_DATA_HP) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG)
break;
}
return (i == r6 * 3 + 3);
return (i == id1 * 3 + 3);
}
else if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && GetBattlerSide(battler) == B_SIDE_OPPONENT)
{
party = gEnemyParty;
if (battler == 1)
r6 = 0;
id1 = 0;
else
r6 = 3;
for (i = r6; i < r6 + 3; i++)
id1 = 3;
for (i = id1; i < id1 + 3; i++)
{
if (GetMonData(&party[i], MON_DATA_HP) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG)
break;
}
return (i == r6 + 3);
return (i == id1 + 3);
}
else
{
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
{
r7 = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
r6 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
id2 = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
id1 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
party = gEnemyParty;
}
else
{
r7 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
r6 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
id2 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
id1 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
party = gPlayerParty;
}
if (r1 == 6)
r1 = gBattlerPartyIndexes[r7];
if (r2 == 6)
r2 = gBattlerPartyIndexes[r6];
for (i = 0; i < 6; i++)
if (partyIdBattlerOn1 == PARTY_SIZE)
partyIdBattlerOn1 = gBattlerPartyIndexes[id2];
if (partyIdBattlerOn2 == PARTY_SIZE)
partyIdBattlerOn2 = gBattlerPartyIndexes[id1];
for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&party[i], MON_DATA_HP) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG
// FIXME: Using index[array] instead of array[index] is BAD!
&& i != r1 && i != r2 && i != r7[gBattleStruct->monToSwitchIntoId] && i != r6[gBattleStruct->monToSwitchIntoId])
&& i != partyIdBattlerOn1 && i != partyIdBattlerOn2
&& i != *(gBattleStruct->monToSwitchIntoId + id2) && i != id1[gBattleStruct->monToSwitchIntoId])
break;
}
return (i == 6);
return (i == PARTY_SIZE);
}
}
@ -1706,6 +1723,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
if (gBattlerAttacker >= gBattlersCount)
gBattlerAttacker = battler;
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER)
pokeAtk = &gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]];
else
@ -1713,6 +1731,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
if (gBattlerTarget >= gBattlersCount)
gBattlerTarget = battler;
if (GetBattlerSide(gBattlerTarget) == B_SIDE_PLAYER)
pokeDef = &gPlayerParty[gBattlerPartyIndexes[gBattlerTarget]];
else
@ -1724,7 +1743,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
speciesDef = GetMonData(pokeDef, MON_DATA_SPECIES);
pidDef = GetMonData(pokeDef, MON_DATA_PERSONALITY);
if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI)) // why isn't that check done at the beginning?
if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI)) // Why isn't that check done at the beginning?
{
u8 moveType;
s32 i;
@ -1821,10 +1840,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
}
break;
case ABILITY_INTIMIDATE:
if (!(gSpecialStatuses[battler].intimidatedPoke))
if (!(gSpecialStatuses[battler].intimidatedMon))
{
gStatuses3[battler] |= STATUS3_INTIMIDATE_POKES;
gSpecialStatuses[battler].intimidatedPoke = 1;
gSpecialStatuses[battler].intimidatedMon = 1;
}
break;
case ABILITY_FORECAST:
@ -2271,7 +2290,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
gLastUsedAbility = ABILITY_INTIMIDATE;
gStatuses3[i] &= ~(STATUS3_INTIMIDATE_POKES);
BattleScriptPushCursorAndCallback(BattleScript_82DB4B8);
gBattleStruct->intimidateBank = i;
gBattleStruct->intimidateBattler = i;
effect++;
break;
}
@ -2343,7 +2362,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
gStatuses3[i] &= ~(STATUS3_INTIMIDATE_POKES);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_82DB4C1;
gBattleStruct->intimidateBank = i;
gBattleStruct->intimidateBattler = i;
effect++;
break;
}
@ -2360,7 +2379,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
}
}
break;
case ABILITYEFFECT_CHECK_BANK_SIDE: // 13
case ABILITYEFFECT_CHECK_BATTLER_SIDE: // 13
side = GetBattlerSide(battler);
for (i = 0; i < gBattlersCount; i++)
{
@ -2410,7 +2429,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
}
}
break;
case ABILITYEFFECT_CHECK_FIELD_EXCEPT_BANK: // 15
case ABILITYEFFECT_CHECK_FIELD_EXCEPT_BATTLER: // 15
for (i = 0; i < gBattlersCount; i++)
{
if (gBattleMons[i].ability == ability && i != battler)
@ -2431,7 +2450,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
}
}
break;
case ABILITYEFFECT_COUNT_BANK_SIDE: // 17
case ABILITYEFFECT_COUNT_BATTLER_SIDE: // 17
side = GetBattlerSide(battler);
for (i = 0; i < gBattlersCount; i++)
{
@ -2492,32 +2511,32 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
int i = 0;
u8 effect = ITEM_NO_EFFECT;
u8 changedPP = 0;
u8 bankHoldEffect, atkHoldEffect, defHoldEffect;
u8 bankQuality, atkQuality, defQuality;
u8 battlerHoldEffect, atkHoldEffect, defHoldEffect;
u8 battlerHoldEffectParam, atkHoldEffectParam, defHoldEffectParam;
u16 atkItem, defItem;
gLastUsedItem = gBattleMons[battlerId].item;
if (gLastUsedItem == ITEM_ENIGMA_BERRY)
{
bankHoldEffect = gEnigmaBerries[battlerId].holdEffect;
bankQuality = gEnigmaBerries[battlerId].holdEffectParam;
battlerHoldEffect = gEnigmaBerries[battlerId].holdEffect;
battlerHoldEffectParam = gEnigmaBerries[battlerId].holdEffectParam;
}
else
{
bankHoldEffect = ItemId_GetHoldEffect(gLastUsedItem);
bankQuality = ItemId_GetHoldEffectParam(gLastUsedItem);
battlerHoldEffect = ItemId_GetHoldEffect(gLastUsedItem);
battlerHoldEffectParam = ItemId_GetHoldEffectParam(gLastUsedItem);
}
atkItem = gBattleMons[gBattlerAttacker].item;
if (atkItem == ITEM_ENIGMA_BERRY)
{
atkHoldEffect = gEnigmaBerries[gBattlerAttacker].holdEffect;
atkQuality = gEnigmaBerries[gBattlerAttacker].holdEffectParam;
atkHoldEffectParam = gEnigmaBerries[gBattlerAttacker].holdEffectParam;
}
else
{
atkHoldEffect = ItemId_GetHoldEffect(atkItem);
atkQuality = ItemId_GetHoldEffectParam(atkItem);
atkHoldEffectParam = ItemId_GetHoldEffectParam(atkItem);
}
// def variables are unused
@ -2525,18 +2544,18 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
if (defItem == ITEM_ENIGMA_BERRY)
{
defHoldEffect = gEnigmaBerries[gBattlerTarget].holdEffect;
defQuality = gEnigmaBerries[gBattlerTarget].holdEffectParam;
defHoldEffectParam = gEnigmaBerries[gBattlerTarget].holdEffectParam;
}
else
{
defHoldEffect = ItemId_GetHoldEffect(defItem);
defQuality = ItemId_GetHoldEffectParam(defItem);
defHoldEffectParam = ItemId_GetHoldEffectParam(defItem);
}
switch (caseID)
{
case ITEMEFFECT_ON_SWITCH_IN:
switch (bankHoldEffect)
switch (battlerHoldEffect)
{
case HOLD_EFFECT_DOUBLE_PRIZE:
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
@ -2564,13 +2583,13 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
case 1:
if (gBattleMons[battlerId].hp)
{
switch (bankHoldEffect)
switch (battlerHoldEffect)
{
case HOLD_EFFECT_RESTORE_HP:
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2 && !moveTurn)
{
gBattleMoveDamage = bankQuality;
if (gBattleMons[battlerId].hp + bankQuality > gBattleMons[battlerId].maxHP)
gBattleMoveDamage = battlerHoldEffectParam;
if (gBattleMons[battlerId].hp + battlerHoldEffectParam > gBattleMons[battlerId].maxHP)
gBattleMoveDamage = gBattleMons[battlerId].maxHP - gBattleMons[battlerId].hp;
gBattleMoveDamage *= -1;
BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem);
@ -2599,10 +2618,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
if (i != 4)
{
u8 maxPP = CalculatePPWithBonus(move, ppBonuses, i);
if (changedPP + bankQuality > maxPP)
if (changedPP + battlerHoldEffectParam > maxPP)
changedPP = maxPP;
else
changedPP = changedPP + bankQuality;
changedPP = changedPP + battlerHoldEffectParam;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, move);
@ -2641,7 +2660,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
gBattleMoveDamage *= -1;
BattleScriptExecute(BattleScript_ItemHealHP_End2);
effect = ITEM_HP_CHANGE;
RecordItemEffectBattle(battlerId, bankHoldEffect);
RecordItemEffectBattle(battlerId, battlerHoldEffect);
}
break;
// nice copy/paste there gamefreak, making a function for confuse berries was too much eh?
@ -2650,7 +2669,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
{
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_SPICY);
gBattleMoveDamage = gBattleMons[battlerId].maxHP / bankQuality;
gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
@ -2668,7 +2687,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
{
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_DRY);
gBattleMoveDamage = gBattleMons[battlerId].maxHP / bankQuality;
gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
@ -2686,7 +2705,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
{
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_SWEET);
gBattleMoveDamage = gBattleMons[battlerId].maxHP / bankQuality;
gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
@ -2704,7 +2723,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
{
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_BITTER);
gBattleMoveDamage = gBattleMons[battlerId].maxHP / bankQuality;
gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
@ -2722,7 +2741,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
{
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_SOUR);
gBattleMoveDamage = gBattleMons[battlerId].maxHP / bankQuality;
gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
@ -2737,7 +2756,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
break;
// copy/paste again, smh
case HOLD_EFFECT_ATTACK_UP:
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_ATK] < 0xC)
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_ATK] < 0xC)
{
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK);
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE);
@ -2751,7 +2770,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_DEFENSE_UP:
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_DEF] < 0xC)
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_DEF] < 0xC)
{
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_DEF);
@ -2764,7 +2783,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_SPEED_UP:
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPEED] < 0xC)
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPEED] < 0xC)
{
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPEED);
@ -2777,7 +2796,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_SP_ATTACK_UP:
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPATK] < 0xC)
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPATK] < 0xC)
{
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPATK);
@ -2790,7 +2809,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_SP_DEFENSE_UP:
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPDEF] < 0xC)
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPDEF] < 0xC)
{
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPDEF);
@ -2803,7 +2822,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_CRITICAL_UP:
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality && !moveTurn && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY))
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY))
{
gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY;
BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2);
@ -2811,7 +2830,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_RANDOM_STAT_UP:
if (!moveTurn && gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / bankQuality)
if (!moveTurn && gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam)
{
for (i = 0; i < 5; i++)
{
@ -2977,15 +2996,15 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
gLastUsedItem = gBattleMons[battlerId].item;
if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY)
{
bankHoldEffect = gEnigmaBerries[battlerId].holdEffect;
bankQuality = gEnigmaBerries[battlerId].holdEffectParam;
battlerHoldEffect = gEnigmaBerries[battlerId].holdEffect;
battlerHoldEffectParam = gEnigmaBerries[battlerId].holdEffectParam;
}
else
{
bankHoldEffect = ItemId_GetHoldEffect(gLastUsedItem);
bankQuality = ItemId_GetHoldEffectParam(gLastUsedItem);
battlerHoldEffect = ItemId_GetHoldEffect(gLastUsedItem);
battlerHoldEffectParam = ItemId_GetHoldEffectParam(gLastUsedItem);
}
switch (bankHoldEffect)
switch (battlerHoldEffect)
{
case HOLD_EFFECT_CURE_PAR:
if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS)
@ -3127,7 +3146,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
case HOLD_EFFECT_FLINCH:
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& TARGET_TURN_DAMAGED
&& (Random() % 100) < atkQuality
&& (Random() % 100) < atkHoldEffectParam
&& gBattleMoves[gCurrentMove].flags & FLAG_KINGSROCK_AFFECTED
&& gBattleMons[gBattlerTarget].hp)
{
@ -3148,7 +3167,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
gLastUsedItem = atkItem;
gPotentialItemEffectBattler = gBattlerAttacker;
gBattleScripting.battler = gBattlerAttacker;
gBattleMoveDamage = (gSpecialStatuses[gBattlerTarget].dmg / atkQuality) * -1;
gBattleMoveDamage = (gSpecialStatuses[gBattlerTarget].dmg / atkHoldEffectParam) * -1;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = -1;
gSpecialStatuses[gBattlerTarget].dmg = 0;
@ -3180,7 +3199,7 @@ void HandleAction_RunBattleScript(void) // identical to RunBattleScriptCommands
u8 GetMoveTarget(u16 move, u8 setTarget)
{
u8 targetBank = 0;
u8 targetBattler = 0;
u8 moveTarget;
u8 side;
@ -3194,21 +3213,21 @@ u8 GetMoveTarget(u16 move, u8 setTarget)
case MOVE_TARGET_SELECTED:
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp)
targetBank = gSideTimers[side].followmeTarget;
targetBattler = gSideTimers[side].followmeTarget;
else
{
side = GetBattlerSide(gBattlerAttacker);
do
{
targetBank = Random() % gBattlersCount;
} while (targetBank == gBattlerAttacker || side == GetBattlerSide(targetBank) || gAbsentBattlerFlags & gBitTable[targetBank]);
targetBattler = Random() % gBattlersCount;
} while (targetBattler == gBattlerAttacker || side == GetBattlerSide(targetBattler) || gAbsentBattlerFlags & gBitTable[targetBattler]);
if (gBattleMoves[move].type == TYPE_ELECTRIC
&& AbilityBattleEffects(ABILITYEFFECT_COUNT_OTHER_SIDE, gBattlerAttacker, ABILITY_LIGHTNING_ROD, 0, 0)
&& gBattleMons[targetBank].ability != ABILITY_LIGHTNING_ROD)
&& gBattleMons[targetBattler].ability != ABILITY_LIGHTNING_ROD)
{
targetBank ^= BIT_FLANK;
RecordAbilityBattle(targetBank, gBattleMons[targetBank].ability);
gSpecialStatuses[targetBank].lightningRodRedirected = 1;
targetBattler ^= BIT_FLANK;
RecordAbilityBattle(targetBattler, gBattleMons[targetBattler].ability);
gSpecialStatuses[targetBattler].lightningRodRedirected = 1;
}
}
break;
@ -3216,45 +3235,45 @@ u8 GetMoveTarget(u16 move, u8 setTarget)
case MOVE_TARGET_BOTH:
case MOVE_TARGET_FOES_AND_ALLY:
case MOVE_TARGET_OPPONENTS_FIELD:
targetBank = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE);
if (gAbsentBattlerFlags & gBitTable[targetBank])
targetBank ^= BIT_FLANK;
targetBattler = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE);
if (gAbsentBattlerFlags & gBitTable[targetBattler])
targetBattler ^= BIT_FLANK;
break;
case MOVE_TARGET_RANDOM:
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
if (gSideTimers[side].followmeTimer && gBattleMons[gSideTimers[side].followmeTarget].hp)
targetBank = gSideTimers[side].followmeTarget;
targetBattler = gSideTimers[side].followmeTarget;
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE && moveTarget & MOVE_TARGET_RANDOM)
{
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER)
{
if (Random() & 1)
targetBank = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
targetBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
else
targetBank = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
targetBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
}
else
{
if (Random() & 1)
targetBank = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
targetBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
else
targetBank = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
targetBattler = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
}
if (gAbsentBattlerFlags & gBitTable[targetBank])
targetBank ^= BIT_FLANK;
if (gAbsentBattlerFlags & gBitTable[targetBattler])
targetBattler ^= BIT_FLANK;
}
else
targetBank = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE);
targetBattler = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE);
break;
case MOVE_TARGET_USER_OR_SELECTED:
case MOVE_TARGET_USER:
targetBank = gBattlerAttacker;
targetBattler = gBattlerAttacker;
break;
}
*(gBattleStruct->moveTarget + gBattlerAttacker) = targetBank;
*(gBattleStruct->moveTarget + gBattlerAttacker) = targetBattler;
return targetBank;
return targetBattler;
}
static bool32 HasObedientBitSet(u8 battlerId)

View File

@ -15,6 +15,7 @@
#include "malloc.h"
#include "gpu_regs.h"
#include "text.h"
#include "text_window.h"
#include "event_data.h"
#include "main.h"
#include "link.h"
@ -153,8 +154,6 @@ extern const u8 gText_234Players[];
extern void sub_800A418(void);
extern u8 sub_800A9D8(void);
extern void LoadUserWindowBorderGfx(u8, u16, u8);
extern void copy_textbox_border_tile_patterns_to_vram(u8, u16, u8);
extern void sub_81AABF0(void (*callback)(void));
extern void sub_800B4C0(void);
extern void ClearLinkCallback(void);
@ -928,7 +927,7 @@ static void sub_807FAC8(void)
SetBgTilemapBuffer(1, sBerryBlenderData->tilemapBuffers[0]);
SetBgTilemapBuffer(2, sBerryBlenderData->tilemapBuffers[1]);
LoadUserWindowBorderGfx(0, 1, 0xD0);
copy_textbox_border_tile_patterns_to_vram(0, 0x14, 0xF0);
LoadMessageBoxGfx(0, 0x14, 0xF0);
InitBerryBlenderWindows();
sBerryBlenderData->mainState++;
@ -1330,9 +1329,8 @@ static void sub_8080588(void)
SetBgTilemapBuffer(1, sBerryBlenderData->tilemapBuffers[0]);
SetBgTilemapBuffer(2, sBerryBlenderData->tilemapBuffers[1]);
LoadUserWindowBorderGfx(0, 1, 0xD0);
copy_textbox_border_tile_patterns_to_vram(0, 0x14, 0xF0);
LoadMessageBoxGfx(0, 0x14, 0xF0);
InitBerryBlenderWindows();
sBerryBlenderData->field_44 = 0;

View File

@ -7,6 +7,7 @@
#include "task.h"
#include "field_effect.h"
#include "constants/flags.h"
#include "constants/maps.h"
extern void MapGridSetMetatileIdAt(s32 x, s32 y, u16 metatileId); // fieldmap
extern void DrawWholeMapView(); // field_camera
@ -14,7 +15,6 @@ extern void SetCameraPanningCallback(void ( *callback)()); // field_camera
extern void InstallCameraPanAheadCallback(void);
extern void SetCameraPanning(s16 x, s16 y);
extern u8 GetCursorSelectionMonId(void);
extern void FieldEffectActiveListRemove(u8 id); // field_effect
extern u8 oei_task_add(void);
// why do this, GF?
@ -24,7 +24,8 @@ enum
FLY_PUZZLE
};
extern u8 gBraillePuzzleCallbackFlag;
EWRAM_DATA static u8 sBraillePuzzleCallbackFlag = 0;
extern const u8 gUnknown_085EFE74[][2];
void SealedChamberShakingEffect(u8);
@ -205,14 +206,25 @@ void SealedChamberShakingEffect(u8 taskId)
// moved later in the function because it was rewritten.
bool8 ShouldDoBrailleStrengthEffect(void)
{
if (!FlagGet(FLAG_SYS_BRAILLE_STRENGTH) && (gSaveBlock1Ptr->location.mapGroup == 0x18 && gSaveBlock1Ptr->location.mapNum == 0x06))
if (!FlagGet(FLAG_SYS_BRAILLE_STRENGTH)
&& gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(DESERT_RUINS)
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(DESERT_RUINS))
{
if (gSaveBlock1Ptr->pos.x == 6 && gSaveBlock1Ptr->pos.y == 23)
{ gBraillePuzzleCallbackFlag = STRENGTH_PUZZLE; return TRUE; }
{
sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE;
return TRUE;
}
else if (gSaveBlock1Ptr->pos.x == 5 && gSaveBlock1Ptr->pos.y == 23)
{ gBraillePuzzleCallbackFlag = STRENGTH_PUZZLE; return TRUE; }
{
sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE;
return TRUE;
}
else if (gSaveBlock1Ptr->pos.x == 7 && gSaveBlock1Ptr->pos.y == 23)
{ gBraillePuzzleCallbackFlag = STRENGTH_PUZZLE; return TRUE; }
{
sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE;
return TRUE;
}
}
return FALSE;
@ -249,7 +261,7 @@ bool8 ShouldDoBrailleFlyEffect(void)
if (!FlagGet(FLAG_SYS_BRAILLE_FLY) && (gSaveBlock1Ptr->location.mapGroup == 0x18 && gSaveBlock1Ptr->location.mapNum == 0x44))
{
if (gSaveBlock1Ptr->pos.x == 8 && gSaveBlock1Ptr->pos.y == 25)
{ gBraillePuzzleCallbackFlag = FLY_PUZZLE; return TRUE; }
{ sBraillePuzzleCallbackFlag = FLY_PUZZLE; return TRUE; }
}
return FALSE;
}
@ -362,7 +374,7 @@ bool8 FldEff_UsePuzzleEffect(void)
{
u8 taskId = oei_task_add();
if (gBraillePuzzleCallbackFlag == FLY_PUZZLE)
if (sBraillePuzzleCallbackFlag == FLY_PUZZLE)
{
gTasks[taskId].data[8] = (u32)UseFlyAncientTomb_Callback >> 16;
gTasks[taskId].data[9] = (u32)UseFlyAncientTomb_Callback;

View File

@ -57,12 +57,10 @@ extern const u8 gText_NickHatchPrompt[];
extern u8 sav1_map_get_name(void);
extern void TVShowConvertInternationalString(u8* str1, u8* str2, u8);
extern void sub_806A068(u16, u8);
extern void FadeScreen(u8, u8);
extern void overworld_free_bg_tilemaps(void);
extern void sub_80AF168(void);
extern void ScanlineEffect_Stop(void);
extern void CB2_ReturnToField(void);
extern void play_some_sound(void);
extern void DoNamingScreen(u8, const u8*, u16, u8, u32, MainCallback);
extern u16 sub_80D22D0(void);
@ -437,8 +435,8 @@ static u8 EggHatchCreateMonSprite(u8 a0, u8 switchID, u8 pokeID, u16* speciesLoc
}
break;
case 1:
sub_806A068(GetMonSpritePalStruct(mon)->tag, r5);
spriteID = CreateSprite(&gUnknown_0202499C, 120, 75, 6);
SetMultiuseSpriteTemplateToPokemon(GetMonSpritePalStruct(mon)->tag, r5);
spriteID = CreateSprite(&gMultiuseSpriteTemplate, 120, 75, 6);
gSprites[spriteID].invisible = 1;
gSprites[spriteID].callback = SpriteCallbackDummy;
break;

View File

@ -62,7 +62,6 @@ extern const u8 gText_CommunicationStandby5[];
extern void sub_80356D0(void);
extern void sub_807B154(void);
extern void sub_806A068(u16, u8);
extern void sub_807F19C(void);
extern void sub_807B140(void);
extern void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies);
@ -280,9 +279,9 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo,
pokePal = GetMonSpritePalStructFromOtIdPersonality(currSpecies, trainerId, personality);
LoadCompressedPalette(pokePal->data, 0x110, 0x20);
sub_806A068(currSpecies, 1);
gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->preEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30);
SetMultiuseSpriteTemplateToPokemon(currSpecies, 1);
gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->preEvoSpriteID = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30);
gSprites[ID].callback = SpriteCallbackDummy_2;
gSprites[ID].oam.paletteNum = 1;
@ -295,9 +294,9 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo,
pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, trainerId, personality);
LoadCompressedPalette(pokePal->data, 0x120, 0x20);
sub_806A068(speciesToEvolve, 3);
gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30);
SetMultiuseSpriteTemplateToPokemon(speciesToEvolve, 3);
gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30);
gSprites[ID].callback = SpriteCallbackDummy_2;
gSprites[ID].oam.paletteNum = 2;
gSprites[ID].invisible = 1;
@ -373,9 +372,9 @@ static void CB2_EvolutionSceneLoadGraphics(void)
LoadCompressedPalette(pokePal->data, 0x120, 0x20);
sub_806A068(postEvoSpecies, 3);
gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30);
SetMultiuseSpriteTemplateToPokemon(postEvoSpecies, 3);
gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30);
gSprites[ID].callback = SpriteCallbackDummy_2;
gSprites[ID].oam.paletteNum = 2;
@ -450,9 +449,9 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void)
{
u8 ID;
sub_806A068(postEvoSpecies, 1);
gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30);
SetMultiuseSpriteTemplateToPokemon(postEvoSpecies, 1);
gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30);
gSprites[ID].callback = SpriteCallbackDummy_2;
gSprites[ID].oam.paletteNum = 2;
@ -509,9 +508,9 @@ void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpri
pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, trainerId, personality);
LoadCompressedPalette(pokePal->data, 0x120, 0x20);
sub_806A068(speciesToEvolve, 1);
gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30);
SetMultiuseSpriteTemplateToPokemon(speciesToEvolve, 1);
gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30);
gSprites[ID].callback = SpriteCallbackDummy_2;
gSprites[ID].oam.paletteNum = 2;
@ -635,7 +634,7 @@ static void Task_EvolutionScene(u8 taskID)
if (!gPaletteFade.active)
{
StringExpandPlaceholders(gStringVar4, gText_PkmnIsEvolving);
BattleHandleAddTextPrinter(gStringVar4, 0);
BattlePutTextOnWindow(gStringVar4, 0);
gTasks[taskID].tState++;
}
break;
@ -731,7 +730,7 @@ static void Task_EvolutionScene(u8 taskID)
if (IsCryFinished())
{
StringExpandPlaceholders(gStringVar4, gText_CongratsPkmnEvolved);
BattleHandleAddTextPrinter(gStringVar4, 0);
BattlePutTextOnWindow(gStringVar4, 0);
PlayBGM(MUS_FANFA5);
gTasks[taskID].tState++;
SetMonData(mon, MON_DATA_SPECIES, (void*)(&gTasks[taskID].tPostEvoSpecies));
@ -818,7 +817,7 @@ static void Task_EvolutionScene(u8 taskID)
else // Fire Red leftover probably
StringExpandPlaceholders(gStringVar4, gText_PkmnStoppedEvolving);
BattleHandleAddTextPrinter(gStringVar4, 0);
BattlePutTextOnWindow(gStringVar4, 0);
gTasks[taskID].tEvoWasStopped = TRUE;
gTasks[taskID].tState = 15;
}
@ -829,7 +828,7 @@ static void Task_EvolutionScene(u8 taskID)
BufferMoveToLearnIntoBattleTextBuff2();
PlayFanfare(MUS_FANFA1);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter
gTasks[taskID].tState++;
}
@ -846,7 +845,7 @@ static void Task_EvolutionScene(u8 taskID)
{
BufferMoveToLearnIntoBattleTextBuff2();
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gTasks[taskID].tLearnMoveState++;
}
break;
@ -854,7 +853,7 @@ static void Task_EvolutionScene(u8 taskID)
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2 - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gTasks[taskID].tLearnMoveState++;
}
break;
@ -862,7 +861,7 @@ static void Task_EvolutionScene(u8 taskID)
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3 - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gTasks[taskID].tData7 = 5;
gTasks[taskID].tData8 = 10;
gTasks[taskID].tLearnMoveState++;
@ -871,7 +870,7 @@ static void Task_EvolutionScene(u8 taskID)
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0);
BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC);
BattlePutTextOnWindow(gText_BattleYesNoChoice, 0xC);
gTasks[taskID].tLearnMoveState++;
sEvoCursorPos = 0;
BattleCreateYesNoCursorAt(0);
@ -939,7 +938,7 @@ static void Task_EvolutionScene(u8 taskID)
if (IsHMMove2(move))
{
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gTasks[taskID].tLearnMoveState = 12;
}
else
@ -955,14 +954,14 @@ static void Task_EvolutionScene(u8 taskID)
break;
case 7:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gTasks[taskID].tLearnMoveState++;
break;
case 8:
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gTasks[taskID].tLearnMoveState++;
}
break;
@ -970,20 +969,20 @@ static void Task_EvolutionScene(u8 taskID)
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gTasks[taskID].tState = 20;
}
break;
case 10:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gTasks[taskID].tData7 = 11;
gTasks[taskID].tData8 = 0;
gTasks[taskID].tLearnMoveState = 3;
break;
case 11:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gTasks[taskID].tState = 15;
break;
case 12:

View File

@ -380,7 +380,7 @@ u8 MapGridGetZCoordAt(int x, int y)
{
return 0;
}
return block >> 12;
}
@ -559,7 +559,7 @@ void mapdata_from_sav2(void)
a0 = 1;
else
a0 = -1;
for (j = x; j < x + 15; j++)
{
if (!sub_8088BF0(&gUnknown_02032318[j + width * i], width, a0))
@ -922,7 +922,7 @@ bool8 sub_8088BF0(u16* a0, u16 a1, u8 a2)
{
if (a2 == 0xFF)
return FALSE;
if (a2 == 0)
a0 -= a1;
else

View File

@ -33,12 +33,12 @@ struct HallofFameMon
u32 personality;
u16 species:9;
u16 lvl:7;
u8 nick[10];
u8 nick[POKEMON_NAME_LENGTH];
};
struct HallofFameTeam
{
struct HallofFameMon mon[6];
struct HallofFameMon mon[PARTY_SIZE];
};
struct HofGfx
@ -49,11 +49,11 @@ struct HofGfx
u8 tilemap2[0x1000];
};
static EWRAM_DATA u32 sUnknown_0203BCD4 = 0;
static EWRAM_DATA struct HallofFameTeam *sHofMonPtr = NULL;
static EWRAM_DATA struct HofGfx *sHofGfxPtr = NULL;
extern bool8 gHasHallOfFameRecords;
extern u32 gUnknown_0203BCD4;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern MainCallback gGameContinueCallback;
extern u32 gDamagedSaveSectors;
@ -490,7 +490,7 @@ static void Task_Hof_InitMonData(u8 taskId)
}
}
gUnknown_0203BCD4 = 0;
sUnknown_0203BCD4 = 0;
gTasks[taskId].tDisplayedMonId = 0;
gTasks[taskId].tPlayerSpriteID = 0xFF;
@ -648,11 +648,11 @@ static void Task_Hof_TryDisplayAnotherMon(u8 taskId)
}
else
{
gUnknown_0203BCD4 |= (0x10000 << gSprites[gTasks[taskId].tMonSpriteId(currPokeID)].oam.paletteNum);
sUnknown_0203BCD4 |= (0x10000 << gSprites[gTasks[taskId].tMonSpriteId(currPokeID)].oam.paletteNum);
if (gTasks[taskId].tDisplayedMonId <= 4 && currMon[1].species != SPECIES_NONE) // there is another pokemon to display
{
gTasks[taskId].tDisplayedMonId++;
BeginNormalPaletteFade(gUnknown_0203BCD4, 0, 12, 12, 0x63B0);
BeginNormalPaletteFade(sUnknown_0203BCD4, 0, 12, 12, 0x63B0);
gSprites[gTasks[taskId].tMonSpriteId(currPokeID)].oam.priority = 1;
gTasks[taskId].func = Task_Hof_DisplayMon;
}
@ -696,7 +696,7 @@ static void sub_8173DC0(u8 taskId)
if (gTasks[taskId].tMonSpriteId(i) != 0xFF)
gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 1;
}
BeginNormalPaletteFade(gUnknown_0203BCD4, 0, 12, 12, 0x63B0);
BeginNormalPaletteFade(sUnknown_0203BCD4, 0, 12, 12, 0x63B0);
FillWindowPixelBuffer(0, 0);
CopyWindowToVram(0, 3);
gTasks[taskId].tFrameCount = 7;
@ -923,7 +923,7 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId)
savedTeams++;
currMon = &savedTeams->mon[0];
gUnknown_0203BCD4 = 0;
sUnknown_0203BCD4 = 0;
gTasks[taskId].tCurrMonId = 0;
gTasks[taskId].tMonNo = 0;
@ -998,8 +998,8 @@ static void Task_HofPC_PrintMonInfo(u8 taskId)
currMonID = gTasks[taskId].tMonSpriteId(gTasks[taskId].tCurrMonId);
gSprites[currMonID].oam.priority = 0;
gUnknown_0203BCD4 = (0x10000 << gSprites[currMonID].oam.paletteNum) ^ 0xFFFF0000;
BlendPalettesUnfaded(gUnknown_0203BCD4, 0xC, 0x63B0);
sUnknown_0203BCD4 = (0x10000 << gSprites[currMonID].oam.paletteNum) ^ 0xFFFF0000;
BlendPalettesUnfaded(sUnknown_0203BCD4, 0xC, 0x63B0);
currMon = &savedTeams->mon[gTasks[taskId].tCurrMonId];
if (currMon->species != SPECIES_EGG)

View File

@ -1024,7 +1024,7 @@ bool8 RemovePyramidBagItem(u16 itemId, u16 count)
static u16 SanitizeItemId(u16 itemId)
{
if (itemId >= ITEM_LAST_ID + 1)
if (itemId >= ITEMS_COUNT)
return ITEM_NONE;
else
return itemId;

View File

@ -162,7 +162,7 @@ const void *GetItemIconPicOrPalette(u16 itemId, u8 which)
{
if (itemId == 0xFFFF)
itemId = ITEM_FIELD_ARROW;
else if (itemId > ITEM_LAST_ID)
else if (itemId >= ITEMS_COUNT)
itemId = 0;
return gItemIconTable[itemId][which];

View File

@ -2104,7 +2104,7 @@ void setup_bag_menu_textboxes(void)
InitWindows(gUnknown_08614174);
DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 1, -32);
copy_textbox_border_tile_patterns_to_vram(0, 10, -48);
LoadMessageBoxGfx(0, 10, -48);
sub_819A2BC(-64, 1);
LoadPalette(&gUnknown_0860F074, 0xF0, 0x20);
for (i = 0; i < 3; i++)

View File

@ -1066,7 +1066,7 @@ void task_new_game_prof_birch_speech_3(u8 taskId)
{
InitWindows(gUnknown_082FF080);
LoadMainMenuWindowFrameTiles(0, 0xF3);
copy_textbox_border_tile_patterns_to_vram(0, 0xFC, 0xF0);
LoadMessageBoxGfx(0, 0xFC, 0xF0);
unknown_rbox_to_vram(0, 1);
PutWindowTilemap(0);
CopyWindowToVram(0, 2);
@ -1593,7 +1593,7 @@ void new_game_prof_birch_speech_part2_start(void)
SetMainCallback2(CB2_MainMenu);
InitWindows(gUnknown_082FF080);
LoadMainMenuWindowFrameTiles(0, 0xF3);
copy_textbox_border_tile_patterns_to_vram(0, 0xFC, 0xF0);
LoadMessageBoxGfx(0, 0xFC, 0xF0);
PutWindowTilemap(0);
CopyWindowToVram(0, 3);
}

View File

@ -193,7 +193,7 @@ void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonP
void sub_81973A4(void)
{
copy_textbox_border_tile_patterns_to_vram(0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM * 0x10);
LoadMessageBoxGfx(0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM * 0x10);
LoadUserWindowBorderGfx(0, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM * 0x10);
}
@ -412,7 +412,7 @@ void SetStandardWindowBorderStyle(u8 windowId, bool8 copyToVram)
void sub_819786C(u8 windowId, bool8 copyToVram)
{
copy_textbox_border_tile_patterns_to_vram(windowId, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM * 0x10);
LoadMessageBoxGfx(windowId, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM * 0x10);
sub_8197B1C(windowId, copyToVram, DLG_WINDOW_BASE_TILE_NUM, 0xF);
}

View File

@ -665,7 +665,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
gTasks[taskId].tCryTaskState = wantedCry + 1;
break;
case 1:
if (ShouldPlayNormalPokeCry(mon) == TRUE)
if (ShouldPlayNormalMonCry(mon) == TRUE)
PlayCry3(species, pan, 0);
else
PlayCry3(species, pan, 11);
@ -680,7 +680,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
case 20:
if (gTasks[taskId].tCryTaskFrames == 0)
{
if (ShouldPlayNormalPokeCry(mon) == TRUE)
if (ShouldPlayNormalMonCry(mon) == TRUE)
PlayCry4(species, pan, 1);
else
PlayCry4(species, pan, 12);
@ -719,7 +719,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId)
gTasks[taskId].tCryTaskFrames--;
break;
}
if (ShouldPlayNormalPokeCry(mon) == TRUE)
if (ShouldPlayNormalMonCry(mon) == TRUE)
PlayCry4(species, pan, 0);
else
PlayCry4(species, pan, 11);

View File

@ -3,6 +3,7 @@
#include "bg.h"
#include "strings.h"
#include "text.h"
#include "text_window.h"
#include "menu.h"
#include "task.h"
#include "menu_helpers.h"
@ -75,8 +76,6 @@ extern const u16 gUnknown_0860F074[];
extern void CB2_ReturnToField(void);
extern bool8 sub_81221EC(void);
extern void LoadUserWindowBorderGfx(u8, u16, u8);
extern void copy_textbox_border_tile_patterns_to_vram(u8, u16, u8);
extern void sub_80AF168(void);
// this file's functions
@ -567,7 +566,7 @@ static void HandleInitWindows(void)
InitWindows(sWindowTemplatesForPokeblockMenu);
DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 1, 0xE0);
copy_textbox_border_tile_patterns_to_vram(0, 0xA, 0xD0);
LoadMessageBoxGfx(0, 0xA, 0xD0);
LoadPalette(gUnknown_0860F074, 0xF0, 0x20);
for (i = 0; i < ARRAY_COUNT(sWindowTemplatesForPokeblockMenu) - 1; i++)

View File

@ -21,6 +21,7 @@
#include "sound.h"
#include "trig.h"
#include "graphics.h"
#include "text_window.h"
#include "battle.h" // to get rid of once gMonSpritesGfxPtr is put elsewhere
struct PokeblockFeedStruct
@ -58,8 +59,6 @@ extern const struct CompressedSpriteSheet gMonFrontPicTable[];
extern const u16 gUnknown_0860F074[];
extern bool8 sub_81221EC(void);
extern void sub_806A068(u16, u8);
extern void LoadUserWindowBorderGfx(u8, u16, u8);
// this file's functions
static void HandleInitBackgrounds(void);
@ -661,7 +660,7 @@ static bool8 LoadMonAndSceneGfx(struct Pokemon *mon)
palette = GetMonSpritePalStructFromOtIdPersonality(species, trainerId, personality);
LoadCompressedObjectPalette(palette);
sub_806A068(palette->tag, 1);
SetMultiuseSpriteTemplateToPokemon(palette->tag, 1);
sPokeblockFeed->loadGfxState++;
break;
case 2:
@ -827,7 +826,7 @@ static void Task_PaletteFadeToReturn(u8 taskId)
static u8 CreateMonSprite(struct Pokemon* mon)
{
u16 species = GetMonData(mon, MON_DATA_SPECIES2);
u8 spriteId = CreateSprite(&gUnknown_0202499C, 48, 80, 2);
u8 spriteId = CreateSprite(&gMultiuseSpriteTemplate, 48, 80, 2);
sPokeblockFeed->species = species;
sPokeblockFeed->monSpriteId_ = spriteId;

View File

@ -63,7 +63,7 @@ extern const struct SpriteFrameImage gUnknown_082FF4F8[];
extern const struct SpriteFrameImage gUnknown_082FF518[];
extern const union AffineAnimCmd *const gUnknown_082FF618[];
extern const union AffineAnimCmd *const gUnknown_082FF694[];
extern const union AnimCmd *gUnknown_082FF70C[];
extern const union AnimCmd *gPlayerMonSpriteAnimsTable[];
extern const union AnimCmd *const *const gMonAnimationsSpriteAnimsPtrTable[];
extern const union AnimCmd *const *const gUnknown_08305D0C[];
extern const union AnimCmd *const *const gUnknown_0830536C[];
@ -105,7 +105,7 @@ EWRAM_DATA u8 gPlayerPartyCount = 0;
EWRAM_DATA u8 gEnemyPartyCount = 0;
EWRAM_DATA struct Pokemon gPlayerParty[PARTY_SIZE] = {0};
EWRAM_DATA struct Pokemon gEnemyParty[PARTY_SIZE] = {0};
EWRAM_DATA struct SpriteTemplate gUnknown_0202499C = {0};
EWRAM_DATA struct SpriteTemplate gMultiuseSpriteTemplate = {0};
EWRAM_DATA struct Unknown_806F160_Struct *gUnknown_020249B4[2] = {NULL};
// const rom data
@ -1964,11 +1964,11 @@ void CalculateMonStats(struct Pokemon *mon)
SetMonData(mon, MON_DATA_MAX_HP, &newMaxHP);
CALC_STAT(baseAttack, attackIV, attackEV, 1, MON_DATA_ATK)
CALC_STAT(baseDefense, defenseIV, defenseEV, 2, MON_DATA_DEF)
CALC_STAT(baseSpeed, speedIV, speedEV, 3, MON_DATA_SPEED)
CALC_STAT(baseSpAttack, spAttackIV, spAttackEV, 4, MON_DATA_SPATK)
CALC_STAT(baseSpDefense, spDefenseIV, spDefenseEV, 5, MON_DATA_SPDEF)
CALC_STAT(baseAttack, attackIV, attackEV, STAT_ATK, MON_DATA_ATK)
CALC_STAT(baseDefense, defenseIV, defenseEV, STAT_DEF, MON_DATA_DEF)
CALC_STAT(baseSpeed, speedIV, speedEV, STAT_SPEED, MON_DATA_SPEED)
CALC_STAT(baseSpAttack, spAttackIV, spAttackEV, STAT_SPATK, MON_DATA_SPATK)
CALC_STAT(baseSpDefense, spDefenseIV, spDefenseEV, STAT_SPDEF, MON_DATA_SPDEF)
if (species == SPECIES_SHEDINJA)
{
@ -2265,7 +2265,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
if (attackerHoldEffect == sHoldEffectToType[i][0]
&& type == sHoldEffectToType[i][1])
{
if (type <= 8)
if (IS_TYPE_PHYSICAL(type))
attack = (attack * (attackerHoldEffectParam + 100)) / 100;
else
spAttack = (spAttack * (attackerHoldEffectParam + 100)) / 100;
@ -2293,9 +2293,9 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
spAttack /= 2;
if (attacker->ability == ABILITY_HUSTLE)
attack = (150 * attack) / 100;
if (attacker->ability == ABILITY_PLUS && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_MINUS, 0, 0))
if (attacker->ability == ABILITY_PLUS && ABILITY_ON_FIELD2(ABILITY_MINUS))
spAttack = (150 * spAttack) / 100;
if (attacker->ability == ABILITY_MINUS && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_PLUS, 0, 0))
if (attacker->ability == ABILITY_MINUS && ABILITY_ON_FIELD2(ABILITY_PLUS))
spAttack = (150 * spAttack) / 100;
if (attacker->ability == ABILITY_GUTS && attacker->status1)
attack = (150 * attack) / 100;
@ -2316,7 +2316,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
if (gBattleMoves[gCurrentMove].effect == EFFECT_EXPLOSION)
defense /= 2;
if (type < TYPE_MYSTERY) // is physical
if (IS_TYPE_PHYSICAL(type))
{
if (gCritMultiplier == 2)
{
@ -2366,7 +2366,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
if (type == TYPE_MYSTERY)
damage = 0; // is ??? type. does 0 damage.
if (type > TYPE_MYSTERY) // is special?
if (IS_TYPE_SPECIAL(type))
{
if (gCritMultiplier == 2)
{
@ -2406,8 +2406,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
damage /= 2;
// are effects of weather negated with cloud nine or air lock
if (!AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_CLOUD_NINE, 0, 0)
&& !AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_AIR_LOCK, 0, 0))
if (WEATHER_HAS_EFFECT2)
{
if (gBattleWeather & WEATHER_RAIN_TEMPORARY)
{
@ -2486,13 +2485,14 @@ static bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId)
{
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_x2000000 | BATTLE_TYPE_FRONTIER))
return FALSE;
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
return FALSE;
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gTrainerBattleOpponent_A == SECRET_BASE_OPPONENT)
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
return FALSE;
if (FlagGet(badgeFlag))
else if (FlagGet(badgeFlag))
return TRUE;
return FALSE;
else
return FALSE;
}
u8 GetDefaultMoveTarget(u8 battlerId)
@ -2561,53 +2561,53 @@ u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality)
return MON_MALE;
}
void sub_806A068(u16 species, u8 battlerPosition)
void SetMultiuseSpriteTemplateToPokemon(u16 species, u8 battlerPosition)
{
if (gMonSpritesGfxPtr != NULL)
gUnknown_0202499C = gMonSpritesGfxPtr->templates[battlerPosition];
gMultiuseSpriteTemplate = gMonSpritesGfxPtr->templates[battlerPosition];
else if (gUnknown_020249B4[0])
gUnknown_0202499C = gUnknown_020249B4[0]->templates[battlerPosition];
gMultiuseSpriteTemplate = gUnknown_020249B4[0]->templates[battlerPosition];
else if (gUnknown_020249B4[1])
gUnknown_0202499C = gUnknown_020249B4[1]->templates[battlerPosition];
gMultiuseSpriteTemplate = gUnknown_020249B4[1]->templates[battlerPosition];
else
gUnknown_0202499C = gUnknown_08329D98[battlerPosition];
gMultiuseSpriteTemplate = gUnknown_08329D98[battlerPosition];
gUnknown_0202499C.paletteTag = species;
if (battlerPosition == 0 || battlerPosition == 2)
gUnknown_0202499C.anims = gUnknown_082FF70C;
gMultiuseSpriteTemplate.paletteTag = species;
if (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT)
gMultiuseSpriteTemplate.anims = gPlayerMonSpriteAnimsTable;
else if (species > 500)
gUnknown_0202499C.anims = gMonAnimationsSpriteAnimsPtrTable[species - 500];
gMultiuseSpriteTemplate.anims = gMonAnimationsSpriteAnimsPtrTable[species - 500];
else
gUnknown_0202499C.anims = gMonAnimationsSpriteAnimsPtrTable[species];
gMultiuseSpriteTemplate.anims = gMonAnimationsSpriteAnimsPtrTable[species];
}
void sub_806A12C(u16 trainerSpriteId, u8 battlerPosition)
void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosition)
{
gUnknown_0202499C.paletteTag = trainerSpriteId;
gMultiuseSpriteTemplate.paletteTag = trainerSpriteId;
if (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT)
{
gUnknown_0202499C = gUnknown_08329DF8[trainerSpriteId];
gUnknown_0202499C.anims = gUnknown_08305D0C[trainerSpriteId];
gMultiuseSpriteTemplate = gUnknown_08329DF8[trainerSpriteId];
gMultiuseSpriteTemplate.anims = gUnknown_08305D0C[trainerSpriteId];
}
else
{
if (gMonSpritesGfxPtr != NULL)
gUnknown_0202499C = gMonSpritesGfxPtr->templates[battlerPosition];
gMultiuseSpriteTemplate = gMonSpritesGfxPtr->templates[battlerPosition];
else
gUnknown_0202499C = gUnknown_08329D98[battlerPosition];
gUnknown_0202499C.anims = gUnknown_0830536C[trainerSpriteId];
gMultiuseSpriteTemplate = gUnknown_08329D98[battlerPosition];
gMultiuseSpriteTemplate.anims = gUnknown_0830536C[trainerSpriteId];
}
}
void sub_806A1C0(u16 arg0, u8 battlerPosition)
void SetMultiuseSpriteTemplateToTrainerFront(u16 arg0, u8 battlerPosition)
{
if (gMonSpritesGfxPtr != NULL)
gUnknown_0202499C = gMonSpritesGfxPtr->templates[battlerPosition];
gMultiuseSpriteTemplate = gMonSpritesGfxPtr->templates[battlerPosition];
else
gUnknown_0202499C = gUnknown_08329D98[battlerPosition];
gMultiuseSpriteTemplate = gUnknown_08329D98[battlerPosition];
gUnknown_0202499C.paletteTag = arg0;
gUnknown_0202499C.anims = gUnknown_0830536C[arg0];
gMultiuseSpriteTemplate.paletteTag = arg0;
gMultiuseSpriteTemplate.anims = gUnknown_0830536C[arg0];
}
static void EncryptBoxMon(struct BoxPokemon *boxMon)
@ -3136,7 +3136,8 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg)
{
const u8* data = dataArg;
const u8 *data = dataArg;
switch (field)
{
case MON_DATA_STATUS:
@ -3179,7 +3180,7 @@ void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg)
void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg)
{
const u8* data = dataArg;
const u8 *data = dataArg;
struct PokemonSubstruct0 *substruct0 = NULL;
struct PokemonSubstruct1 *substruct1 = NULL;
@ -4511,8 +4512,8 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
else
holdEffect = ItemId_GetHoldEffect(heldItem);
if (holdEffect == 38 && type != 3)
return 0;
if (holdEffect == HOLD_EFFECT_PREVENT_EVOLVE && type != 3)
return SPECIES_NONE;
switch (type)
{
@ -4520,7 +4521,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
level = GetMonData(mon, MON_DATA_LEVEL, 0);
friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, 0);
for (i = 0; i < 5; i++)
for (i = 0; i < EVOS_PER_MON; i++)
{
switch (gEvolutionTable[species][i].method)
{
@ -4577,7 +4578,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
}
break;
case 1:
for (i = 0; i < 5; i++)
for (i = 0; i < EVOS_PER_MON; i++)
{
switch (gEvolutionTable[species][i].method)
{
@ -4597,7 +4598,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
break;
case 2:
case 3:
for (i = 0; i < 5; i++)
for (i = 0; i < EVOS_PER_MON; i++)
{
if (gEvolutionTable[species][i].method == EVO_ITEM
&& gEvolutionTable[species][i].param == evolutionItem)
@ -4819,21 +4820,21 @@ bool8 sub_806D7EC(void)
return retVal;
}
bool16 sub_806D82C(u8 id)
u16 GetLinkTrainerFlankId(u8 linkPlayerId)
{
bool16 retVal = FALSE;
switch (gLinkPlayers[id].lp_field_18)
u16 flankId = 0;
switch (gLinkPlayers[linkPlayerId].lp_field_18)
{
case 0:
case 3:
retVal = FALSE;
flankId = 0;
break;
case 1:
case 2:
retVal = TRUE;
flankId = 1;
break;
}
return retVal;
return flankId;
}
s32 GetBattlerMultiplayerId(u16 a1)
@ -4849,16 +4850,17 @@ u8 GetTrainerEncounterMusicId(u16 trainerOpponentId)
{
if (InBattlePyramid())
return GetTrainerEncounterMusicIdInBattlePyramind(trainerOpponentId);
if (sub_81D5C18())
else if (sub_81D5C18())
return sub_81D63C8(trainerOpponentId);
return TRAINER_ENCOUNTER_MUSIC(trainerOpponentId);
else
return TRAINER_ENCOUNTER_MUSIC(trainerOpponentId);
}
u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex)
{
if (statIndex < 1 || statIndex > 5)
{
// should just be "return n", but it wouldn't match without this
// Should just be "return n", but it wouldn't match without this.
u16 retVal = n;
retVal++;
retVal--;
@ -5165,7 +5167,7 @@ void PartySpreadPokerus(struct Pokemon *party)
{
if (pokerus & 0xF)
{
// spread to adjacent party members
// Spread to adjacent party members.
if (i != 0 && !(GetMonData(&party[i - 1], MON_DATA_POKERUS, 0) & 0xF0))
SetMonData(&party[i - 1], MON_DATA_POKERUS, &curPokerus);
if (i != (PARTY_SIZE - 1) && !(GetMonData(&party[i + 1], MON_DATA_POKERUS, 0) & 0xF0))
@ -5365,11 +5367,11 @@ u16 GetBattleBGM(void)
{
if (gBattleTypeFlags & BATTLE_TYPE_KYOGRE_GROUDON)
return MUS_BATTLE34;
if (gBattleTypeFlags & BATTLE_TYPE_REGI)
else if (gBattleTypeFlags & BATTLE_TYPE_REGI)
return MUS_BATTLE36;
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))
else if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))
return MUS_BATTLE20;
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
{
u8 trainerClass;
@ -5414,7 +5416,8 @@ u16 GetBattleBGM(void)
return MUS_BATTLE20;
}
}
return MUS_BATTLE27;
else
return MUS_BATTLE27;
}
void PlayBattleBGM(void)
@ -5578,19 +5581,19 @@ void BoxMonRestorePP(struct BoxPokemon *boxMon)
}
}
void sub_806E994(void)
void SetMonPreventsSwitchingString(void)
{
gLastUsedAbility = gBattleStruct->field_B0;
gLastUsedAbility = gBattleStruct->abilityPreventingSwitchout;
gBattleTextBuff1[0] = B_BUFF_PLACEHOLDER_BEGIN;
gBattleTextBuff1[1] = B_BUFF_MON_NICK_WITH_PREFIX;
gBattleTextBuff1[2] = gBattleStruct->field_49;
gBattleTextBuff1[2] = gBattleStruct->battlerPreventingSwitchout;
gBattleTextBuff1[4] = B_BUFF_EOS;
if (!GetBattlerSide(gBattleStruct->field_49))
gBattleTextBuff1[3] = pokemon_order_func(gBattlerPartyIndexes[gBattleStruct->field_49]);
if (GetBattlerSide(gBattleStruct->battlerPreventingSwitchout) == B_SIDE_PLAYER)
gBattleTextBuff1[3] = pokemon_order_func(gBattlerPartyIndexes[gBattleStruct->battlerPreventingSwitchout]);
else
gBattleTextBuff1[3] = gBattlerPartyIndexes[gBattleStruct->field_49];
gBattleTextBuff1[3] = gBattlerPartyIndexes[gBattleStruct->battlerPreventingSwitchout];
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff2, gBattlerInMenuId, pokemon_order_func(gBattlerPartyIndexes[gBattlerInMenuId]))
@ -5678,7 +5681,7 @@ const u8 *GetTrainerPartnerName(void)
{
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
{
if (gPartnerTrainerId == STEVEN_PARTNER_ID)
if (gPartnerTrainerId == TRAINER_STEVEN_PARTNER)
{
return gTrainers[TRAINER_STEVEN].trainerName;
}
@ -5891,15 +5894,15 @@ void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality)
const u8 *GetTrainerClassNameFromId(u16 trainerId)
{
if (trainerId > NO_OF_TRAINERS)
trainerId = 0;
if (trainerId >= TRAINERS_COUNT)
trainerId = TRAINER_NONE;
return gTrainerClassNames[gTrainers[trainerId].trainerClass];
}
const u8 *GetTrainerNameFromId(u16 trainerId)
{
if (trainerId > NO_OF_TRAINERS)
trainerId = 0;
if (trainerId >= TRAINERS_COUNT)
trainerId = TRAINER_NONE;
return gTrainers[trainerId].trainerName;
}
@ -5948,7 +5951,7 @@ static void sub_806F1FC(struct Unknown_806F160_Struct* structPtr)
structPtr->frameImages[i * structPtr->field_0_0 + j].data = &structPtr->byteArrays[i][j * 0x800];
}
structPtr->templates[i].images = &structPtr->frameImages[i * structPtr->field_0_0];
structPtr->templates[i].anims = gUnknown_082FF70C;
structPtr->templates[i].anims = gPlayerMonSpriteAnimsTable;
structPtr->templates[i].paletteTag = i;
}
}

View File

@ -58,8 +58,8 @@ struct RecordedBattleSave
u8 field_4FC;
u8 field_4FD;
u8 field_4FE;
u8 battleStyle : 1;
u8 textSpeed : 3;
u8 battleStyle:1;
u8 textSpeed:3;
u32 AI_scripts;
u8 field_504[8];
u8 field_50C;
@ -79,19 +79,19 @@ EWRAM_DATA static u16 sUnknown_0203C79C[4] = {0};
EWRAM_DATA static u16 sUnknown_0203C7A4[4] = {0};
EWRAM_DATA static u8 sUnknown_0203C7AC = 0;
EWRAM_DATA static u8 sUnknown_0203C7AD = 0;
EWRAM_DATA static u8 sUnknown_0203C7AE = 0;
EWRAM_DATA static u8 sFrontierFacility = 0;
EWRAM_DATA static u8 sUnknown_0203C7AF = 0;
EWRAM_DATA static MainCallback sCallback2_AfterRecordedBattle = NULL;
EWRAM_DATA u8 gUnknown_0203C7B4 = 0;
EWRAM_DATA static u8 sUnknown_0203C7B5 = 0;
EWRAM_DATA static u8 sRecordedBattle_BattleStyle = 0;
EWRAM_DATA static u8 sRecordedBattle_TextSpeed = 0;
EWRAM_DATA static u32 sRecordedBattle_BattleFlags = 0;
EWRAM_DATA static u32 sRecordedBattle_AI_Scripts = 0;
EWRAM_DATA static u8 sBattleStyle = 0;
EWRAM_DATA static u8 sTextSpeed = 0;
EWRAM_DATA static u32 sBattleFlags = 0;
EWRAM_DATA static u32 sAI_Scripts = 0;
EWRAM_DATA static struct Pokemon sSavedPlayerParty[PARTY_SIZE] = {0};
EWRAM_DATA static struct Pokemon sSavedOpponentParty[PARTY_SIZE] = {0};
EWRAM_DATA static u16 sRecordedBattle_PlayerMonMoves[2][4] = {0};
EWRAM_DATA static struct PlayerInfo sRecordedBattle_Players[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA static u16 sPlayerMonMoves[2][4] = {0};
EWRAM_DATA static struct PlayerInfo sPlayers[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA static u8 sUnknown_0203CCD0 = 0;
EWRAM_DATA static u8 sUnknown_0203CCD1[8] = {0};
EWRAM_DATA static u8 sUnknown_0203CCD9 = 0;
@ -126,8 +126,8 @@ void sub_8184DA4(u8 arg0)
{
sBattleRecords[i][j] |= 0xFF;
}
sRecordedBattle_BattleFlags = gBattleTypeFlags;
sRecordedBattle_AI_Scripts = gBattleResources->ai->aiFlags;
sBattleFlags = gBattleTypeFlags;
sAI_Scripts = gBattleResources->ai->aiFlags;
}
}
}
@ -139,7 +139,7 @@ void sub_8184E58(void)
if (sUnknown_0203C7AC == 1)
{
gRecordedBattleRngSeed = gRngValue;
sUnknown_0203C7AE = VarGet(VAR_FRONTIER_FACILITY);
sFrontierFacility = VarGet(VAR_FRONTIER_FACILITY);
sUnknown_0203C7AF = sub_81A513C();
}
else if (sUnknown_0203C7AC == 2)
@ -157,37 +157,37 @@ void sub_8184E58(void)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
sRecordedBattle_Players[i].trainerId = gLinkPlayers[i].trainerId;
sRecordedBattle_Players[i].gender = gLinkPlayers[i].gender;
sRecordedBattle_Players[i].battlerId = gLinkPlayers[i].lp_field_18;
sRecordedBattle_Players[i].language = gLinkPlayers[i].language;
sPlayers[i].trainerId = gLinkPlayers[i].trainerId;
sPlayers[i].gender = gLinkPlayers[i].gender;
sPlayers[i].battlerId = gLinkPlayers[i].lp_field_18;
sPlayers[i].language = gLinkPlayers[i].language;
if (i < linkPlayersCount)
{
StringCopy(text, gLinkPlayers[i].name);
StripExtCtrlCodes(text);
StringCopy(sRecordedBattle_Players[i].name, text);
StringCopy(sPlayers[i].name, text);
}
else
{
for (j = 0; j < PLAYER_NAME_LENGTH; j++)
sRecordedBattle_Players[i].name[j] = gLinkPlayers[i].name[j];
sPlayers[i].name[j] = gLinkPlayers[i].name[j];
}
}
}
else
{
sRecordedBattle_Players[0].trainerId = (gSaveBlock2Ptr->playerTrainerId[0])
sPlayers[0].trainerId = (gSaveBlock2Ptr->playerTrainerId[0])
| (gSaveBlock2Ptr->playerTrainerId[1] << 8)
| (gSaveBlock2Ptr->playerTrainerId[2] << 16)
| (gSaveBlock2Ptr->playerTrainerId[3] << 24);
sRecordedBattle_Players[0].gender = gSaveBlock2Ptr->playerGender;
sRecordedBattle_Players[0].battlerId = 0;
sRecordedBattle_Players[0].language = gGameLanguage;
sPlayers[0].gender = gSaveBlock2Ptr->playerGender;
sPlayers[0].battlerId = 0;
sPlayers[0].language = gGameLanguage;
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
sRecordedBattle_Players[0].name[i] = gSaveBlock2Ptr->playerName[i];
sPlayers[0].name[i] = gSaveBlock2Ptr->playerName[i];
}
}
@ -214,7 +214,7 @@ void RecordedBattle_ClearBattlerAction(u8 battlerId, u8 bytesToClear)
u8 RecordedBattle_GetBattlerAction(u8 battlerId)
{
// trying to read past array or invalid action byte, battle is over
// Trying to read past array or invalid action byte, battle is over.
if (sRecordedBytesNo[battlerId] >= BATTLER_RECORD_SIZE || sBattleRecords[battlerId][sRecordedBytesNo[battlerId]] == 0xFF)
{
gSpecialVar_Result = gBattleOutcome = B_OUTCOME_PLAYER_TELEPORTED; // hah
@ -345,37 +345,37 @@ u32 MoveRecordedBattleToSaveData(void)
{
for (j = 0; j < PLAYER_NAME_LENGTH; j++)
{
battleSave->playersName[i][j] = sRecordedBattle_Players[i].name[j];
battleSave->playersName[i][j] = sPlayers[i].name[j];
}
battleSave->playersGender[i] = sRecordedBattle_Players[i].gender;
battleSave->playersLanguage[i] = sRecordedBattle_Players[i].language;
battleSave->playersBattlers[i] = sRecordedBattle_Players[i].battlerId;
battleSave->playersTrainerId[i] = sRecordedBattle_Players[i].trainerId;
battleSave->playersGender[i] = sPlayers[i].gender;
battleSave->playersLanguage[i] = sPlayers[i].language;
battleSave->playersBattlers[i] = sPlayers[i].battlerId;
battleSave->playersTrainerId[i] = sPlayers[i].trainerId;
}
battleSave->rngSeed = gRecordedBattleRngSeed;
if (sRecordedBattle_BattleFlags & BATTLE_TYPE_LINK)
if (sBattleFlags & BATTLE_TYPE_LINK)
{
battleSave->battleFlags = (sRecordedBattle_BattleFlags & ~(BATTLE_TYPE_LINK | BATTLE_TYPE_20));
battleSave->battleFlags = (sBattleFlags & ~(BATTLE_TYPE_LINK | BATTLE_TYPE_20));
battleSave->battleFlags |= BATTLE_TYPE_x2000000;
if (sRecordedBattle_BattleFlags & BATTLE_TYPE_WILD)
if (sBattleFlags & BATTLE_TYPE_WILD)
{
battleSave->battleFlags |= BATTLE_TYPE_x80000000;
}
else if (sRecordedBattle_BattleFlags & BATTLE_TYPE_MULTI)
else if (sBattleFlags & BATTLE_TYPE_MULTI)
{
switch (sRecordedBattle_Players[0].battlerId)
switch (sPlayers[0].battlerId)
{
case 0:
case 2:
if (!(sRecordedBattle_Players[gUnknown_0203C7B4].battlerId & 1))
if (!(sPlayers[gUnknown_0203C7B4].battlerId & 1))
battleSave->battleFlags |= BATTLE_TYPE_x80000000;
break;
case 1:
case 3:
if ((sRecordedBattle_Players[gUnknown_0203C7B4].battlerId & 1))
if ((sPlayers[gUnknown_0203C7B4].battlerId & 1))
battleSave->battleFlags |= BATTLE_TYPE_x80000000;
break;
}
@ -383,19 +383,19 @@ u32 MoveRecordedBattleToSaveData(void)
}
else
{
battleSave->battleFlags = sRecordedBattle_BattleFlags;
battleSave->battleFlags = sBattleFlags;
}
battleSave->opponentA = gTrainerBattleOpponent_A;
battleSave->opponentB = gTrainerBattleOpponent_B;
battleSave->partnerId = gPartnerTrainerId;
battleSave->field_4FA = gUnknown_0203C7B4;
battleSave->field_4FC = gSaveBlock2Ptr->frontier.field_CA9_b;
battleSave->field_4FD = sUnknown_0203C7AE;
battleSave->field_4FC = gSaveBlock2Ptr->field_CA9_b;
battleSave->field_4FD = sFrontierFacility;
battleSave->field_4FE = sUnknown_0203C7AF;
battleSave->battleStyle = gSaveBlock2Ptr->optionsBattleStyle;
battleSave->textSpeed = gSaveBlock2Ptr->optionsTextSpeed;
battleSave->AI_scripts = sRecordedBattle_AI_Scripts;
battleSave->AI_scripts = sAI_Scripts;
/* Can't match it without proper knowledge of the Saveblock 2.
if (gTrainerBattleOpponent_A >= 300 && gTrainerBattleOpponent_A <= 399)
@ -525,7 +525,7 @@ _0818535E:\n\
lsls r3, 3\n\
adds r3, r7, r3\n\
str r3, [sp, 0x8]\n\
ldr r5, =sRecordedBattle_Players\n\
ldr r5, =sPlayers\n\
mov r8, r6\n\
mov r12, r6\n\
movs r4, 0x96\n\
@ -536,7 +536,7 @@ _0818535E:\n\
adds r4, r7, r0\n\
_081853AC:\n\
lsls r1, r6, 3\n\
ldr r0, =sRecordedBattle_Players\n\
ldr r0, =sPlayers\n\
adds r0, 0x4\n\
mov r3, r8\n\
adds r2, r3, r0\n\
@ -578,7 +578,7 @@ _081853BA:\n\
ldr r5, =gRecordedBattleRngSeed\n\
ldr r0, [r5]\n\
str r0, [r1]\n\
ldr r0, =sRecordedBattle_BattleFlags\n\
ldr r0, =sBattleFlags\n\
ldr r2, [r0]\n\
movs r0, 0x2\n\
ands r0, r2\n\
@ -608,7 +608,7 @@ _08185454:\n\
ands r2, r0\n\
cmp r2, 0\n\
beq _081854E2\n\
ldr r2, =sRecordedBattle_Players\n\
ldr r2, =sPlayers\n\
ldrh r0, [r2, 0xE]\n\
cmp r0, 0x1\n\
beq _081854A8\n\
@ -630,7 +630,7 @@ _0818547E:\n\
lsls r0, r1, 2\n\
adds r0, r1\n\
lsls r0, 2\n\
ldr r4, =sRecordedBattle_Players\n\
ldr r4, =sPlayers\n\
adds r0, r4\n\
ldrh r1, [r0, 0xE]\n\
movs r0, 0x1\n\
@ -647,7 +647,7 @@ _081854A8:\n\
lsls r0, r1, 2\n\
adds r0, r1\n\
lsls r0, 2\n\
ldr r1, =sRecordedBattle_Players\n\
ldr r1, =sPlayers\n\
adds r0, r1\n\
ldrh r1, [r0, 0xE]\n\
movs r0, 0x1\n\
@ -700,7 +700,7 @@ _081854E2:\n\
ldr r5, =0x000004fc\n\
adds r1, r7, r5\n\
strb r0, [r1]\n\
ldr r0, =sUnknown_0203C7AE\n\
ldr r0, =sFrontierFacility\n\
ldrb r1, [r0]\n\
adds r2, 0x3\n\
adds r0, r7, r2\n\
@ -735,7 +735,7 @@ _081854E2:\n\
movs r2, 0xA0\n\
lsls r2, 3\n\
adds r1, r7, r2\n\
ldr r3, =sRecordedBattle_AI_Scripts\n\
ldr r3, =sAI_Scripts\n\
ldr r0, [r3]\n\
str r0, [r1]\n\
ldr r4, =0xfffffed4\n\
@ -1354,11 +1354,11 @@ static void SetRecordedBattleVarsFromSave(struct RecordedBattleSave *src)
gPartnerTrainerId = src->partnerId;
gUnknown_0203C7B4 = src->field_4FA;
sUnknown_0203C7AD = gSaveBlock2Ptr->frontier.chosenLvl;
sUnknown_0203C7AE = src->field_4FD;
sFrontierFacility = src->field_4FD;
sUnknown_0203C7AF = src->field_4FE;
sRecordedBattle_BattleStyle = src->battleStyle;
sRecordedBattle_TextSpeed = src->textSpeed;
sRecordedBattle_AI_Scripts = src->AI_scripts;
sBattleStyle = src->battleStyle;
sTextSpeed = src->textSpeed;
sAI_Scripts = src->AI_scripts;
for (i = 0; i < 8; i++)
{
@ -1415,9 +1415,9 @@ static void CB2_RecordedBattle(void)
RunTasks();
}
u8 sub_8185EA0(void)
u8 GetRecordedBattleFrontierFacility(void)
{
return sUnknown_0203C7AE;
return sFrontierFacility;
}
u8 sub_8185EAC(void)
@ -1480,12 +1480,12 @@ u8 sub_8185FAC(void)
u8 GetBattleStyleInRecordedBattle(void)
{
return sRecordedBattle_BattleStyle;
return sBattleStyle;
}
u8 GetTextSpeedInRecordedBattle(void)
{
return sRecordedBattle_TextSpeed;
return sTextSpeed;
}
void RecordedBattle_CopyBattlerMoves(void)
@ -1501,7 +1501,7 @@ void RecordedBattle_CopyBattlerMoves(void)
for (i = 0; i < 4; i++)
{
sRecordedBattle_PlayerMonMoves[gActiveBattler / 2][i] = gBattleMons[gActiveBattler].moves[i];
sPlayerMonMoves[gActiveBattler / 2][i] = gBattleMons[gActiveBattler].moves[i];
}
}
@ -1522,7 +1522,7 @@ void sub_818603C(u8 arg0)
{
for (j = 0; j < 4; j++)
{
if (gBattleMons[battlerId].moves[j] != sRecordedBattle_PlayerMonMoves[battlerId / 2][j])
if (gBattleMons[battlerId].moves[j] != sPlayerMonMoves[battlerId / 2][j])
break;
}
if (j != 4) // player's mon's move has been changed
@ -1532,7 +1532,7 @@ void sub_818603C(u8 arg0)
{
for (k = 0; k < 4; k++)
{
if (gBattleMons[battlerId].moves[j] == sRecordedBattle_PlayerMonMoves[battlerId / 2][k])
if (gBattleMons[battlerId].moves[j] == sPlayerMonMoves[battlerId / 2][k])
{
RecordedBattle_SetBattlerAction(battlerId, k);
break;
@ -1612,7 +1612,7 @@ void sub_818603C(u8 arg0)
u32 GetAiScriptsInRecordedBattle(void)
{
return sRecordedBattle_AI_Scripts;
return sAI_Scripts;
}
void sub_8186444(void)

View File

@ -11,6 +11,7 @@
#include "link.h"
#include "sprite.h"
#include "constants/species.h"
#include "constants/trainers.h"
#include "battle_interface.h"
#include "battle_anim.h"
#include "data2.h"
@ -26,8 +27,7 @@ extern u16 gBattle_BG3_Y;
extern const union AnimCmd * const * const gMonAnimationsSpriteAnimsPtrTable[];
extern void sub_806A068(u16 species, u8 battlerPosition);
extern void sub_806A12C(u16 backPicId, u8 battlerPosition);
extern void SetMultiuseSpriteTemplateToTrainerBack(u16 backPicId, u8 battlerPosition);
// this file's functions
static void CB2_ReshowBattleScreenAfterMenu(void);
@ -58,7 +58,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void)
{
case 0:
ScanlineEffect_Clear();
sub_8035658();
BattleInitBgsAndWindows();
SetBgAttribute(1, BG_CTRL_ATTR_VISIBLE, 0);
SetBgAttribute(2, BG_CTRL_ATTR_VISIBLE, 0);
ShowBg(0);
@ -144,20 +144,20 @@ static void CB2_ReshowBattleScreenAfterMenu(void)
break;
case 19:
{
u8 opponentBank;
u8 opponentBattler;
u16 species;
LoadAndCreateEnemyShadowSprites();
opponentBank = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[opponentBank]], MON_DATA_SPECIES);
SetBattlerShadowSpriteCallback(opponentBank, species);
opponentBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[opponentBattler]], MON_DATA_SPECIES);
SetBattlerShadowSpriteCallback(opponentBattler, species);
if (IsDoubleBattle())
{
opponentBank = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[opponentBank]], MON_DATA_SPECIES);
SetBattlerShadowSpriteCallback(opponentBank, species);
opponentBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[opponentBattler]], MON_DATA_SPECIES);
SetBattlerShadowSpriteCallback(opponentBattler, species);
}
ActionSelectionCreateCursorAt(gActionSelectionCursor[gBattlerInMenuId], 0);
@ -204,10 +204,10 @@ static bool8 LoadBattlerSpriteGfx(u8 battler)
else
BattleLoadSubstituteOrMonSpriteGfx(battler, FALSE);
}
else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && battler == 0)
else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && battler == B_POSITION_PLAYER_LEFT) // Should be checking position, not battler.
DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, battler);
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && battler == 0)
DecompressTrainerBackPic(BACK_PIC_WALLY, battler);
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && battler == B_POSITION_PLAYER_LEFT) // Should be checking position, not battler.
DecompressTrainerBackPic(TRAINER_BACK_PIC_WALLY, battler);
else if (!gBattleSpritesDataPtr->battlerData[battler].behindSubstitute)
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battler]], battler);
else
@ -234,8 +234,8 @@ static void CreateBattlerSprite(u8 battler)
if (GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_HP) == 0)
return;
sub_806A068(GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler));
gBattlerSpriteIds[battler] = CreateSprite(&gUnknown_0202499C, GetBattlerSpriteCoord(battler, 2), posY, sub_80A82E4(battler));
SetMultiuseSpriteTemplateToPokemon(GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler));
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battler, 2), posY, sub_80A82E4(battler));
gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler;
gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy;
gSprites[gBattlerSpriteIds[battler]].data[0] = battler;
@ -245,21 +245,21 @@ static void CreateBattlerSprite(u8 battler)
if (gBattleSpritesDataPtr->battlerData[battler].transformSpecies == SPECIES_CASTFORM)
gSprites[gBattlerSpriteIds[battler]].anims = gMonAnimationsSpriteAnimsPtrTable[SPECIES_CASTFORM];
}
else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && battler == 0)
else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && battler == B_POSITION_PLAYER_LEFT)
{
sub_806A12C(gSaveBlock2Ptr->playerGender, GetBattlerPosition(B_POSITION_PLAYER_LEFT));
gBattlerSpriteIds[battler] = CreateSprite(&gUnknown_0202499C, 0x50,
SetMultiuseSpriteTemplateToTrainerBack(gSaveBlock2Ptr->playerGender, GetBattlerPosition(B_POSITION_PLAYER_LEFT));
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, 0x50,
(8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80,
sub_80A82E4(0));
gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler;
gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy;
gSprites[gBattlerSpriteIds[battler]].data[0] = battler;
}
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && battler == 0)
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && battler == B_POSITION_PLAYER_LEFT)
{
sub_806A12C(BACK_PIC_WALLY, GetBattlerPosition(0));
gBattlerSpriteIds[battler] = CreateSprite(&gUnknown_0202499C, 0x50,
(8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords) * 4 + 80,
SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(0));
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, 0x50,
(8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].coords) * 4 + 80,
sub_80A82E4(0));
gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler;
gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy;
@ -270,8 +270,8 @@ static void CreateBattlerSprite(u8 battler)
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_HP) == 0)
return;
sub_806A068(GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler));
gBattlerSpriteIds[battler] = CreateSprite(&gUnknown_0202499C, GetBattlerSpriteCoord(battler, 2), posY, sub_80A82E4(battler));
SetMultiuseSpriteTemplateToPokemon(GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler));
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battler, 2), posY, sub_80A82E4(battler));
gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler;
gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy;
gSprites[gBattlerSpriteIds[battler]].data[0] = battler;
@ -292,9 +292,9 @@ static void CreateHealthboxSprite(u8 battler)
{
u8 healthboxSpriteId;
if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && battler == 0)
if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && battler == B_POSITION_PLAYER_LEFT)
healthboxSpriteId = CreateSafariPlayerHealthboxSprites();
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && battler == 0)
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && battler == B_POSITION_PLAYER_LEFT)
return;
else
healthboxSpriteId = CreateBattlerHealthboxSprites(battler);

View File

@ -42,7 +42,7 @@ extern void PlayerGetDestCoords(s16* x, s16* y);
EWRAM_DATA u8 gNumSafariBalls = 0;
EWRAM_DATA static u16 sSafariZoneStepCounter = 0;
EWRAM_DATA static u8 sSafariZoneCaughtMons = 0;
EWRAM_DATA static u8 sSafariZoneFleedMons = 0;
EWRAM_DATA static u8 sSafariZonePkblkUses = 0;
EWRAM_DATA static struct PokeblockFeeder sPokeblockFeeders[NUM_POKEBLOCK_FEEDERS] = {0};
static void ClearAllPokeblockFeeders(void);
@ -71,12 +71,12 @@ void EnterSafariMode(void)
gNumSafariBalls = 30;
sSafariZoneStepCounter = 500;
sSafariZoneCaughtMons = 0;
sSafariZoneFleedMons = 0;
sSafariZonePkblkUses = 0;
}
void ExitSafariMode(void)
{
sub_80EE44C(sSafariZoneCaughtMons, sSafariZoneFleedMons);
sub_80EE44C(sSafariZoneCaughtMons, sSafariZonePkblkUses);
ResetSafariZoneFlag();
ClearAllPokeblockFeeders();
gNumSafariBalls = 0;
@ -107,7 +107,7 @@ void SafariZoneRetirePrompt(void)
void CB2_EndSafariBattle(void)
{
sSafariZoneFleedMons += gBattleResults.field_1F;
sSafariZonePkblkUses += gBattleResults.pokeblockThrows;
if (gBattleOutcome == B_OUTCOME_CAUGHT)
sSafariZoneCaughtMons++;
if (gNumSafariBalls != 0)
@ -172,7 +172,7 @@ void GetPokeblockFeederWithinRange(void)
{
if (gSaveBlock1Ptr->location.mapNum == sPokeblockFeeders[i].mapNum)
{
//Get absolute value of x and y distance from Pokeblock feeder on current map
// Get absolute value of x and y distance from Pokeblock feeder on current map.
x -= sPokeblockFeeders[i].x;
y -= sPokeblockFeeders[i].y;
if (x < 0)

View File

@ -1208,7 +1208,7 @@ static bool32 sub_80A03E4(u8 *par1)
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sUnknown_085105A8, ARRAY_COUNT(sUnknown_085105A8));
InitWindows(sUnknown_085105AC);
box_border_load_tiles_and_pal(0, 8, 224);
LoadUserWindowBorderGfx_(0, 8, 224);
sub_81978B0(240);
break;
case 3:

View File

@ -9,6 +9,7 @@
#include "main.h"
#include "window.h"
#include "text.h"
#include "text_window.h"
#include "decompress.h"
#include "menu.h"
#include "sound.h"
@ -18,6 +19,7 @@
#include "data2.h"
#include "international_string_util.h"
#include "trig.h"
#include "scanline_effect.h"
#define STARTER_MON_COUNT 3
@ -46,13 +48,10 @@ extern const u8 gStarterChoose_LabelCoords[][2];
extern const u8 gUnknown_085B1E0C[];
extern const u8 gUnknown_085B1E28[][2];
extern void LoadUserWindowBorderGfx(u8, u16, u8);
extern void ScanlineEffect_Stop(void);
extern void clear_scheduled_bg_copies_to_vram(void);
extern void dp13_810BB8C(void);
extern void do_scheduled_bg_tilemap_copies_to_vram(void);
extern u16 sub_818D820(u16);
extern const u16 *GetOverworldTextboxPalettePtr(void);
extern u8 sub_818D3E4(u16 species, u32 trainerId, u32 personality, u8 flags, s16 x, s16 y, u8, u16);
// this file's functions

View File

@ -91,13 +91,13 @@ const struct TilesPal *GetWindowFrameTilesPal(u8 id)
return &sWindowFrames[id];
}
void copy_textbox_border_tile_patterns_to_vram(u8 windowId, u16 destOffset, u8 palOffset)
void LoadMessageBoxGfx(u8 windowId, u16 destOffset, u8 palOffset)
{
LoadBgTiles(GetWindowAttribute(windowId, WINDOW_PRIORITY), gMessageBox_Gfx, 0x1C0, destOffset);
LoadPalette(GetOverworldTextboxPalettePtr(), palOffset, 0x20);
}
void box_border_load_tiles_and_pal(u8 windowId, u16 destOffset, u8 palOffset)
void LoadUserWindowBorderGfx_(u8 windowId, u16 destOffset, u8 palOffset)
{
LoadUserWindowBorderGfx(windowId, destOffset, palOffset);
}

View File

@ -174,9 +174,7 @@ gBattle_WIN1H: @ 2022E28
gBattle_WIN1V: @ 2022E2A
.space 0x2
.include "src/battle_message.o"
.include "src/battle_main.o"
.include "src/pokemon.o"
.include "src/random.o"
.include "src/daycare.o"
@ -288,9 +286,6 @@ gUnknown_02038BC6: @ 2038BC6
.include "src/field_effect.o"
.include "src/scanline_effect.o"
.include "src/option_menu.o"
.align 2
.include "src/pokedex.o"
gTrainerCards: @ 2039B58
@ -681,12 +676,7 @@ gUnknown_0203AB98: @ 203AB98
.include "src/coins.o"
.include "src/battle_transition.o"
gBattlerAbilities: @ 203ABA4
.space 0x4
gStringInfo: @ 203ABA8
.space 0x4
.include "src/battle_message.o"
gUnknown_0203ABAC: @ 203ABAC
.space 0x4
@ -737,10 +727,6 @@ gUnknown_0203BC8C: @ 203BC8C
.include "src/player_pc.o"
.include "src/intro.o"
.include "src/field_region_map.o"
gUnknown_0203BCD4: @ 203BCD4
.space 0x4
.include "src/hall_of_fame.o"
.include "src/credits.o"
.include "src/lottery_corner.o"
@ -748,10 +734,7 @@ gUnknown_0203BCD4: @ 203BCD4
.include "src/berry_tag_screen.o"
.include "src/mystery_event_menu.o"
.include "src/save_failed_screen.o"
gBraillePuzzleCallbackFlag: @ 203BD14
.space 0x4
.include "src/braille_puzzles.o"
.include "src/pokeblock_feed.o"
.include "src/intro_credits_graphics.o"
.include "src/recorded_battle.o"