summaryrefslogtreecommitdiff
path: root/engine/battle
diff options
context:
space:
mode:
authorRemy Oukaour <remy.oukaour@gmail.com>2018-01-14 22:56:36 -0500
committerRemy Oukaour <remy.oukaour@gmail.com>2018-01-14 22:56:36 -0500
commit5c28d05bb40b47f084a34eb732da92c899e18db6 (patch)
treeb7e427bbb988bfdc51e347a87f6ab663c1f45a7b /engine/battle
parent8e1e583640fcb82cb8d6327a0174a892b4ba0ad2 (diff)
parent2c789b64b1bfa9ec33d805d06ad3a7141e3871f1 (diff)
Merge branch 'master' of https://github.com/xCrystal/pokecrystal (resolve PR #459)
# Conflicts: # data/items/descriptions.asm # data/sprite_anims/framesets.asm # engine/crystal_colors.asm # engine/events/kurt.asm # engine/events/special.asm # engine/events/std_scripts.asm # engine/events_3.asm # engine/item_effects.asm # engine/namingscreen.asm # engine/scripting.asm # engine/stats_screen.asm # engine/trade_animation.asm # home/audio.asm # main.asm # maps/BattleTower1F.asm # maps/BattleTowerBattleRoom.asm # maps/BurnedTowerB1F.asm # maps/ElmsLab.asm # maps/GoldenrodDeptStore5F.asm # maps/GoldenrodUnderground.asm # maps/HallOfFame.asm # maps/MahoganyTown.asm # maps/ManiasHouse.asm # maps/MobileBattleRoom.asm # maps/MobileTradeRoomMobile.asm # maps/RadioTower2F.asm # maps/Route35NationalParkGate.asm # maps/Route36NationalParkGate.asm # maps/Route39Farmhouse.asm # tilesets/palette_maps.asm
Diffstat (limited to 'engine/battle')
-rw-r--r--engine/battle/ai/items.asm4
-rwxr-xr-xengine/battle/ai/move.asm2
-rw-r--r--engine/battle/ai/scoring.asm2
-rwxr-xr-xengine/battle/ai/switch.asm16
-rwxr-xr-xengine/battle/anim_hp_bar.asm10
-rw-r--r--engine/battle/battle_transition.asm9
-rw-r--r--engine/battle/core.asm187
-rw-r--r--engine/battle/effect_commands.asm46
-rwxr-xr-xengine/battle/effect_commands/attract.asm4
-rw-r--r--engine/battle/misc.asm2
-rwxr-xr-xengine/battle/read_trainer_party.asm8
-rw-r--r--engine/battle/returntobattle_useball.asm4
-rw-r--r--engine/battle/start_battle.asm2
13 files changed, 146 insertions, 150 deletions
diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm
index d0867fb33..5bdc070ec 100644
--- a/engine/battle/ai/items.asm
+++ b/engine/battle/ai/items.asm
@@ -545,7 +545,7 @@ AI_Items: ; 39196
AIUpdateHUD: ; 38387
call UpdateEnemyMonInParty
- farcall UpdateEnemyHUD
+ farcall Predef_UpdateEnemyHUD
ld a, $1
ld [hBGMapMode], a
ld hl, wEnemyItemState
@@ -664,7 +664,7 @@ EnemyPotionFinish: ; 38436
xor a
ld [wWhichHPBar], a
call AIUsedItemSound
- predef AnimateHPBar
+ predef Predef_AnimateHPBar
jp AIUpdateHUD
diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm
index 72ed6983b..d04fb9930 100755
--- a/engine/battle/ai/move.asm
+++ b/engine/battle/ai/move.asm
@@ -92,7 +92,7 @@ AIChooseMove: ; 440ce
push bc
ld d, BANK(TrainerClassAttributes)
- predef FlagPredef
+ predef Predef_SmallFarFlagAction
ld d, c
pop bc
diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm
index 73284435a..c1d175c38 100644
--- a/engine/battle/ai/scoring.asm
+++ b/engine/battle/ai/scoring.asm
@@ -1488,7 +1488,7 @@ AI_Smart_Encore: ; 38c3b
push hl
ld a, [wEnemyMoveStruct + MOVE_TYPE]
ld hl, EnemyMonType1
- predef CheckTypeMatchup
+ predef Predef_CheckTypeMatchup
pop hl
ld a, [wd265]
diff --git a/engine/battle/ai/switch.asm b/engine/battle/ai/switch.asm
index c2f83fa1f..cb278676e 100755
--- a/engine/battle/ai/switch.asm
+++ b/engine/battle/ai/switch.asm
@@ -28,7 +28,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e
inc hl
call GetMoveByte
ld hl, EnemyMonType
- call CheckTypeMatchup
+ call Predef_CheckTypeMatchup
ld a, [wTypeMatchup]
cp 10 + 1 ; 1.0 + 0.1
jr nc, .super_effective
@@ -73,7 +73,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e
ld a, [BattleMonType1]
ld b, a
ld hl, EnemyMonType1
- call CheckTypeMatchup
+ call Predef_CheckTypeMatchup
ld a, [wTypeMatchup]
cp 10 + 1 ; 1.0 + 0.1
jr c, .ok
@@ -82,7 +82,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e
ld a, [BattleMonType2]
cp b
jr z, .ok2
- call CheckTypeMatchup
+ call Predef_CheckTypeMatchup
ld a, [wTypeMatchup]
cp 10 + 1 ; 1.0 + 0.1
jr c, .ok2
@@ -123,7 +123,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e
inc hl
call GetMoveByte
ld hl, BattleMonType1
- call CheckTypeMatchup
+ call Predef_CheckTypeMatchup
ld a, [wTypeMatchup]
; immune
@@ -390,7 +390,7 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a
inc hl
call GetMoveByte
ld hl, BaseType
- call CheckTypeMatchup
+ call Predef_CheckTypeMatchup
ld a, [wTypeMatchup]
and a
jr nz, .next
@@ -481,7 +481,7 @@ FindEnemyMonsWithASuperEffectiveMove: ; 34aa7
inc hl
call GetMoveByte
ld hl, BattleMonType1
- call CheckTypeMatchup
+ call Predef_CheckTypeMatchup
; if immune or not very effective: continue
ld a, [wTypeMatchup]
@@ -585,7 +585,7 @@ FindEnemyMonsThatResistPlayer: ; 34b20
.skip_move
ld a, [BattleMonType1]
ld hl, BaseType
- call CheckTypeMatchup
+ call Predef_CheckTypeMatchup
ld a, [wTypeMatchup]
cp 10 + 1
jr nc, .dont_choose_mon
@@ -593,7 +593,7 @@ FindEnemyMonsThatResistPlayer: ; 34b20
.check_type
ld hl, BaseType
- call CheckTypeMatchup
+ call Predef_CheckTypeMatchup
ld a, [wTypeMatchup]
cp 10 + 1
jr nc, .dont_choose_mon
diff --git a/engine/battle/anim_hp_bar.asm b/engine/battle/anim_hp_bar.asm
index 71276d27e..d67a46a70 100755
--- a/engine/battle/anim_hp_bar.asm
+++ b/engine/battle/anim_hp_bar.asm
@@ -67,7 +67,7 @@ _AnimateHPBar: ; d627
ld a, [hli]
ld b, a
pop hl
- call ComputeHPBarPixels
+ call Predef_ComputeHPBarPixels
ld a, e
ld [wCurHPBarPixels], a
@@ -79,7 +79,7 @@ _AnimateHPBar: ; d627
ld e, a
ld a, [wCurHPAnimMaxHP + 1]
ld d, a
- call ComputeHPBarPixels
+ call Predef_ComputeHPBarPixels
ld a, e
ld [wNewHPBarPixels], a
@@ -183,11 +183,11 @@ LongAnim_UpdateVariables: ; d6f5
ld c, a
ld a, [hli]
ld b, a
- ; This routine is buggy. The result from ComputeHPBarPixels is stored
+ ; This routine is buggy. The result from Predef_ComputeHPBarPixels is stored
; in e. However, the pop de opcode deletes this result before it is even
; used. The game then proceeds as though it never deleted that output.
; To fix, uncomment the line below.
- call ComputeHPBarPixels
+ call Predef_ComputeHPBarPixels
; ld a, e
pop bc
pop de
@@ -227,7 +227,7 @@ LongHPBarAnim_UpdateTiles: ; d749
ld e, a
ld a, [wCurHPAnimMaxHP + 1]
ld d, a
- call ComputeHPBarPixels
+ call Predef_ComputeHPBarPixels
ld c, e
ld d, HP_BAR_LENGTH
ld a, [wWhichHPBar]
diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm
index 16c9df2c1..17c9d0b6d 100644
--- a/engine/battle/battle_transition.asm
+++ b/engine/battle/battle_transition.asm
@@ -1,4 +1,4 @@
-Predef_StartBattle: ; 8c20f
+Predef_DoBattleTransition: ; 8c20f
call .InitGFX
ld a, [rBGP]
ld [wBGP], a
@@ -16,7 +16,7 @@ Predef_StartBattle: ; 8c20f
ld a, [wJumptableIndex]
bit 7, a
jr nz, .done
- call FlashyTransitionToBattle
+ call BattleTransitionJumptable
call DelayFrame
jr .loop
@@ -144,7 +144,7 @@ TrainerBattlePokeballTiles: ; 8c2f4
INCBIN "gfx/overworld/trainer_battle_pokeball_tiles.2bpp"
-FlashyTransitionToBattle: ; 8c314
+BattleTransitionJumptable: ; 8c314
jumptable .dw, wJumptableIndex
; 8c323
@@ -859,8 +859,7 @@ ENDM
ret
; 8c7c9 (23:47c9)
-Function8c7c9:
-; XXX
+Unreferenced_Function8c7c9:
ld a, $1
ld [hBGMapMode], a
call WaitBGMap
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index a604bc37a..5137da43d 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -47,7 +47,7 @@ DoBattle: ; 3c000
.player_2
call LoadTileMapToTempTileMap
- call CheckPlayerPartyForFitPkmn
+ call Predef_CheckPlayerPartyForFitPkmn
ld a, d
and a
jp z, LostBattle
@@ -160,7 +160,7 @@ WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5
BattleTurn: ; 3c12f
.loop
- call MobileFn_3c1bf
+ call Stubbed_Function3c1bf
call CheckContestBattleOver
jp c, .quit
@@ -231,7 +231,8 @@ BattleTurn: ; 3c12f
ret
; 3c1bf
-MobileFn_3c1bf: mobile
+Stubbed_Function3c1bf:
+ ret
ld a, $5
call GetSRAMBank
ld hl, $a89b ; s5_a89b
@@ -1277,7 +1278,7 @@ HandleWrap: ; 3c874
xor a
ld [wNumHits], a
ld [FXAnimID + 1], a
- predef PlayBattleAnim
+ predef Predef_PlayBattleAnim
call SwitchTurnCore
.skip_anim
@@ -1943,8 +1944,7 @@ GetMaxHP: ; 3ccac
ret
; 3ccc2
-GetHalfHP: ; 3ccc2
-; unreferenced
+Unreferenced_GetHalfHP: ; 3ccc2
ld hl, BattleMonHP
ld a, [hBattleTurn]
and a
@@ -2040,7 +2040,7 @@ UpdateHPBar: ; 3cd3c
.ok
push bc
ld [wWhichHPBar], a
- predef AnimateHPBar
+ predef Predef_AnimateHPBar
pop bc
ret
; 3cd55
@@ -2054,7 +2054,7 @@ HandleEnemyMonFaint: ; 3cd55
xor a
ld [wWhichMonFaintedFirst], a
call UpdateBattleStateAndExperienceAfterEnemyFaint
- call CheckPlayerPartyForFitPkmn
+ call Predef_CheckPlayerPartyForFitPkmn
ld a, d
and a
jp z, LostBattle
@@ -2062,7 +2062,7 @@ HandleEnemyMonFaint: ; 3cd55
ld hl, BattleMonHP
ld a, [hli]
or [hl]
- call nz, UpdatePlayerHUD
+ call nz, Predef_UpdatePlayerHUD
ld a, $1
ld [hBGMapMode], a
@@ -2186,7 +2186,7 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01
call PlayerMonFaintHappinessMod
.player_mon_did_not_faint
- call CheckPlayerPartyForFitPkmn
+ call Predef_CheckPlayerPartyForFitPkmn
ld a, d
and a
ret z
@@ -2581,7 +2581,7 @@ AddBattleMoneyToAccount: ; 3d0be
push bc
ld b, h
ld c, l
- farcall TrainerRankings_AddToBattlePayouts
+ farcall StubbedTrainerRankings_AddToBattlePayouts
pop bc
pop hl
.loop
@@ -2670,7 +2670,7 @@ HandlePlayerMonFaint: ; 3d14e
ld a, $1
ld [wWhichMonFaintedFirst], a
call PlayerMonFaintHappinessMod
- call CheckPlayerPartyForFitPkmn
+ call Predef_CheckPlayerPartyForFitPkmn
ld a, d
and a
jp z, LostBattle
@@ -2716,7 +2716,7 @@ PlayerMonFaintHappinessMod: ; 3d1aa
ld c, a
ld hl, wBattleParticipantsNotFainted
ld b, RESET_FLAG
- predef FlagPredef
+ predef Predef_SmallFarFlagAction
ld hl, EnemySubStatus3
res SUBSTATUS_IN_LOOP, [hl]
xor a
@@ -3313,10 +3313,10 @@ AddBattleParticipant: ; 3d581
ld hl, wBattleParticipantsNotFainted
ld b, SET_FLAG
push bc
- predef FlagPredef
+ predef Predef_SmallFarFlagAction
pop bc
ld hl, wBattleParticipantsIncludingFainted
- predef_jump FlagPredef
+ predef_jump Predef_SmallFarFlagAction
; 3d599
FindPkmnInOTPartyToSwitchIntoBattle: ; 3d599
@@ -3534,7 +3534,7 @@ LoadEnemyPkmnToSwitchTo: ; 3d6ca
and a
jr nz, .skip_unown
ld hl, EnemyMonDVs
- predef GetUnownLetter
+ predef Predef_GetUnownLetter
ld a, [UnownLetter]
ld [wFirstUnownSeen], a
.skip_unown
@@ -3644,8 +3644,8 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7
call GetBaseData
ld a, OTPARTYMON
ld [MonType], a
- predef CopyPkmnToTempMon
- call GetEnemyMonFrontpic
+ predef Predef_CopyPkmnToTempMon
+ call Predef_GetEnemyMonFrontpic
xor a
ld [wNumHits], a
@@ -3670,7 +3670,7 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7
hlcoord 12, 0
ld d, $0
ld e, ANIM_MON_SLOW
- predef AnimateFrontpic
+ predef Predef_AnimateFrontpic
jr .skip_cry
.cry_no_anim
@@ -3680,7 +3680,7 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7
call PlayStereoCry
.skip_cry
- call UpdateEnemyHUD
+ call Predef_UpdateEnemyHUD
ld a, $1
ld [hBGMapMode], a
ret
@@ -3721,7 +3721,7 @@ ResetEnemyStatLevels: ; 3d867
ret
; 3d873
-CheckPlayerPartyForFitPkmn: ; 3d873
+Predef_CheckPlayerPartyForFitPkmn: ; 3d873
; Has the player any Pkmn in his Party that can fight?
ld a, [PartyCount]
ld e, a
@@ -4124,7 +4124,7 @@ SwitchPlayerMon: ; 3db32
SendOutPlayerMon: ; 3db5f
ld hl, BattleMonDVs
- predef GetUnownLetter
+ predef Predef_GetUnownLetter
hlcoord 1, 5
ld b, 7
ld c, 8
@@ -4132,7 +4132,7 @@ SendOutPlayerMon: ; 3db5f
call WaitBGMap
xor a
ld [hBGMapMode], a
- call GetBattleMonBackpic
+ call Predef_GetBattleMonBackpic
xor a
ld [hGraphicStartTile], a
ld [wBattleMenuCursorBuffer], a
@@ -4172,7 +4172,7 @@ SendOutPlayerMon: ; 3db5f
call PlayStereoCry
.statused
- call UpdatePlayerHUD
+ call Predef_UpdatePlayerHUD
ld a, $1
ld [hBGMapMode], a
ret
@@ -4218,13 +4218,13 @@ BreakAttraction: ; 3dc18
SpikesDamage: ; 3dc23
ld hl, PlayerScreens
ld de, BattleMonType
- ld bc, UpdatePlayerHUD
+ ld bc, Predef_UpdatePlayerHUD
ld a, [hBattleTurn]
and a
jr z, .ok
ld hl, EnemyScreens
ld de, EnemyMonType
- ld bc, UpdateEnemyHUD
+ ld bc, Predef_UpdateEnemyHUD
.ok
bit SCREENS_SPIKES, [hl]
@@ -4306,7 +4306,7 @@ PursuitSwitch: ; 3dc5b
ld c, a
ld hl, wBattleParticipantsNotFainted
ld b, RESET_FLAG
- predef FlagPredef
+ predef Predef_SmallFarFlagAction
call PlayerMonFaintedAnimation
ld hl, BattleText_PkmnFainted
jr .done_fainted
@@ -4455,7 +4455,7 @@ HandleHPHealingItem: ; 3dd2f
.got_hp_bar_coords
ld [wWhichHPBar], a
- predef AnimateHPBar
+ predef Predef_AnimateHPBar
UseOpponentItem:
call RefreshBattleHuds
callfar GetOpponentItem
@@ -4478,7 +4478,7 @@ ItemRecoveryAnim: ; 3ddc8
xor a
ld [wNumHits], a
ld [FXAnimID + 1], a
- predef PlayBattleAnim
+ predef Predef_PlayBattleAnim
call SwitchTurnCore
pop bc
pop de
@@ -4708,7 +4708,7 @@ UpdateBattleHUDs: ; 3df2c
ret
; 3df48
-UpdatePlayerHUD:: ; 3df48
+Predef_UpdatePlayerHUD:: ; 3df48
push hl
push de
push bc
@@ -4741,7 +4741,7 @@ DrawPlayerHUD: ; 3df58
ld b, 1
xor a ; PARTYMON
ld [MonType], a
- predef DrawPlayerHP
+ predef Predef_DrawPlayerHP
; Exp bar
push de
@@ -4754,7 +4754,7 @@ DrawPlayerHUD: ; 3df58
hlcoord 10, 11
ld a, [TempMonLevel]
ld b, a
- call FillInExpBar
+ call Predef_FillInExpBar
pop de
ret
; 3df98
@@ -4823,7 +4823,7 @@ PrintPlayerHUD: ; 3dfbf
ld a, TEMPMON
ld [MonType], a
- callfar GetGender
+ callfar Predef_GetGender
ld a, " "
jr c, .got_gender_char
ld a, "♂"
@@ -4837,7 +4837,7 @@ PrintPlayerHUD: ; 3dfbf
push af ; back up gender
push hl
ld de, BattleMonStatus
- predef PlaceNonFaintStatus
+ predef Predef_PlaceNonFaintStatus
pop hl
pop bc
ret nz
@@ -4852,7 +4852,7 @@ PrintPlayerHUD: ; 3dfbf
jp PrintLevel
; 3e036
-UpdateEnemyHUD:: ; 3e036
+Predef_UpdateEnemyHUD:: ; 3e036
push hl
push de
push bc
@@ -4901,7 +4901,7 @@ DrawEnemyHUD: ; 3e043
ld a, TEMPMON
ld [MonType], a
- callfar GetGender
+ callfar Predef_GetGender
ld a, " "
jr c, .got_gender
ld a, "♂"
@@ -4916,7 +4916,7 @@ DrawEnemyHUD: ; 3e043
push af
push hl
ld de, EnemyMonStatus
- predef PlaceNonFaintStatus
+ predef Predef_PlaceNonFaintStatus
pop hl
pop bc
jr nz, .skip_level
@@ -5141,8 +5141,8 @@ BattleMenu_Pack: ; 3e1c7
call ClearPalettes
call DelayFrame
call _LoadBattleFontsHPBar
- call GetBattleMonBackpic
- call GetEnemyMonFrontpic
+ call Predef_GetBattleMonBackpic
+ call Predef_GetEnemyMonFrontpic
call ExitMenu
call WaitBGMap
call FinishBattleAnim
@@ -5174,10 +5174,10 @@ BattleMenu_Pack: ; 3e1c7
ld a, [BattleType]
cp BATTLETYPE_TUTORIAL
jr z, .tutorial2
- call GetBattleMonBackpic
+ call Predef_GetBattleMonBackpic
.tutorial2
- call GetEnemyMonFrontpic
+ call Predef_GetEnemyMonFrontpic
ld a, $1
ld [wMenuCursorY], a
call ExitMenu
@@ -5531,7 +5531,7 @@ MoveSelectionScreen: ; 3e4bc
.got_start_coord
ld a, SCREEN_WIDTH
ld [Buffer1], a
- predef ListMoves
+ predef Predef_ListMoves
ld b, 5
ld a, [wMoveSelectionMenuType]
@@ -5864,7 +5864,7 @@ MoveInfoBox: ; 3e6c8
ld a, [wPlayerMoveStruct + MOVE_ANIM]
ld b, a
hlcoord 2, 10
- predef PrintMoveType
+ predef Predef_PrintMoveType
.done
ret
@@ -6319,7 +6319,7 @@ LoadEnemyMon: ; 3e8eb
; Get letter based on DVs
ld hl, EnemyMonDVs
- predef GetUnownLetter
+ predef Predef_GetUnownLetter
; Can't use any letters that haven't been unlocked
; If combined with forced shiny battletype, causes an infinite loop
call CheckUnownLetter
@@ -6408,7 +6408,7 @@ LoadEnemyMon: ; 3e8eb
ld de, EnemyMonMaxHP
ld b, FALSE
ld hl, EnemyMonDVs - (MON_DVS - MON_STAT_EXP + 1) ; LinkBattleRNs + 7 ; ?
- predef CalcPkmnStats
+ predef Predef_CalcPkmnStats
; If we're in a trainer battle,
; get the rest of the parameters from the party struct
@@ -6523,7 +6523,7 @@ LoadEnemyMon: ; 3e8eb
; Make sure the predef knows this isn't a partymon
ld [wEvolutionOldSpecies], a
; Fill moves based on level
- predef FillMoves
+ predef Predef_FillMoves
.PP:
; Trainer battle?
@@ -6534,7 +6534,7 @@ LoadEnemyMon: ; 3e8eb
; Fill wild PP
ld hl, EnemyMonMoves
ld de, EnemyMonPP
- predef FillPP
+ predef Predef_FillPP
jr .Finish
.TrainerPP:
@@ -6587,7 +6587,7 @@ LoadEnemyMon: ; 3e8eb
ld c, a
ld b, SET_FLAG
ld hl, PokedexSeen
- predef FlagPredef
+ predef Predef_SmallFarFlagAction
ld hl, EnemyMonStats
ld de, EnemyStats
@@ -6696,8 +6696,7 @@ CheckUnownLetter: ; 3eb75
; 3ebc7
-SwapBattlerLevels: ; 3ebc7
-; unreferenced
+Unreferenced_SwapBattlerLevels: ; 3ebc7
push bc
ld a, [BattleMonLevel]
ld b, a
@@ -6716,7 +6715,7 @@ BattleWinSlideInEnemyTrainerFrontpic: ; 3ebd8
ld a, [OtherTrainerClass]
ld [TrainerClass], a
ld de, vTiles2
- callfar GetTrainerPic
+ callfar Predef_GetTrainerPic
hlcoord 19, 0
ld c, 0
@@ -7089,7 +7088,7 @@ _LoadHPBar: ; 3eda6
ret
; 3edad
-LoadHPExpBarGFX: ; unreferenced
+Unreferenced_LoadHPExpBarGFX:
ld de, EnemyHPBarBorderGFX
ld hl, vTiles2 tile $6c
lb bc, BANK(EnemyHPBarBorderGFX), 4
@@ -7193,7 +7192,7 @@ Call_PlayBattleAnim: ; 3ee17
ld a, d
ld [FXAnimID + 1], a
call WaitBGMap
- predef_jump PlayBattleAnim
+ predef_jump Predef_PlayBattleAnim
; 3ee27
FinishBattleAnim: ; 3ee27
@@ -7241,7 +7240,7 @@ GiveExperiencePoints: ; 3ee3b
ld c, a
ld b, CHECK_FLAG
ld d, $0
- predef FlagPredef
+ predef Predef_SmallFarFlagAction
ld a, c
and a
pop bc
@@ -7419,7 +7418,7 @@ GiveExperiencePoints: ; 3ee3b
.not_max_exp
xor a ; PARTYMON
ld [MonType], a
- predef CopyPkmnToTempMon
+ predef Predef_CopyPkmnToTempMon
callfar CalcLevel
pop bc
ld hl, MON_LEVEL
@@ -7456,7 +7455,7 @@ GiveExperiencePoints: ; 3ee3b
add hl, bc
push bc
ld b, TRUE
- predef CalcPkmnStats
+ predef Predef_CalcPkmnStats
pop bc
pop de
ld hl, MON_MAXHP + 1
@@ -7509,7 +7508,7 @@ GiveExperiencePoints: ; 3ee3b
call ApplyStatLevelMultiplierOnAllStats
callfar ApplyStatusEffectOnPlayerStats
callfar BadgeStatBoosts
- callfar UpdatePlayerHUD
+ callfar Predef_UpdatePlayerHUD
call EmptyBattleTextBox
call LoadTileMapToTempTileMap
ld a, $1
@@ -7532,14 +7531,14 @@ GiveExperiencePoints: ; 3ee3b
.skip_animation2
xor a ; PARTYMON
ld [MonType], a
- predef CopyPkmnToTempMon
+ predef Predef_CopyPkmnToTempMon
hlcoord 9, 0
ld b, $a
ld c, $9
call TextBox
hlcoord 11, 1
ld bc, 4
- predef PrintTempMonStats
+ predef Predef_PrintTempMonStats
ld c, $1e
call DelayFrames
call WaitPressAorB_BlinkCursor
@@ -7559,7 +7558,7 @@ GiveExperiencePoints: ; 3ee3b
ld a, b
ld [CurPartyLevel], a
push bc
- predef LearnLevelMoves
+ predef Predef_LearnLevelMoves
pop bc
ld a, b
cp c
@@ -7570,7 +7569,7 @@ GiveExperiencePoints: ; 3ee3b
ld a, [CurPartyMon]
ld c, a
ld b, SET_FLAG
- predef FlagPredef
+ predef Predef_SmallFarFlagAction
pop af
ld [CurPartyLevel], a
@@ -7692,7 +7691,7 @@ AnimateExpBar: ; 3f136
ld [wd002], a
xor a ; PARTYMON
ld [MonType], a
- predef CopyPkmnToTempMon
+ predef Predef_CopyPkmnToTempMon
ld a, [TempMonLevel]
ld b, a
ld e, a
@@ -8020,7 +8019,7 @@ TextJump_GoodComeBack: ; 3f352
db "@"
; 3f357
-UnusedFunction_TextJump_ComeBack: ; 3f357
+Unreferenced_TextJump_ComeBack: ; 3f357
; this function doesn't seem to be used
ld hl, TextJump_ComeBack
ret
@@ -8031,7 +8030,7 @@ TextJump_ComeBack: ; 3f35b
db "@"
; 3f360
-HandleSafariAngerEatingStatus: ; unreferenced
+Unreferenced_HandleSafariAngerEatingStatus:
ld hl, wSafariMonEating
ld a, [hl]
and a
@@ -8063,7 +8062,7 @@ HandleSafariAngerEatingStatus: ; unreferenced
jp StdBattleTextBox
; 3f390
-FillInExpBar: ; 3f390
+Predef_FillInExpBar: ; 3f390
push hl
call CalcExpBar
pop hl
@@ -8205,7 +8204,7 @@ PlaceExpBar: ; 3f41c
ret
; 3f43d
-GetBattleMonBackpic: ; 3f43d
+Predef_GetBattleMonBackpic: ; 3f43d
ld a, [PlayerSubStatus4]
bit SUBSTATUS_SUBSTITUTE, a
ld hl, BattleAnimCmd_RaiseSub
@@ -8221,9 +8220,9 @@ DropPlayerSub: ; 3f447
ld a, [BattleMonSpecies]
ld [CurPartySpecies], a
ld hl, BattleMonDVs
- predef GetUnownLetter
+ predef Predef_GetUnownLetter
ld de, vTiles2 tile $31
- predef GetMonBackpic
+ predef Predef_GetMonBackpic
pop af
ld [CurPartySpecies], a
ret
@@ -8241,7 +8240,7 @@ GetBattleMonBackpic_DoAnim: ; 3f46f
ret
; 3f47c
-GetEnemyMonFrontpic: ; 3f47c
+Predef_GetEnemyMonFrontpic: ; 3f47c
ld a, [EnemySubStatus4]
bit SUBSTATUS_SUBSTITUTE, a
ld hl, BattleAnimCmd_RaiseSub
@@ -8260,9 +8259,9 @@ DropEnemySub: ; 3f486
ld [CurPartySpecies], a
call GetBaseData
ld hl, EnemyMonDVs
- predef GetUnownLetter
+ predef Predef_GetUnownLetter
ld de, vTiles2
- predef GetAnimatedFrontpicPredef
+ predef Predef_GetAnimatedFrontpic
pop af
ld [CurPartySpecies], a
ret
@@ -8279,7 +8278,7 @@ GetEnemyMonFrontpic_DoAnim: ; 3f4b4
ret
; 3f4c1
-StartBattle: ; 3f4c1
+Predef_StartBattle: ; 3f4c1
; This check prevents you from entering a battle without any Pokemon.
; Those using walk-through-walls to bypass getting a Pokemon experience
; the effects of this check.
@@ -8298,14 +8297,13 @@ StartBattle: ; 3f4c1
ret
; 3f4d9
-_DoBattle: ; 3f4d9
-; unreferenced
+Unreferenced_DoBattle: ; 3f4d9
call DoBattle
ret
; 3f4dd
BattleIntro: ; 3f4dd
- farcall TrainerRankings_Battles ; mobile
+ farcall StubbedTrainerRankings_Battles ; mobile
call LoadTrainerOrWildMonPic
xor a
ld [TempBattleMonSpecies], a
@@ -8339,7 +8337,7 @@ BattleIntro: ; 3f4dd
call ClearSprites
ld a, [wBattleMode]
cp WILD_BATTLE
- call z, UpdateEnemyHUD
+ call z, Predef_UpdateEnemyHUD
ld a, $1
ld [hBGMapMode], a
ret
@@ -8390,7 +8388,7 @@ BackUpBGMap2: ; 3f568
InitEnemyTrainer: ; 3f594
ld [TrainerClass], a
- farcall TrainerRankings_TrainerBattles
+ farcall StubbedTrainerRankings_TrainerBattles
xor a
ld [TempEnemyMonSpecies], a
callfar GetTrainerAttributes
@@ -8404,14 +8402,14 @@ InitEnemyTrainer: ; 3f594
.ok
ld de, vTiles2
- callfar GetTrainerPic
+ callfar Predef_GetTrainerPic
xor a
ld [hGraphicStartTile], a
dec a
ld [wEnemyItemState], a
hlcoord 12, 0
lb bc, 7, 7
- predef PlaceGraphic
+ predef Predef_PlaceGraphic
ld a, -1
ld [CurOTMon], a
ld a, TRAINER_BATTLE
@@ -8446,7 +8444,7 @@ InitEnemyTrainer: ; 3f594
InitEnemyWildmon: ; 3f607
ld a, WILD_BATTLE
ld [wBattleMode], a
- farcall TrainerRankings_WildBattles
+ farcall StubbedTrainerRankings_WildBattles
call LoadEnemyMon
ld hl, EnemyMonMoves
ld de, wWildMonMoves
@@ -8457,7 +8455,7 @@ InitEnemyWildmon: ; 3f607
ld bc, NUM_MOVES
call CopyBytes
ld hl, EnemyMonDVs
- predef GetUnownLetter
+ predef Predef_GetUnownLetter
ld a, [CurPartySpecies]
cp UNOWN
jr nz, .skip_unown
@@ -8468,18 +8466,17 @@ InitEnemyWildmon: ; 3f607
ld [wFirstUnownSeen], a
.skip_unown
ld de, vTiles2
- predef GetAnimatedFrontpicPredef
+ predef Predef_GetAnimatedFrontpic
xor a
ld [TrainerClass], a
ld [hGraphicStartTile], a
hlcoord 12, 0
lb bc, 7, 7
- predef PlaceGraphic
+ predef Predef_PlaceGraphic
ret
; 3f662
-Function3f662: ; 3f662
-; XXX
+Unreferenced_Function3f662: ; 3f662
ld hl, EnemyMonMoves
ld de, wListMoves_MoveIndicesBuffer
ld b, NUM_MOVES
@@ -8554,7 +8551,7 @@ ExitBattle: ; 3f69e
call CheckPayDay
xor a
ld [wForceEvolution], a
- predef EvolveAfterBattle
+ predef Predef_EvolveAfterBattle
farcall GivePokerusAndConvertBerries
ret
; 3f6d0
@@ -8629,7 +8626,7 @@ CheckPayDay: ; 3f71d
; 3f759
ShowLinkBattleParticipantsAfterEnd: ; 3f759
- farcall TrainerRankings_LinkBattles
+ farcall StubbedTrainerRankings_LinkBattles
farcall BackupMobileEventIndex
ld a, [CurOTMon]
ld hl, OTPartyMon1Status
@@ -8659,17 +8656,17 @@ DisplayLinkBattleResult: ; 3f77c
cp $1
jr c, .victory
jr z, .loss
- farcall TrainerRankings_ColosseumDraws
+ farcall StubbedTrainerRankings_ColosseumDraws
ld de, .Draw
jr .store_result
.victory
- farcall TrainerRankings_ColosseumWins
+ farcall StubbedTrainerRankings_ColosseumWins
ld de, .Win
jr .store_result
.loss
- farcall TrainerRankings_ColosseumLosses
+ farcall StubbedTrainerRankings_ColosseumLosses
ld de, .Lose
jr .store_result
@@ -9228,7 +9225,7 @@ InitBattleDisplay: ; 3fb6c
ld [hGraphicStartTile], a
hlcoord 2, 6
lb bc, 6, 6
- predef PlaceGraphic
+ predef Predef_PlaceGraphic
xor a
ld [hWY], a
ld [rWY], a
@@ -9301,7 +9298,7 @@ GetTrainerBackpic: ; 3fbff
.Decompress:
ld de, vTiles2 tile $31
ld c, $31
- predef DecompressPredef
+ predef Predef_Decompress
ret
; 3fc30
@@ -9323,7 +9320,7 @@ CopyBackpic: ; 3fc30
ld [hGraphicStartTile], a
hlcoord 2, 6
lb bc, 6, 6
- predef PlaceGraphic
+ predef Predef_PlaceGraphic
ret
; 3fc5b
@@ -9403,7 +9400,7 @@ BattleStartMessage: ; 3fc8b
hlcoord 12, 0
ld d, $0
ld e, ANIM_MON_NORMAL
- predef AnimateFrontpic
+ predef Predef_AnimateFrontpic
jr .skip_cry ; cry is played during the animation
.cry_no_anim
@@ -9417,7 +9414,7 @@ BattleStartMessage: ; 3fc8b
cp BATTLETYPE_FISH
jr nz, .NotFishing
- farcall TrainerRankings_HookedEncounters
+ farcall StubbedTrainerRankings_HookedEncounters
ld hl, HookedPokemonAttackedText
jr .PlaceBattleStartText
diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm
index 68184ce30..c46ded638 100644
--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -182,7 +182,7 @@ CheckPlayerTurn:
call StdBattleTextBox
call CantMove
call UpdateBattleMonInParty
- ld hl, UpdatePlayerHUD
+ ld hl, Predef_UpdatePlayerHUD
call CallBattleCore
ld a, $1
ld [hBGMapMode], a
@@ -433,7 +433,7 @@ CheckEnemyTurn: ; 3421f
call StdBattleTextBox
call CantMove
call UpdateEnemyMonInParty
- ld hl, UpdateEnemyHUD
+ ld hl, Predef_UpdateEnemyHUD
call CallBattleCore
ld a, $1
ld [hBGMapMode], a
@@ -672,7 +672,7 @@ HitConfusion: ; 343a5
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
call z, PlayFXAnimID
- ld hl, UpdatePlayerHUD
+ ld hl, Predef_UpdatePlayerHUD
call CallBattleCore
ld a, $1
ld [hBGMapMode], a
@@ -1538,12 +1538,12 @@ BattleCheckTypeMatchup: ; 347c8
ld hl, EnemyMonType1
ld a, [hBattleTurn]
and a
- jr z, CheckTypeMatchup
+ jr z, Predef_CheckTypeMatchup
ld hl, BattleMonType1
-CheckTypeMatchup: ; 347d3
+Predef_CheckTypeMatchup: ; 347d3
; There is an incorrect assumption about this function made in the AI related code: when
-; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing the
-; offensive type in a will make this function do the right thing. Since a is overwritten,
+; the AI calls Predef_CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing
+; the offensive type in a will make this function do the right thing. Since a is overwritten,
; this assumption is incorrect. A simple fix would be to load the move type for the
; current move into a in BattleCheckTypeMatchup, before falling through, which is
; consistent with how the rest of the code assumes this code works like.
@@ -2621,7 +2621,7 @@ BattleCommand_CheckDestinyBond: ; 351c0
ld [Buffer6], a
ld h, b
ld l, c
- predef AnimateHPBar
+ predef Predef_AnimateHPBar
call RefreshBattleHuds
call BattleCommand_SwitchTurn
@@ -4015,7 +4015,7 @@ BattleCommand_PainSplit: ; 35926
ld a, $1
ld [wWhichHPBar], a
hlcoord 10, 9
- predef AnimateHPBar
+ predef Predef_AnimateHPBar
ld hl, EnemyMonHP
ld a, [hli]
ld [Buffer4], a
@@ -4030,7 +4030,7 @@ BattleCommand_PainSplit: ; 35926
ld [wWhichHPBar], a
call ResetDamage
hlcoord 2, 2
- predef AnimateHPBar
+ predef Predef_AnimateHPBar
farcall _UpdateBattleHUDs
ld hl, SharedPainText
@@ -4172,7 +4172,7 @@ BattleCommand_Conversion2: ; 359e6
ld a, [hl]
ld [wNamedObjectIndexBuffer], a
- predef GetTypeName
+ predef Predef_GetTypeName
ld hl, TransformedTypeText
jp StdBattleTextBox
@@ -4711,7 +4711,7 @@ PlayFXAnimID: ; 35d08
ld c, 3
call DelayFrames
- callfar PlayBattleAnim
+ callfar Predef_PlayBattleAnim
ret
@@ -4773,7 +4773,7 @@ EnemyHurtItself: ; 35d1c
hlcoord 2, 2
xor a
ld [wWhichHPBar], a
- predef AnimateHPBar
+ predef Predef_AnimateHPBar
.did_no_damage
jp RefreshBattleHuds
@@ -4833,7 +4833,7 @@ PlayerHurtItself: ; 35d7e
hlcoord 10, 9
ld a, $1
ld [wWhichHPBar], a
- predef AnimateHPBar
+ predef Predef_AnimateHPBar
.did_no_damage
jp RefreshBattleHuds
@@ -5301,7 +5301,7 @@ SapHealth: ; 36011
xor a
.hp_bar
ld [wWhichHPBar], a
- predef AnimateHPBar
+ predef Predef_AnimateHPBar
call RefreshBattleHuds
jp UpdateBattleMonInParty
@@ -6239,11 +6239,11 @@ BattleCommand_Curl: ; 365a7
BattleCommand_RaiseSubNoAnim: ; 365af
- ld hl, GetBattleMonBackpic
+ ld hl, Predef_GetBattleMonBackpic
ld a, [hBattleTurn]
and a
jr z, .PlayerTurn
- ld hl, GetEnemyMonFrontpic
+ ld hl, Predef_GetEnemyMonFrontpic
.PlayerTurn:
xor a
ld [hBGMapMode], a
@@ -7525,7 +7525,7 @@ BattleCommand_Recoil: ; 36cb2
xor a
.animate_hp_bar
ld [wWhichHPBar], a
- predef AnimateHPBar
+ predef Predef_AnimateHPBar
call RefreshBattleHuds
ld hl, RecoilText
jp StdBattleTextBox
@@ -8023,7 +8023,7 @@ BattleCommand_LeechSeed: ; 36f9d
BattleCommand_Splash: ; 36fe1
call AnimateCurrentMove
- farcall TrainerRankings_Splash
+ farcall StubbedTrainerRankings_Splash
jp PrintNothingHappened
; 36fed
@@ -8227,7 +8227,7 @@ BattleCommand_Conversion: ; 3707f
inc de
ld [de], a
ld [wNamedObjectIndexBuffer], a
- farcall GetTypeName
+ farcall Predef_GetTypeName
call AnimateCurrentMove
ld hl, TransformedTypeText
jp StdBattleTextBox
@@ -8550,7 +8550,7 @@ CheckSubstituteOpp: ; 37378
BattleCommand_Selfdestruct: ; 37380
- farcall TrainerRankings_Selfdestruct
+ farcall StubbedTrainerRankings_Selfdestruct
ld a, BATTLEANIM_PLAYER_DAMAGE
ld [wNumHits], a
ld c, 3
@@ -9856,7 +9856,7 @@ PlayUserBattleAnim: ; 37e47
push hl
push de
push bc
- callfar PlayBattleAnim
+ callfar Predef_PlayBattleAnim
pop bc
pop de
pop hl
@@ -9878,7 +9878,7 @@ PlayOpponentBattleAnim: ; 37e54
push bc
call BattleCommand_SwitchTurn
- callfar PlayBattleAnim
+ callfar Predef_PlayBattleAnim
call BattleCommand_SwitchTurn
pop bc
diff --git a/engine/battle/effect_commands/attract.asm b/engine/battle/effect_commands/attract.asm
index 0a6d7c975..fc73d234c 100755
--- a/engine/battle/effect_commands/attract.asm
+++ b/engine/battle/effect_commands/attract.asm
@@ -35,7 +35,7 @@ CheckOppositeGender: ; 377f5
xor a
ld [MonType], a
- farcall GetGender
+ farcall Predef_GetGender
jr c, .genderless_samegender
ld b, 1
@@ -58,7 +58,7 @@ CheckOppositeGender: ; 377f5
ld [TempMonDVs + 1], a
ld a, 3
ld [MonType], a
- farcall GetGender
+ farcall Predef_GetGender
pop bc
jr c, .genderless_samegender
diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm
index a41d31d9a..40c472e50 100644
--- a/engine/battle/misc.asm
+++ b/engine/battle/misc.asm
@@ -33,7 +33,7 @@ AppearUser: ; fbd77 (3e:7d77)
ld a, $31
.okay
ld [hGraphicStartTile], a
- predef PlaceGraphic
+ predef Predef_PlaceGraphic
FinishAppearDisappearUser: ; fbd91 (3e:7d91)
ld a, $1
ld [hBGMapMode], a
diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm
index a09c6dd08..4f3dc8e55 100755
--- a/engine/battle/read_trainer_party.asm
+++ b/engine/battle/read_trainer_party.asm
@@ -103,7 +103,7 @@ TrainerType1: ; 397eb
ld a, OTPARTYMON
ld [MonType], a
push hl
- predef TryAddMonToParty
+ predef Predef_TryAddMonToParty
pop hl
jr .loop
; 39806
@@ -124,7 +124,7 @@ TrainerType2: ; 39806
ld [MonType], a
push hl
- predef TryAddMonToParty
+ predef Predef_TryAddMonToParty
ld a, [OTPartyCount]
dec a
ld hl, OTPartyMon1Moves
@@ -200,7 +200,7 @@ TrainerType3: ; 39871
ld a, OTPARTYMON
ld [MonType], a
push hl
- predef TryAddMonToParty
+ predef Predef_TryAddMonToParty
ld a, [OTPartyCount]
dec a
ld hl, OTPartyMon1Item
@@ -231,7 +231,7 @@ TrainerType4: ; 3989d
ld [MonType], a
push hl
- predef TryAddMonToParty
+ predef Predef_TryAddMonToParty
ld a, [OTPartyCount]
dec a
ld hl, OTPartyMon1Item
diff --git a/engine/battle/returntobattle_useball.asm b/engine/battle/returntobattle_useball.asm
index e6e33f900..4254d24f4 100644
--- a/engine/battle/returntobattle_useball.asm
+++ b/engine/battle/returntobattle_useball.asm
@@ -4,13 +4,13 @@ _ReturnToBattle_UseBall: ; 2715c
ld a, [BattleType]
cp BATTLETYPE_TUTORIAL
jr z, .gettutorialbackpic
- farcall GetBattleMonBackpic
+ farcall Predef_GetBattleMonBackpic
jr .continue
.gettutorialbackpic
farcall GetTrainerBackpic
.continue
- farcall GetEnemyMonFrontpic
+ farcall Predef_GetEnemyMonFrontpic
farcall _LoadBattleFontsHPBar
call GetMemSGBLayout
call CloseWindow
diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm
index 253169a27..b97eda1b3 100644
--- a/engine/battle/start_battle.asm
+++ b/engine/battle/start_battle.asm
@@ -33,7 +33,7 @@ FindFirstAliveMonAndStartBattle: ; 2ee2f
add hl, de
ld a, [hl]
ld [BattleMonLevel], a
- predef Predef_StartBattle
+ predef Predef_DoBattleTransition
farcall _LoadBattleFontsHPBar
ld a, 1
ld [hBGMapMode], a