summaryrefslogtreecommitdiff
path: root/engine/battle
diff options
context:
space:
mode:
authormid-kid <esteve.varela@gmail.com>2018-06-24 16:09:41 +0200
committermid-kid <esteve.varela@gmail.com>2018-06-24 16:13:22 +0200
commit1d9a68dbdd0132035f1fc7b7ea8f7fdc24741507 (patch)
tree3af0a92f5f7dc10f32eed04d9daae52749fc33c2 /engine/battle
parent131875d3e37044ec995287af7c93decd86a0d659 (diff)
Remove all address comments
Diffstat (limited to 'engine/battle')
-rw-r--r--engine/battle/ai/items.asm147
-rw-r--r--engine/battle/ai/move.asm6
-rw-r--r--engine/battle/ai/redundant.asm58
-rw-r--r--engine/battle/ai/scoring.asm291
-rw-r--r--engine/battle/ai/switch.asm31
-rw-r--r--engine/battle/anim_hp_bar.asm36
-rw-r--r--engine/battle/battle_transition.asm97
-rw-r--r--engine/battle/battlestart_copytilemapatonce.asm2
-rw-r--r--engine/battle/check_battle_scene.asm2
-rw-r--r--engine/battle/consume_held_item.asm2
-rw-r--r--engine/battle/core.asm804
-rw-r--r--engine/battle/effect_commands.asm612
-rw-r--r--engine/battle/hidden_power.asm3
-rw-r--r--engine/battle/link_result.asm10
-rw-r--r--engine/battle/menu.asm40
-rw-r--r--engine/battle/misc.asm18
-rw-r--r--engine/battle/move_effects/attract.asm6
-rw-r--r--engine/battle/move_effects/baton_pass.asm24
-rw-r--r--engine/battle/move_effects/beat_up.asm11
-rw-r--r--engine/battle/move_effects/belly_drum.asm3
-rw-r--r--engine/battle/move_effects/bide.asm6
-rw-r--r--engine/battle/move_effects/conversion.asm3
-rw-r--r--engine/battle/move_effects/conversion2.asm3
-rw-r--r--engine/battle/move_effects/counter.asm3
-rw-r--r--engine/battle/move_effects/curse.asm3
-rw-r--r--engine/battle/move_effects/destiny_bond.asm3
-rw-r--r--engine/battle/move_effects/disable.asm3
-rw-r--r--engine/battle/move_effects/encore.asm3
-rw-r--r--engine/battle/move_effects/endure.asm3
-rw-r--r--engine/battle/move_effects/false_swipe.asm3
-rw-r--r--engine/battle/move_effects/focus_energy.asm3
-rw-r--r--engine/battle/move_effects/foresight.asm3
-rw-r--r--engine/battle/move_effects/frustration.asm3
-rw-r--r--engine/battle/move_effects/fury_cutter.asm6
-rw-r--r--engine/battle/move_effects/future_sight.asm6
-rw-r--r--engine/battle/move_effects/heal_bell.asm3
-rw-r--r--engine/battle/move_effects/hidden_power.asm3
-rw-r--r--engine/battle/move_effects/leech_seed.asm3
-rw-r--r--engine/battle/move_effects/lock_on.asm3
-rw-r--r--engine/battle/move_effects/magnitude.asm2
-rw-r--r--engine/battle/move_effects/metronome.asm3
-rw-r--r--engine/battle/move_effects/mimic.asm3
-rw-r--r--engine/battle/move_effects/mirror_coat.asm3
-rw-r--r--engine/battle/move_effects/mirror_move.asm3
-rw-r--r--engine/battle/move_effects/mist.asm3
-rw-r--r--engine/battle/move_effects/nightmare.asm3
-rw-r--r--engine/battle/move_effects/pain_split.asm6
-rw-r--r--engine/battle/move_effects/pay_day.asm3
-rw-r--r--engine/battle/move_effects/perish_song.asm3
-rw-r--r--engine/battle/move_effects/present.asm2
-rw-r--r--engine/battle/move_effects/protect.asm6
-rw-r--r--engine/battle/move_effects/psych_up.asm3
-rw-r--r--engine/battle/move_effects/pursuit.asm3
-rw-r--r--engine/battle/move_effects/rage.asm3
-rw-r--r--engine/battle/move_effects/rain_dance.asm3
-rw-r--r--engine/battle/move_effects/rapid_spin.asm3
-rw-r--r--engine/battle/move_effects/return.asm3
-rw-r--r--engine/battle/move_effects/rollout.asm6
-rw-r--r--engine/battle/move_effects/safeguard.asm3
-rw-r--r--engine/battle/move_effects/sandstorm.asm3
-rw-r--r--engine/battle/move_effects/selfdestruct.asm3
-rw-r--r--engine/battle/move_effects/sketch.asm3
-rw-r--r--engine/battle/move_effects/sleep_talk.asm3
-rw-r--r--engine/battle/move_effects/snore.asm3
-rw-r--r--engine/battle/move_effects/spikes.asm3
-rw-r--r--engine/battle/move_effects/spite.asm3
-rw-r--r--engine/battle/move_effects/splash.asm3
-rw-r--r--engine/battle/move_effects/substitute.asm3
-rw-r--r--engine/battle/move_effects/sunny_day.asm3
-rw-r--r--engine/battle/move_effects/teleport.asm3
-rw-r--r--engine/battle/move_effects/thief.asm3
-rw-r--r--engine/battle/move_effects/thunder.asm3
-rw-r--r--engine/battle/move_effects/transform.asm3
-rw-r--r--engine/battle/move_effects/triple_kick.asm6
-rw-r--r--engine/battle/read_trainer_attributes.asm6
-rw-r--r--engine/battle/read_trainer_dvs.asm3
-rw-r--r--engine/battle/read_trainer_party.asm30
-rw-r--r--engine/battle/returntobattle_useball.asm2
-rw-r--r--engine/battle/sliding_intro.asm18
-rw-r--r--engine/battle/start_battle.asm8
-rw-r--r--engine/battle/trainer_huds.asm45
-rw-r--r--engine/battle/unreferenced_getgen1trainerclassname.asm2
-rw-r--r--engine/battle/used_move_text.asm42
83 files changed, 891 insertions, 1649 deletions
diff --git a/engine/battle/ai/items.asm b/engine/battle/ai/items.asm
index 218ecd375..14817f414 100644
--- a/engine/battle/ai/items.asm
+++ b/engine/battle/ai/items.asm
@@ -1,4 +1,4 @@
-AI_SwitchOrTryItem: ; 38000
+AI_SwitchOrTryItem:
and a
ld a, [wBattleMode]
@@ -38,12 +38,11 @@ AI_SwitchOrTryItem: ; 38000
jp nz, SwitchSometimes
; fallthrough
-DontSwitch: ; 38041
+DontSwitch:
call AI_TryItem
ret
-; 38045
-SwitchOften: ; 38045
+SwitchOften:
callfar CheckAbleToSwitch
ld a, [wEnemySwitchMonParam]
and $f0
@@ -77,9 +76,8 @@ SwitchOften: ; 38045
; In register 'a' is the number (1-6) of the mon to switch to
ld [wEnemySwitchMonIndex], a
jp AI_TrySwitch
-; 38083
-SwitchRarely: ; 38083
+SwitchRarely:
callfar CheckAbleToSwitch
ld a, [wEnemySwitchMonParam]
and $f0
@@ -112,9 +110,8 @@ SwitchRarely: ; 38083
inc a
ld [wEnemySwitchMonIndex], a
jp AI_TrySwitch
-; 380c1
-SwitchSometimes: ; 380c1
+SwitchSometimes:
callfar CheckAbleToSwitch
ld a, [wEnemySwitchMonParam]
and $f0
@@ -147,17 +144,15 @@ SwitchSometimes: ; 380c1
inc a
ld [wEnemySwitchMonIndex], a
jp AI_TrySwitch
-; 380ff
-CheckSubstatusCantRun: ; 380ff
+CheckSubstatusCantRun:
ld a, [wEnemySubStatus5]
bit SUBSTATUS_CANT_RUN, a
ret
-; 38105
-AI_TryItem: ; 38105
+AI_TryItem:
; items are not allowed in the BattleTower
ld a, [wInBattleTowerBattle]
and a
@@ -244,7 +239,7 @@ AI_TryItem: ; 38105
ret
-.IsHighestLevel: ; 38170
+.IsHighestLevel:
ld a, [wOTPartyCount]
ld d, a
ld e, 0
@@ -274,10 +269,9 @@ AI_TryItem: ; 38105
.yes
scf
ret
-; 38196
-AI_Items: ; 39196
+AI_Items:
dbw FULL_RESTORE, .FullRestore
dbw MAX_POTION, .MaxPotion
dbw HYPER_POTION, .HyperPotion
@@ -292,16 +286,14 @@ AI_Items: ; 39196
dbw X_SPEED, .XSpeed
dbw X_SPECIAL, .XSpecial
db -1 ; end
-; 381be
-.FullHeal: ; 381be
+.FullHeal:
call .Status
jp c, .DontUse
call EnemyUsedFullHeal
jp .Use
-; 381ca
-.Status: ; 381ca (e:41ca)
+.Status:
ld a, [wEnemyMonStatus]
and a
jp z, .DontUse
@@ -332,9 +324,8 @@ AI_Items: ; 39196
and 1 << FRZ | SLP
jp z, .DontUse
jp .Use
-; 38208
-.FullRestore: ; 38208
+.FullRestore:
call .HealItem
jp nc, .UseFullRestore
ld a, [bc]
@@ -346,15 +337,14 @@ AI_Items: ; 39196
.UseFullRestore:
call EnemyUsedFullRestore
jp .Use
-; 38220
-.MaxPotion: ; 38220
+.MaxPotion:
call .HealItem
jp c, .DontUse
call EnemyUsedMaxPotion
jp .Use
-.HealItem: ; 3822c (e:422c)
+.HealItem:
ld a, [bc]
bit CONTEXT_USE_F, a
jr nz, .CheckHalfOrQuarterHP
@@ -370,7 +360,7 @@ AI_Items: ; 39196
jp c, .UseHealItem
jp .DontUse
-.CheckQuarterHP: ; 38254 (e:4254)
+.CheckQuarterHP:
callfar AICheckEnemyQuarterHP
jp c, .DontUse
call Random
@@ -378,7 +368,7 @@ AI_Items: ; 39196
jp c, .DontUse
jr .UseHealItem
-.CheckHalfOrQuarterHP: ; 38267 (e:4267)
+.CheckHalfOrQuarterHP:
callfar AICheckEnemyHalfHP
jp c, .DontUse
callfar AICheckEnemyQuarterHP
@@ -387,33 +377,29 @@ AI_Items: ; 39196
cp 20 percent - 1
jp nc, .DontUse
-.UseHealItem: ; 38281 (e:4281)
+.UseHealItem:
jp .Use
-; 38284
-.HyperPotion: ; 38284
+.HyperPotion:
call .HealItem
jp c, .DontUse
ld b, 200
call EnemyUsedHyperPotion
jp .Use
-; 38292 (e:4292)
-.SuperPotion: ; 38292
+.SuperPotion:
call .HealItem
jp c, .DontUse
ld b, 50
call EnemyUsedSuperPotion
jp .Use
-; 382a0
-.Potion: ; 382a0
+.Potion:
call .HealItem
jp c, .DontUse
ld b, 20
call EnemyUsedPotion
jp .Use
-; 382ae
.asm_382ae ; This appears to be unused
callfar AICheckEnemyMaxHP
@@ -457,58 +443,50 @@ AI_Items: ; 39196
cp 39 percent + 1
jp c, .Use
jp .DontUse
-; 382f9
-.XAccuracy: ; 382f9
+.XAccuracy:
call .XItem
jp c, .DontUse
call EnemyUsedXAccuracy
jp .Use
-; 38305
-.GuardSpec: ; 38305
+.GuardSpec:
call .XItem
jp c, .DontUse
call EnemyUsedGuardSpec
jp .Use
-; 38311
-.DireHit: ; 38311
+.DireHit:
call .XItem
jp c, .DontUse
call EnemyUsedDireHit
jp .Use
-; 3831d (e:431d)
-.XAttack: ; 3831d
+.XAttack:
call .XItem
jp c, .DontUse
call EnemyUsedXAttack
jp .Use
-; 38329
-.XDefend: ; 38329
+.XDefend:
call .XItem
jp c, .DontUse
call EnemyUsedXDefend
jp .Use
-; 38335
-.XSpeed: ; 38335
+.XSpeed:
call .XItem
jp c, .DontUse
call EnemyUsedXSpeed
jp .Use
-; 38341
-.XSpecial: ; 38341
+.XSpecial:
call .XItem
jp c, .DontUse
call EnemyUsedXSpecial
jp .Use
-; 3834d
-.XItem: ; 3834d (e:434d)
+.XItem:
ld a, [wEnemyTurnsTaken]
and a
jr nz, .notfirstturnout
@@ -543,7 +521,7 @@ AI_Items: ; 39196
ret
-AIUpdateHUD: ; 38387
+AIUpdateHUD:
call UpdateEnemyMonInParty
farcall UpdateEnemyHUD
ld a, $1
@@ -552,29 +530,27 @@ AIUpdateHUD: ; 38387
dec [hl]
scf
ret
-; 3839a
-AIUsedItemSound: ; 3839a
+AIUsedItemSound:
push de
ld de, SFX_FULL_HEAL
call PlaySFX
pop de
ret
-; 383a3
-EnemyUsedFullHeal: ; 383a3 (e:43a3)
+EnemyUsedFullHeal:
call AIUsedItemSound
call AI_HealStatus
ld a, FULL_HEAL
jp PrintText_UsedItemOn_AND_AIUpdateHUD
-EnemyUsedMaxPotion: ; 383ae (e:43ae)
+EnemyUsedMaxPotion:
ld a, MAX_POTION
ld [wCurEnemyItem], a
jr FullRestoreContinue
-EnemyUsedFullRestore: ; 383b5 (e:43b5)
+EnemyUsedFullRestore:
call AI_HealStatus
ld a, FULL_RESTORE
ld [wCurEnemyItem], a
@@ -583,7 +559,7 @@ EnemyUsedFullRestore: ; 383b5 (e:43b5)
xor a
ld [wEnemyConfuseCount], a
-FullRestoreContinue: ; 383c6
+FullRestoreContinue:
ld de, wCurHPAnimOldHP
ld hl, wEnemyMonHP + 1
ld a, [hld]
@@ -603,23 +579,22 @@ FullRestoreContinue: ; 383c6
ld [wCurHPAnimMaxHP + 1], a
ld [wEnemyMonHP], a
jr EnemyPotionFinish
-; 383e8 (e:43e8)
-EnemyUsedPotion: ; 383e8
+EnemyUsedPotion:
ld a, POTION
ld b, 20
jr EnemyPotionContinue
-EnemyUsedSuperPotion: ; 383ee
+EnemyUsedSuperPotion:
ld a, SUPER_POTION
ld b, 50
jr EnemyPotionContinue
-EnemyUsedHyperPotion: ; 383f4 (e:43f4)
+EnemyUsedHyperPotion:
ld a, HYPER_POTION
ld b, 200
-EnemyPotionContinue: ; 383f8
+EnemyPotionContinue:
ld [wCurEnemyItem], a
ld hl, wEnemyMonHP + 1
ld a, [hl]
@@ -658,7 +633,7 @@ EnemyPotionContinue: ; 383f8
ld [hl], a
ld [wCurHPAnimNewHP + 1], a
-EnemyPotionFinish: ; 38436
+EnemyPotionFinish:
call PrintText_UsedItemOn
hlcoord 2, 2
xor a
@@ -668,7 +643,7 @@ EnemyPotionFinish: ; 38436
jp AIUpdateHUD
-AI_TrySwitch: ; 3844b
+AI_TrySwitch:
; Determine whether the AI can switch based on how many Pokemon are still alive.
; If it can switch, it will.
ld a, [wOTPartyCount]
@@ -695,9 +670,8 @@ AI_TrySwitch: ; 3844b
jp nc, AI_Switch
and a
ret
-; 3846c
-AI_Switch: ; 3846c
+AI_Switch:
ld a, $1
ld [wEnemyIsSwitching], a
ld [wEnemyGoesFirst], a
@@ -739,21 +713,18 @@ AI_Switch: ; 3846c
ret nz
scf
ret
-; 384d0
-TextJump_EnemyWithdrew: ; 384d0
+TextJump_EnemyWithdrew:
text_jump Text_EnemyWithdrew
db "@"
-; 384d5
Function384d5: ; This appears to be unused
call AIUsedItemSound
call AI_HealStatus
ld a, FULL_HEAL_RED ; X_SPEED
jp PrintText_UsedItemOn_AND_AIUpdateHUD
-; 384e0
-AI_HealStatus: ; 384e0
+AI_HealStatus:
ld a, [wCurOTMon]
ld hl, wOTPartyMon1Status
ld bc, PARTYMON_STRUCT_LENGTH
@@ -768,31 +739,27 @@ AI_HealStatus: ; 384e0
ld hl, wEnemySubStatus5
res SUBSTATUS_TOXIC, [hl]
ret
-; 384f7
-EnemyUsedXAccuracy: ; 384f7
+EnemyUsedXAccuracy:
call AIUsedItemSound
ld hl, wEnemySubStatus4
set SUBSTATUS_X_ACCURACY, [hl]
ld a, X_ACCURACY
jp PrintText_UsedItemOn_AND_AIUpdateHUD
-; 38504
-EnemyUsedGuardSpec: ; 38504
+EnemyUsedGuardSpec:
call AIUsedItemSound
ld hl, wEnemySubStatus4
set SUBSTATUS_MIST, [hl]
ld a, GUARD_SPEC
jp PrintText_UsedItemOn_AND_AIUpdateHUD
-; 38511
-EnemyUsedDireHit: ; 38511
+EnemyUsedDireHit:
call AIUsedItemSound
ld hl, wEnemySubStatus4
set SUBSTATUS_FOCUS_ENERGY, [hl]
ld a, DIRE_HIT
jp PrintText_UsedItemOn_AND_AIUpdateHUD
-; 3851e
Function3851e: ; This appears to be unused
ld [hDivisor], a
@@ -818,27 +785,23 @@ Function3851e: ; This appears to be unused
ld a, e
sub c
ret
-; 38541
-EnemyUsedXAttack: ; 38541
+EnemyUsedXAttack:
ld b, ATTACK
ld a, X_ATTACK
jr EnemyUsedXItem
-; 38547
-EnemyUsedXDefend: ; 38547
+EnemyUsedXDefend:
ld b, DEFENSE
ld a, X_DEFEND
jr EnemyUsedXItem
-; 3854d
-EnemyUsedXSpeed: ; 3854d
+EnemyUsedXSpeed:
ld b, SPEED
ld a, X_SPEED
jr EnemyUsedXItem
-; 38553
-EnemyUsedXSpecial: ; 38553
+EnemyUsedXSpecial:
ld b, SP_ATTACK
ld a, X_SPECIAL
@@ -853,18 +816,16 @@ EnemyUsedXItem:
pop bc
farcall CheckIfStatCanBeRaised
jp AIUpdateHUD
-; 38568
; Parameter
; a = ITEM_CONSTANT
-PrintText_UsedItemOn_AND_AIUpdateHUD: ; 38568
+PrintText_UsedItemOn_AND_AIUpdateHUD:
ld [wCurEnemyItem], a
call PrintText_UsedItemOn
jp AIUpdateHUD
-; 38571
-PrintText_UsedItemOn: ; 38571
+PrintText_UsedItemOn:
ld a, [wCurEnemyItem]
ld [wd265], a
call GetItemName
@@ -874,9 +835,7 @@ PrintText_UsedItemOn: ; 38571
call CopyBytes
ld hl, TextJump_EnemyUsedOn
jp PrintText
-; 3858c
-TextJump_EnemyUsedOn: ; 3858c
+TextJump_EnemyUsedOn:
text_jump Text_EnemyUsedOn
db "@"
-; 38591
diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm
index dd4357fe2..488ea76ca 100644
--- a/engine/battle/ai/move.asm
+++ b/engine/battle/ai/move.asm
@@ -1,4 +1,4 @@
-AIChooseMove: ; 440ce
+AIChooseMove:
; Score each move in wEnemyMonMoves starting from wBuffer1. Lower is better.
; Pick the move with the lowest score.
@@ -198,10 +198,9 @@ AIChooseMove: ; 440ce
ld a, c
ld [wCurEnemyMoveNum], a
ret
-; 441af
-AIScoringPointers: ; 441af
+AIScoringPointers:
; entries correspond to AI_* constants
dw AI_Basic
dw AI_Setup
@@ -219,4 +218,3 @@ AIScoringPointers: ; 441af
dw AI_None
dw AI_None
dw AI_None
-; 441cf
diff --git a/engine/battle/ai/redundant.asm b/engine/battle/ai/redundant.asm
index d09b4da73..d78fccb84 100644
--- a/engine/battle/ai/redundant.asm
+++ b/engine/battle/ai/redundant.asm
@@ -1,4 +1,4 @@
-AI_Redundant: ; 2c41a
+AI_Redundant:
; Check if move effect c will fail because it's already been used.
; Return z if the move is a good choice.
; Return nz if the move is a bad choice.
@@ -13,7 +13,7 @@ AI_Redundant: ; 2c41a
ld l, a
jp hl
-.Moves: ; 2c42c
+.Moves:
dbw EFFECT_DREAM_EATER, .DreamEater
dbw EFFECT_HEAL, .Heal
dbw EFFECT_LIGHT_SCREEN, .LightScreen
@@ -46,22 +46,22 @@ AI_Redundant: ; 2c41a
dbw EFFECT_FUTURE_SIGHT, .FutureSight
db -1
-.LightScreen: ; 2c487
+.LightScreen:
ld a, [wEnemyScreens]
bit SCREENS_LIGHT_SCREEN, a
ret
-.Mist: ; 2c48d
+.Mist:
ld a, [wEnemySubStatus4]
bit SUBSTATUS_MIST, a
ret
-.FocusEnergy: ; 2c493
+.FocusEnergy:
ld a, [wEnemySubStatus4]
bit SUBSTATUS_FOCUS_ENERGY, a
ret
-.Confuse: ; 2c499
+.Confuse:
ld a, [wPlayerSubStatus3]
bit SUBSTATUS_CONFUSED, a
ret nz
@@ -69,49 +69,49 @@ AI_Redundant: ; 2c41a
bit SCREENS_SAFEGUARD, a
ret
-.Transform: ; 2c4a5
+.Transform:
ld a, [wEnemySubStatus5]
bit SUBSTATUS_TRANSFORMED, a
ret
-.Reflect: ; 2c4ab
+.Reflect:
ld a, [wEnemyScreens]
bit SCREENS_REFLECT, a
ret
-.Substitute: ; 2c4b1
+.Substitute:
ld a, [wEnemySubStatus4]
bit SUBSTATUS_SUBSTITUTE, a
ret
-.LeechSeed: ; 2c4b7
+.LeechSeed:
ld a, [wPlayerSubStatus4]
bit SUBSTATUS_LEECH_SEED, a
ret
-.Disable: ; 2c4bd
+.Disable:
ld a, [wPlayerDisableCount]
and a
ret
-.Encore: ; 2c4c2
+.Encore:
ld a, [wPlayerSubStatus5]
bit SUBSTATUS_ENCORED, a
ret
.Snore:
-.SleepTalk: ; 2c4c8
+.SleepTalk:
ld a, [wEnemyMonStatus]
and SLP
jr z, .Redundant
jr .NotRedundant
-.MeanLook: ; 2c4d1
+.MeanLook:
ld a, [wEnemySubStatus5]
bit SUBSTATUS_CANT_RUN, a
ret
-.Nightmare: ; 2c4d7
+.Nightmare:
ld a, [wBattleMonStatus]
and a
jr z, .Redundant
@@ -119,63 +119,63 @@ AI_Redundant: ; 2c41a
bit SUBSTATUS_NIGHTMARE, a
ret
-.Spikes: ; 2c4e3
+.Spikes:
ld a, [wPlayerScreens]
bit SCREENS_SPIKES, a
ret
-.Foresight: ; 2c4e9
+.Foresight:
ld a, [wPlayerSubStatus1]
bit SUBSTATUS_IDENTIFIED, a
ret
-.PerishSong: ; 2c4ef
+.PerishSong:
ld a, [wPlayerSubStatus1]
bit SUBSTATUS_PERISH, a
ret
-.Sandstorm: ; 2c4f5
+.Sandstorm:
ld a, [wBattleWeather]
cp WEATHER_SANDSTORM
jr z, .Redundant
jr .NotRedundant
-.Attract: ; 2c4fe
+.Attract:
farcall CheckOppositeGender
jr c, .Redundant
ld a, [wPlayerSubStatus1]
bit SUBSTATUS_IN_LOVE, a
ret
-.Safeguard: ; 2c50c
+.Safeguard:
ld a, [wEnemyScreens]
bit SCREENS_SAFEGUARD, a
ret
-.RainDance: ; 2c512
+.RainDance:
ld a, [wBattleWeather]
cp WEATHER_RAIN
jr z, .Redundant
jr .NotRedundant
-.SunnyDay: ; 2c51b
+.SunnyDay:
ld a, [wBattleWeather]
cp WEATHER_SUN
jr z, .Redundant
jr .NotRedundant
-.DreamEater: ; 2c524
+.DreamEater:
ld a, [wBattleMonStatus]
and SLP
jr z, .Redundant
jr .NotRedundant
-.Swagger: ; 2c52d
+.Swagger:
ld a, [wPlayerSubStatus3]
bit SUBSTATUS_CONFUSED, a
ret
-.FutureSight: ; 2c533
+.FutureSight:
ld a, [wEnemyScreens]
bit 5, a
ret
@@ -183,16 +183,16 @@ AI_Redundant: ; 2c41a
.Heal:
.MorningSun:
.Synthesis:
-.Moonlight: ; 2c539
+.Moonlight:
farcall AICheckEnemyMaxHP
jr nc, .NotRedundant
.Teleport:
-.Redundant: ; 2c541
+.Redundant:
ld a, 1
and a
ret
-.NotRedundant: ; 2c545
+.NotRedundant:
xor a
ret
diff --git a/engine/battle/ai/scoring.asm b/engine/battle/ai/scoring.asm
index d000fab5f..128e9841b 100644
--- a/engine/battle/ai/scoring.asm
+++ b/engine/battle/ai/scoring.asm
@@ -1,6 +1,6 @@
AIScoring: ; used only for BANK(AIScoring)
-AI_Basic: ; 38591
+AI_Basic:
; Don't do anything redundant:
; -Using status-only moves if the player can't be statused
; -Using moves that fail if they've already been used
@@ -61,13 +61,12 @@ AI_Basic: ; 38591
.discourage
call AIDiscourageMove
jr .checkmove
-; 385db
INCLUDE "data/battle/ai/status_only_effects.asm"
-AI_Setup: ; 385e0
+AI_Setup:
; Use stat-modifying moves on turn 1.
; 50% chance to greatly encourage stat-up moves during the first turn of enemy's Pokemon.
@@ -140,11 +139,10 @@ AI_Setup: ; 385e0
inc [hl]
inc [hl]
jr .checkmove
-; 38635
-AI_Types: ; 38635
+AI_Types:
; Dismiss any move that the player is immune to.
; Encourage super-effective moves.
; Discourage not very effective moves unless
@@ -232,11 +230,10 @@ AI_Types: ; 38635
.immune
call AIDiscourageMove
jr .checkmove
-; 386a2
-AI_Offensive: ; 386a2
+AI_Offensive:
; Greatly discourage non-damaging moves.
ld hl, wBuffer1 - 1
@@ -261,11 +258,10 @@ AI_Offensive: ; 386a2
inc [hl]
inc [hl]
jr .checkmove
-; 386be
-AI_Smart: ; 386be
+AI_Smart:
; Context-specific scoring.
ld hl, wBuffer1
@@ -395,10 +391,9 @@ AI_Smart: ; 386be
dbw EFFECT_THUNDER, AI_Smart_Thunder
dbw EFFECT_FLY, AI_Smart_Fly
db -1 ; end
-; 387e3
-AI_Smart_Sleep: ; 387e3
+AI_Smart_Sleep:
; Greatly encourage sleep inducing moves if the enemy has either Dream Eater or Nightmare.
; 50% chance to greatly encourage sleep inducing moves otherwise.
@@ -416,10 +411,9 @@ AI_Smart_Sleep: ; 387e3
dec [hl]
dec [hl]
ret
-; 387f7
-AI_Smart_LeechHit: ; 387f7
+AI_Smart_LeechHit:
push hl
ld a, 1
ld [hBattleTurn], a
@@ -452,10 +446,9 @@ AI_Smart_LeechHit: ; 387f7
inc [hl]
ret
-; 3881d
-AI_Smart_LockOn: ; 3881d
+AI_Smart_LockOn:
ld a, [wPlayerSubStatus5]
bit SUBSTATUS_LOCK_ON, a
jr nz, .asm_38882
@@ -558,10 +551,9 @@ AI_Smart_LockOn: ; 3881d
.asm_388a2
pop hl
jp AIDiscourageMove
-; 388a6
-AI_Smart_Selfdestruct: ; 388a6
+AI_Smart_Selfdestruct:
; Selfdestruct, Explosion
; Unless this is the enemy's last Pokemon...
@@ -596,10 +588,9 @@ AI_Smart_Selfdestruct: ; 388a6
inc [hl]
inc [hl]
ret
-; 388ca
-AI_Smart_DreamEater: ; 388ca
+AI_Smart_DreamEater:
; 90% chance to greatly encourage this move.
; The AI_Basic layer will make sure that
; Dream Eater is only used against sleeping targets.
@@ -610,10 +601,9 @@ AI_Smart_DreamEater: ; 388ca
dec [hl]
dec [hl]
ret
-; 388d4
-AI_Smart_EvasionUp: ; 388d4
+AI_Smart_EvasionUp:
; Dismiss this move if enemy's evasion can't raise anymore.
ld a, [wEnemyEvaLevel]
@@ -723,10 +713,9 @@ AI_Smart_EvasionUp: ; 388d4
dec [hl]
ret
-; 38947
-AI_Smart_AlwaysHit: ; 38947
+AI_Smart_AlwaysHit:
; 80% chance to greatly encourage this move if either...
; ...enemy's accuracy level has been lowered three or more stages
@@ -746,10 +735,9 @@ AI_Smart_AlwaysHit: ; 38947
dec [hl]
dec [hl]
ret
-; 3895b
-AI_Smart_MirrorMove: ; 3895b
+AI_Smart_MirrorMove:
; If the player did not use any move last turn...
ld a, [wLastPlayerCounterMove]
@@ -790,10 +778,9 @@ AI_Smart_MirrorMove: ; 3895b
dec [hl]
ret
-; 38985
-AI_Smart_AccuracyDown: ; 38985
+AI_Smart_AccuracyDown:
; If player's HP is full...
call AICheckPlayerMaxHP
@@ -897,10 +884,9 @@ AI_Smart_AccuracyDown: ; 38985
dec [hl]
ret
-; 389f5
-AI_Smart_ResetStats: ; 389f5
+AI_Smart_ResetStats:
; 85% chance to encourage this move if any of enemy's stat levels is lower than -2.
push hl
@@ -940,10 +926,9 @@ AI_Smart_ResetStats: ; 389f5
pop hl
inc [hl]
ret
-; 38a1e
-AI_Smart_Bide: ; 38a1e
+AI_Smart_Bide:
; 90% chance to discourage this move unless enemy's HP is full.
call AICheckEnemyMaxHP
@@ -953,10 +938,9 @@ AI_Smart_Bide: ; 38a1e
ret c
inc [hl]
ret
-; 38a2a
-AI_Smart_ForceSwitch: ; 38a2a
+AI_Smart_ForceSwitch:
; Whirlwind, Roar.
; Discourage this move if the player has not shown
@@ -971,13 +955,12 @@ AI_Smart_ForceSwitch: ; 38a2a
ret c
inc [hl]
ret
-; 38a3a
AI_Smart_Heal:
AI_Smart_MorningSun:
AI_Smart_Synthesis:
-AI_Smart_Moonlight: ; 38a3a
+AI_Smart_Moonlight:
; 90% chance to greatly encourage this move if enemy's HP is below 25%.
; Discourage this move if enemy's HP is higher than 50%.
; Do nothing otherwise.
@@ -996,22 +979,20 @@ AI_Smart_Moonlight: ; 38a3a
dec [hl]
dec [hl]
ret
-; 38a4e
AI_Smart_Toxic:
-AI_Smart_LeechSeed: ; 38a4e
+AI_Smart_LeechSeed:
; Discourage this move if player's HP is below 50%.
call AICheckPlayerHalfHP
ret c
inc [hl]
ret
-; 38a54
AI_Smart_LightScreen:
-AI_Smart_Reflect: ; 38a54
+AI_Smart_Reflect:
; Over 90% chance to discourage this move unless enemy's HP is full.
call AICheckEnemyMaxHP
@@ -1021,10 +1002,9 @@ AI_Smart_Reflect: ; 38a54
ret c
inc [hl]
ret
-; 38a60
-AI_Smart_Ohko: ; 38a60
+AI_Smart_Ohko:
; Dismiss this move if player's level is higher than enemy's level.
; Else, discourage this move is player's HP is below 50%.
@@ -1037,10 +1017,9 @@ AI_Smart_Ohko: ; 38a60
ret c
inc [hl]
ret
-; 38a71
-AI_Smart_TrapTarget: ; 38a71
+AI_Smart_TrapTarget:
; Bind, Wrap, Fire Spin, Clamp
; 50% chance to discourage this move if the player is already trapped.
@@ -1078,11 +1057,10 @@ AI_Smart_TrapTarget: ; 38a71
dec [hl]
dec [hl]
ret
-; 38a9c
AI_Smart_RazorWind:
-AI_Smart_Unused2B: ; 38a9c
+AI_Smart_Unused2B:
ld a, [wEnemySubStatus1]
bit SUBSTATUS_PERISH, a
jr z, .asm_38aaa
@@ -1133,10 +1111,9 @@ AI_Smart_Unused2B: ; 38a9c
add 6
ld [hl], a
ret
-; 38adb
-AI_Smart_Confuse: ; 38adb
+AI_Smart_Confuse:
; 90% chance to discourage this move if player's HP is between 25% and 50%.
call AICheckPlayerHalfHP
@@ -1152,10 +1129,9 @@ AI_Smart_Confuse: ; 38adb
ret c
inc [hl]
ret
-; 38aed
-AI_Smart_SpDefenseUp2: ; 38aed
+AI_Smart_SpDefenseUp2:
; Discourage this move if enemy's HP is lower than 50%.
call AICheckEnemyHalfHP
@@ -1188,10 +1164,9 @@ AI_Smart_SpDefenseUp2: ; 38aed
.asm_38b10
inc [hl]
ret
-; 38b12
-AI_Smart_Fly: ; 38b12
+AI_Smart_Fly:
; Fly, Dig
; Greatly encourage this move if the player is
@@ -1208,20 +1183,18 @@ AI_Smart_Fly: ; 38b12
dec [hl]
dec [hl]
ret
-; 38b20
-AI_Smart_SuperFang: ; 38b20
+AI_Smart_SuperFang:
; Discourage this move if player's HP is below 25%.
call AICheckPlayerQuarterHP
ret c
inc [hl]
ret
-; 38b26
-AI_Smart_Paralyze: ; 38b26
+AI_Smart_Paralyze:
; 50% chance to discourage this move if player's HP is below 25%.
call AICheckPlayerQuarterHP
@@ -1244,10 +1217,9 @@ AI_Smart_Paralyze: ; 38b26
ret c
inc [hl]
ret
-; 38b40
-AI_Smart_SpeedDownHit: ; 38b40
+AI_Smart_SpeedDownHit:
; Icy Wind
; Almost 90% chance to greatly encourage this move if the following conditions all meet:
@@ -1271,19 +1243,17 @@ AI_Smart_SpeedDownHit: ; 38b40
dec [hl]
dec [hl]
ret
-; 38b5c
-AI_Smart_Substitute: ; 38b5c
+AI_Smart_Substitute:
; Dismiss this move if enemy's HP is below 50%.
call AICheckEnemyHalfHP
ret c
jp AIDiscourageMove
-; 38b63
-AI_Smart_HyperBeam: ; 38b63
+AI_Smart_HyperBeam:
call AICheckEnemyHalfHP
jr c, .asm_38b72
@@ -1305,10 +1275,9 @@ AI_Smart_HyperBeam: ; 38b63
ret c
inc [hl]
ret
-; 38b7f
-AI_Smart_Rage: ; 38b7f
+AI_Smart_Rage:
ld a, [wEnemySubStatus4]
bit SUBSTATUS_RAGE, a
jr z, .asm_38b9b
@@ -1345,10 +1314,9 @@ AI_Smart_Rage: ; 38b7f
.asm_38ba6
inc [hl]
ret
-; 38ba8
-AI_Smart_Mimic: ; 38ba8
+AI_Smart_Mimic:
ld a, [wLastPlayerCounterMove]
and a
jr z, .asm_38be9
@@ -1396,10 +1364,9 @@ AI_Smart_Mimic: ; 38ba8
.asm_38bef
inc [hl]
ret
-; 38bf1
-AI_Smart_Counter: ; 38bf1
+AI_Smart_Counter:
push hl
ld hl, wPlayerUsedMoves
ld c, 4
@@ -1462,10 +1429,9 @@ AI_Smart_Counter: ; 38bf1
.asm_38c39
inc [hl]
ret
-; 38c3b
-AI_Smart_Encore: ; 38c3b
+AI_Smart_Encore:
call AICompareSpeed
jr nc, .asm_38c81
@@ -1519,7 +1485,7 @@ AI_Smart_Encore: ; 38c3b
INCLUDE "data/battle/ai/encore_moves.asm"
-AI_Smart_PainSplit: ; 38ca4
+AI_Smart_PainSplit:
; Discourage this move if [enemy's current HP * 2 > player's current HP].
push hl
@@ -1538,11 +1504,10 @@ AI_Smart_PainSplit: ; 38ca4
ret nc
inc [hl]
ret
-; 38cba
AI_Smart_Snore:
-AI_Smart_SleepTalk: ; 38cba
+AI_Smart_SleepTalk:
; Greatly encourage this move if enemy is fast asleep.
; Greatly discourage this move otherwise.
@@ -1561,10 +1526,9 @@ AI_Smart_SleepTalk: ; 38cba
inc [hl]
inc [hl]
ret
-; 38ccb
-AI_Smart_DefrostOpponent: ; 38ccb
+AI_Smart_DefrostOpponent:
; Greatly encourage this move if enemy is frozen.
; No move has EFFECT_DEFROST_OPPONENT, so this layer is unused.
@@ -1575,10 +1539,9 @@ AI_Smart_DefrostOpponent: ; 38ccb
dec [hl]
dec [hl]
ret
-; 38cd5
-AI_Smart_Spite: ; 38cd5
+AI_Smart_Spite:
ld a, [wLastPlayerCounterMove]
and a
jr nz, .asm_38ce7
@@ -1633,27 +1596,24 @@ AI_Smart_Spite: ; 38cd5
dec [hl]
dec [hl]
ret
-; 38d16
-Function_0x38d16; 38d16
+Function_0x38d16
jp AIDiscourageMove
-; 38d19
AI_Smart_DestinyBond:
AI_Smart_Reversal:
-AI_Smart_SkullBash: ; 38d19
+AI_Smart_SkullBash:
; Discourage this move if enemy's HP is above 25%.
call AICheckEnemyQuarterHP
ret nc
inc [hl]
ret
-; 38d1f
-AI_Smart_HealBell: ; 38d1f
+AI_Smart_HealBell:
; Dismiss this move if none of the opponent's Pokemon is statused.
; Encourage this move if the enemy is statused.
; 50% chance to greatly encourage this move if the enemy is fast asleep or frozen.
@@ -1709,10 +1669,9 @@ AI_Smart_HealBell: ; 38d1f
ret nz
jp AIDiscourageMove
-; 38d5a
-AI_Smart_PriorityHit: ; 38d5a
+AI_Smart_PriorityHit:
call AICompareSpeed
ret c
@@ -1742,20 +1701,18 @@ AI_Smart_PriorityHit: ; 38d5a
dec [hl]
dec [hl]
ret
-; 38d93
-AI_Smart_Thief: ; 38d93
+AI_Smart_Thief:
; Don't use Thief unless it's the only move available.
ld a, [hl]
add $1e
ld [hl], a
ret
-; 38d98
-AI_Smart_Conversion2: ; 38d98
+AI_Smart_Conversion2:
ld a, [wLastPlayerMove]
and a
jr nz, .asm_38dc9
@@ -1793,10 +1750,9 @@ AI_Smart_Conversion2: ; 38d98
ret c
inc [hl]
ret
-; 38dd1
-AI_Smart_Disable: ; 38dd1
+AI_Smart_Disable:
call AICompareSpeed
jr nc, .asm_38df3
@@ -1826,10 +1782,9 @@ AI_Smart_Disable: ; 38dd1
ret c
inc [hl]
ret
-; 38dfb
-AI_Smart_MeanLook: ; 38dfb
+AI_Smart_MeanLook:
call AICheckEnemyHalfHP
jr nc, .asm_38e24
@@ -1869,10 +1824,9 @@ AI_Smart_MeanLook: ; 38dfb
dec [hl]
dec [hl]
ret
-; 38e2e
-AICheckLastPlayerMon: ; 38e2e
+AICheckLastPlayerMon:
ld a, [wPartyCount]
ld b, a
ld c, 0
@@ -1896,10 +1850,9 @@ AICheckLastPlayerMon: ; 38e2e
jr nz, .loop
ret
-; 38e4a
-AI_Smart_Nightmare: ; 38e4a
+AI_Smart_Nightmare:
; 50% chance to encourage this move.
; The AI_Basic layer will make sure that
; Dream Eater is only used against sleeping targets.
@@ -1908,10 +1861,9 @@ AI_Smart_Nightmare: ; 38e4a
ret c
dec [hl]
ret
-; 38e50
-AI_Smart_FlameWheel: ; 38e50
+AI_Smart_FlameWheel:
; Use this move if the enemy is frozen.
ld a, [wEnemyMonStatus]
@@ -1921,10 +1873,9 @@ rept 5
dec [hl]
endr
ret
-; 38e5c
-AI_Smart_Curse: ; 38e5c
+AI_Smart_Curse:
ld a, [wEnemyMonType1]
cp GHOST
jr z, .ghostcurse
@@ -2010,10 +1961,9 @@ AI_Smart_Curse: ; 38e5c
dec [hl]
dec [hl]
ret
-; 38ed2
-AI_Smart_Protect: ; 38ed2
+AI_Smart_Protect:
ld a, [wEnemyProtectCount]
and a
jr nz, .asm_38f13
@@ -2063,10 +2013,9 @@ AI_Smart_Protect: ; 38ed2
inc [hl]
inc [hl]
ret
-; 38f1d
-AI_Smart_Foresight: ; 38f1d
+AI_Smart_Foresight:
ld a, [wEnemyAccLevel]
cp $5
jr c, .asm_38f41
@@ -2094,10 +2043,9 @@ AI_Smart_Foresight: ; 38f1d
dec [hl]
dec [hl]
ret
-; 38f4a
-AI_Smart_PerishSong: ; 38f4a
+AI_Smart_PerishSong:
push hl
callfar FindAliveEnemyMons
pop hl
@@ -2132,10 +2080,9 @@ AI_Smart_PerishSong: ; 38f4a
add 5
ld [hl], a
ret
-; 38f7a
-AI_Smart_Sandstorm: ; 38f7a
+AI_Smart_Sandstorm:
; Greatly discourage this move if the player is immune to Sandstorm damage.
ld a, [wBattleMonType1]
@@ -2177,10 +2124,9 @@ AI_Smart_Sandstorm: ; 38f7a
db GROUND
db STEEL
db -1 ; end
-; 38fac
-AI_Smart_Endure: ; 38fac
+AI_Smart_Endure:
ld a, [wEnemyProtectCount]
and a
jr nz, .asm_38fd8
@@ -2221,10 +2167,9 @@ AI_Smart_Endure: ; 38fac
.asm_38fd9
inc [hl]
ret
-; 38fdb
-AI_Smart_FuryCutter: ; 38fdb
+AI_Smart_FuryCutter:
; Encourage this move based on Fury Cutter's count.
ld a, [wEnemyFuryCutterCount]
@@ -2246,10 +2191,9 @@ AI_Smart_FuryCutter: ; 38fdb
.end
; fallthrough
-; 38fef
-AI_Smart_Rollout: ; 38fef
+AI_Smart_Rollout:
; Rollout, Fury Cutter
; 80% chance to discourage this move if the enemy is in love, confused, or paralyzed.
@@ -2290,11 +2234,10 @@ AI_Smart_Rollout: ; 38fef
ret c
inc [hl]
ret
-; 39026
AI_Smart_Swagger:
-AI_Smart_Attract: ; 39026
+AI_Smart_Attract:
; 80% chance to encourage this move during the first turn of player's Pokemon.
; 80% chance to discourage this move otherwise.
@@ -2313,10 +2256,9 @@ AI_Smart_Attract: ; 39026
ret nc
dec [hl]
ret
-; 3903a
-AI_Smart_Safeguard: ; 3903a
+AI_Smart_Safeguard:
; 80% chance to discourage this move if player's HP is below 50%.
call AICheckPlayerHalfHP
@@ -2325,11 +2267,10 @@ AI_Smart_Safeguard: ; 3903a
ret c
inc [hl]
ret
-; 39044
AI_Smart_Magnitude:
-AI_Smart_Earthquake: ; 39044
+AI_Smart_Earthquake:
; Greatly encourage this move if the player is underground and the enemy is faster.
ld a, [wLastPlayerCounterMove]
@@ -2358,10 +2299,9 @@ AI_Smart_Earthquake: ; 39044
dec [hl]
ret
-; 39062
-AI_Smart_BatonPass: ; 39062
+AI_Smart_BatonPass:
; Discourage this move if the player hasn't shown super-effective moves against the enemy.
; Consider player's type(s) if its moves are unknown.
@@ -2373,10 +2313,9 @@ AI_Smart_BatonPass: ; 39062
ret c
inc [hl]
ret
-; 39072
-AI_Smart_Pursuit: ; 39072
+AI_Smart_Pursuit:
; 50% chance to greatly encourage this move if player's HP is below 25%.
; 80% chance to discourage this move otherwise.
@@ -2393,10 +2332,9 @@ AI_Smart_Pursuit: ; 39072
dec [hl]
dec [hl]
ret
-; 39084
-AI_Smart_RapidSpin: ; 39084
+AI_Smart_RapidSpin:
; 80% chance to greatly encourage this move if the enemy is
; trapped (Bind effect), seeded, or scattered with spikes.
@@ -2419,10 +2357,9 @@ AI_Smart_RapidSpin: ; 39084
dec [hl]
dec [hl]
ret
-; 3909e
-AI_Smart_HiddenPower: ; 3909e
+AI_Smart_HiddenPower:
push hl
ld a, 1
ld [hBattleTurn], a
@@ -2459,10 +2396,9 @@ AI_Smart_HiddenPower: ; 3909e
.bad
inc [hl]
ret
-; 390cb
-AI_Smart_RainDance: ; 390cb
+AI_Smart_RainDance:
; Greatly discourage this move if it would favour the player type-wise.
; Particularly, if the player is a Water-type.
@@ -2481,12 +2417,11 @@ AI_Smart_RainDance: ; 390cb
push hl
ld hl, RainDanceMoves
jr AI_Smart_WeatherMove
-; 390e7
INCLUDE "data/battle/ai/rain_dance_moves.asm"
-AI_Smart_SunnyDay: ; 390f3
+AI_Smart_SunnyDay:
; Greatly discourage this move if it would favour the player type-wise.
; Particularly, if the player is a Fire-type.
@@ -2506,10 +2441,9 @@ AI_Smart_SunnyDay: ; 390f3
ld hl, SunnyDayMoves
; fallthrough
-; 3910d
-AI_Smart_WeatherMove: ; 3910d
+AI_Smart_WeatherMove:
; Rain Dance, Sunny Day
; Greatly discourage this move if the enemy doesn't have
@@ -2528,16 +2462,14 @@ AI_Smart_WeatherMove: ; 3910d
dec [hl]
ret
-; 3911e
-AIBadWeatherType: ; 3911e
+AIBadWeatherType:
inc [hl]
inc [hl]
inc [hl]
ret
-; 39122
-AIGoodWeatherType: ; 39122
+AIGoodWeatherType:
; Rain Dance, Sunny Day
; Greatly encourage this move if it would disfavour the player type-wise and player's HP is above 50%...
@@ -2559,13 +2491,12 @@ AIGoodWeatherType: ; 39122
dec [hl]
dec [hl]
ret
-; 39134
INCLUDE "data/battle/ai/sunny_day_moves.asm"
-AI_Smart_BellyDrum: ; 3913d
+AI_Smart_BellyDrum:
; Dismiss this move if enemy's attack is higher than +2 or if enemy's HP is below 50%.
; Else, discourage this move if enemy's HP is not full.
@@ -2586,10 +2517,9 @@ AI_Smart_BellyDrum: ; 3913d
add $5
ld [hl], a
ret
-; 39152
-AI_Smart_PsychUp: ; 39152
+AI_Smart_PsychUp:
push hl
ld hl, wEnemyAtkLevel
ld b, $8
@@ -2645,10 +2575,9 @@ AI_Smart_PsychUp: ; 39152
inc [hl]
inc [hl]
ret
-; 3918b
-AI_Smart_MirrorCoat: ; 3918b
+AI_Smart_MirrorCoat:
push hl
ld hl, wPlayerUsedMoves
ld c, $4
@@ -2710,11 +2639,10 @@ AI_Smart_MirrorCoat: ; 3918b
.asm_391d3
inc [hl]
ret
-; 391d5
AI_Smart_Twister:
-AI_Smart_Gust: ; 391d5
+AI_Smart_Gust:
; Greatly encourage this move if the player is flying and the enemy is faster.
ld a, [wLastPlayerCounterMove]
@@ -2742,10 +2670,9 @@ AI_Smart_Gust: ; 391d5
ret c
dec [hl]
ret
-; 391f3
-AI_Smart_FutureSight: ; 391f3
+AI_Smart_FutureSight:
; Greatly encourage this move if the player is
; flying or underground, and slower than the enemy.
@@ -2759,10 +2686,9 @@ AI_Smart_FutureSight: ; 391f3
dec [hl]
dec [hl]
ret
-; 39200
-AI_Smart_Stomp: ; 39200
+AI_Smart_Stomp:
; 80% chance to encourage this move if the player has used Minimize.
ld a, [wPlayerMinimized]
@@ -2774,10 +2700,9 @@ AI_Smart_Stomp: ; 39200
dec [hl]
ret
-; 3920b
-AI_Smart_Solarbeam: ; 3920b
+AI_Smart_Solarbeam:
; 80% chance to encourage this move when it's sunny.
; 90% chance to discourage this move when it's raining.
@@ -2803,10 +2728,9 @@ AI_Smart_Solarbeam: ; 3920b
dec [hl]
dec [hl]
ret
-; 39225
-AI_Smart_Thunder: ; 39225
+AI_Smart_Thunder:
; 90% chance to discourage this move when it's sunny.
ld a, [wBattleWeather]
@@ -2819,10 +2743,9 @@ AI_Smart_Thunder: ; 39225
inc [hl]
ret
-; 39233
-AICompareSpeed: ; 39233
+AICompareSpeed:
; Return carry if enemy is faster than player.
push bc
@@ -2836,30 +2759,27 @@ AICompareSpeed: ; 39233
sbc b
pop bc
ret
-; 39246
-AICheckPlayerMaxHP: ; 39246
+AICheckPlayerMaxHP:
push hl
push de
push bc
ld de, wBattleMonHP
ld hl, wBattleMonMaxHP
jr AICheckMaxHP
-; 39251
-AICheckEnemyMaxHP: ; 39251
+AICheckEnemyMaxHP:
push hl
push de
push bc
ld de, wEnemyMonHP
ld hl, wEnemyMonMaxHP
; fallthrough
-; 3925a
-AICheckMaxHP: ; 3925a
+AICheckMaxHP:
; Return carry if hp at de matches max hp at hl.
ld a, [de]
@@ -2884,10 +2804,9 @@ AICheckMaxHP: ; 3925a
pop hl
and a
ret
-; 3926e
-AICheckPlayerHalfHP: ; 3926e
+AICheckPlayerHalfHP:
push hl
ld hl, wBattleMonHP
ld b, [hl]
@@ -2903,10 +2822,9 @@ AICheckPlayerHalfHP: ; 3926e
sbc b
pop hl
ret
-; 39281
-AICheckEnemyHalfHP: ; 39281
+AICheckEnemyHalfHP:
push hl
push de
push bc
@@ -2926,10 +2844,9 @@ AICheckEnemyHalfHP: ; 39281
pop de
pop hl
ret
-; 39298
-AICheckEnemyQuarterHP: ; 39298
+AICheckEnemyQuarterHP:
push hl
push de
push bc
@@ -2951,10 +2868,9 @@ AICheckEnemyQuarterHP: ; 39298
pop de
pop hl
ret
-; 392b3
-AICheckPlayerQuarterHP: ; 392b3
+AICheckPlayerQuarterHP:
push hl
ld hl, wBattleMonHP
ld b, [hl]
@@ -2972,10 +2888,9 @@ AICheckPlayerQuarterHP: ; 392b3
sbc b
pop hl
ret
-; 392ca
-AIHasMoveEffect: ; 392ca
+AIHasMoveEffect:
; Return carry if the enemy has move b.
push hl
@@ -3005,10 +2920,9 @@ AIHasMoveEffect: ; 392ca
pop hl
scf
ret
-; 392e6
-AIHasMoveInArray: ; 392e6
+AIHasMoveInArray:
; Return carry if the enemy has a move in array hl.
push hl
@@ -3040,13 +2954,12 @@ AIHasMoveInArray: ; 392e6
pop de
pop hl
ret
-; 39301
INCLUDE "data/battle/ai/useful_moves.asm"
-AI_Opportunist: ; 39315
+AI_Opportunist:
; Discourage stall moves when the enemy's HP is low.
; Do nothing if enemy's HP is above 50%.
@@ -3097,7 +3010,7 @@ INCLUDE "data/battle/ai/stall_moves.asm"
-AI_Aggressive: ; 39369
+AI_Aggressive:
; Use whatever does the most damage.
; Discourage all damaging moves but the one that does the most damage.
@@ -3205,7 +3118,7 @@ AI_Aggressive: ; 39369
INCLUDE "data/battle/ai/reckless_moves.asm"
-AIDamageCalc: ; 393e7
+AIDamageCalc:
ld a, 1
ld [hBattleTurn], a
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
@@ -3225,7 +3138,7 @@ AIDamageCalc: ; 393e7
INCLUDE "data/battle/ai/constant_damage_effects.asm"
-AI_Cautious: ; 39418
+AI_Cautious:
; 90% chance to discourage moves with residual effects after the first turn.
ld a, [wEnemyTurnsTaken]
@@ -3268,7 +3181,7 @@ INCLUDE "data/battle/ai/residual_moves.asm"
-AI_Status: ; 39453
+AI_Status:
; Dismiss status moves that don't affect the player.
ld hl, wBuffer1 - 1
@@ -3328,11 +3241,10 @@ AI_Status: ; 39453
.immune
call AIDiscourageMove
jr .checkmove
-; 394a9
-AI_Risky: ; 394a9
+AI_Risky:
; Use any move that will KO the target.
; Risky moves will often be an exception (see below).
@@ -3402,20 +3314,18 @@ INCLUDE "data/battle/ai/risky_effects.asm"
-AI_None: ; 39502
+AI_None:
ret
-; 39503
-AIDiscourageMove: ; 39503
+AIDiscourageMove:
ld a, [hl]
add 10
ld [hl], a
ret
-; 39508
-AIGetEnemyMove: ; 39508
+AIGetEnemyMove:
; Load attributes of move a into ram
push hl
@@ -3434,18 +3344,15 @@ AIGetEnemyMove: ; 39508
pop de
pop hl
ret
-; 39521
-AI_80_20: ; 39521
+AI_80_20:
call Random
cp 20 percent - 1
ret
-; 39527
-AI_50_50: ; 39527
+AI_50_50:
call Random
cp 50 percent + 1
ret
-; 3952d
diff --git a/engine/battle/ai/switch.asm b/engine/battle/ai/switch.asm
index d397c8d32..b975776c2 100644
--- a/engine/battle/ai/switch.asm
+++ b/engine/battle/ai/switch.asm
@@ -1,4 +1,4 @@
-CheckPlayerMoveTypeMatchups: ; 3484e
+CheckPlayerMoveTypeMatchups:
; Check how well the moves you've already used
; fare against the enemy's Pokemon. Used to
; score a potential switch.
@@ -95,10 +95,9 @@ CheckPlayerMoveTypeMatchups: ; 3484e
pop de
pop hl
ret
-; 348de
-.CheckEnemyMoveMatchups: ; 348de
+.CheckEnemyMoveMatchups:
ld de, wEnemyMonMoves
ld b, NUM_MOVES + 1
ld c, 0
@@ -163,21 +162,19 @@ CheckPlayerMoveTypeMatchups: ; 3484e
.doubledown
call .DecreaseScore
-.DecreaseScore: ; 34931
+.DecreaseScore:
ld a, [wEnemyAISwitchScore]
dec a
ld [wEnemyAISwitchScore], a
ret
-; 34939
-.IncreaseScore: ; 34939
+.IncreaseScore:
ld a, [wEnemyAISwitchScore]
inc a
ld [wEnemyAISwitchScore], a
ret
-; 34941
-CheckAbleToSwitch: ; 34941
+CheckAbleToSwitch:
xor a
ld [wEnemySwitchMonParam], a
call FindAliveEnemyMons
@@ -292,10 +289,9 @@ CheckAbleToSwitch: ; 34941
add $10
ld [wEnemySwitchMonParam], a
ret
-; 349f4
-FindAliveEnemyMons: ; 349f4
+FindAliveEnemyMons:
ld a, [wOTPartyCount]
cp 2
jr c, .only_one
@@ -344,10 +340,9 @@ FindAliveEnemyMons: ; 349f4
.more_than_one
and a
ret
-; 34a2a
-FindEnemyMonsImmuneToLastCounterMove: ; 34a2a
+FindEnemyMonsImmuneToLastCounterMove:
ld hl, wOTPartyMon1
ld a, [wOTPartyCount]
ld b, a
@@ -412,10 +407,9 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a
inc d
srl c
jr .loop
-; 34a85
-FindAliveEnemyMonsWithASuperEffectiveMove: ; 34a85
+FindAliveEnemyMonsWithASuperEffectiveMove:
push bc
ld a, [wOTPartyCount]
ld e, a
@@ -445,7 +439,7 @@ FindAliveEnemyMonsWithASuperEffectiveMove: ; 34a85
and c
ld c, a
-FindEnemyMonsWithASuperEffectiveMove: ; 34aa7
+FindEnemyMonsWithASuperEffectiveMove:
ld a, -1
ld [wEnemyAISwitchScore], a
@@ -551,10 +545,9 @@ FindEnemyMonsWithASuperEffectiveMove: ; 34aa7
ld [wEnemyAISwitchScore], a
pop bc
ret
-; 34b20
-FindEnemyMonsThatResistPlayer: ; 34b20
+FindEnemyMonsThatResistPlayer:
push bc
ld hl, wOTPartySpecies
ld b, 1 << (PARTY_LENGTH - 1)
@@ -613,10 +606,9 @@ FindEnemyMonsThatResistPlayer: ; 34b20
and c
ld c, a
ret
-; 34b77
-FindEnemyMonsWithAtLeastQuarterMaxHP: ; 34b77
+FindEnemyMonsWithAtLeastQuarterMaxHP:
push bc
ld de, wOTPartySpecies
ld b, 1 << (PARTY_LENGTH - 1)
@@ -669,4 +661,3 @@ FindEnemyMonsWithAtLeastQuarterMaxHP: ; 34b77
and c
ld c, a
ret
-; 34bb1
diff --git a/engine/battle/anim_hp_bar.asm b/engine/battle/anim_hp_bar.asm
index 5c453d0ff..fd9c783ce 100644
--- a/engine/battle/anim_hp_bar.asm
+++ b/engine/battle/anim_hp_bar.asm
@@ -1,4 +1,4 @@
-_AnimateHPBar: ; d627
+_AnimateHPBar:
call .IsMaximumMoreThan48Pixels
jr c, .MoreThan48Pixels
call .ComputePixels
@@ -38,9 +38,8 @@ _AnimateHPBar: ; d627
pop af
jr nc, .LongAnimLoop
ret
-; d65f
-.IsMaximumMoreThan48Pixels: ; d65f
+.IsMaximumMoreThan48Pixels:
ld a, [wCurHPAnimMaxHP + 1]
and a
jr nz, .player
@@ -53,9 +52,8 @@ _AnimateHPBar: ; d627
.player
scf
ret
-; d670
-.ComputePixels: ; d670
+.ComputePixels:
push hl
ld hl, wCurHPAnimMaxHP
ld a, [hli]
@@ -127,9 +125,8 @@ _AnimateHPBar: ; d627
ld a, e
ld [wCurHPAnimDeltaHP + 1], a
ret
-; d6e2
-ShortAnim_UpdateVariables: ; d6e2
+ShortAnim_UpdateVariables:
ld hl, wCurHPBarPixels
ld a, [wNewHPBarPixels]
cp [hl]
@@ -144,9 +141,8 @@ ShortAnim_UpdateVariables: ; d6e2
call ShortHPBar_CalcPixelFrame
and a
ret
-; d6f5
-LongAnim_UpdateVariables: ; d6f5
+LongAnim_UpdateVariables:
.loop
ld hl, wCurHPAnimOldHP
ld a, [hli]
@@ -199,9 +195,8 @@ LongAnim_UpdateVariables: ; d6f5
ld [hl], a
and a
ret
-; d730
-ShortHPBarAnim_UpdateTiles: ; d730
+ShortHPBarAnim_UpdateTiles:
call HPBarAnim_UpdateHPRemaining
ld d, HP_BAR_LENGTH
ld a, [wWhichHPBar]
@@ -215,9 +210,8 @@ ShortHPBarAnim_UpdateTiles: ; d730
pop de
call HPBarAnim_PaletteUpdate
ret
-; d749
-LongHPBarAnim_UpdateTiles: ; d749
+LongHPBarAnim_UpdateTiles:
call HPBarAnim_UpdateHPRemaining
ld a, [wCurHPAnimOldHP]
ld c, a
@@ -238,9 +232,8 @@ LongHPBarAnim_UpdateTiles: ; d749
pop de
call HPBarAnim_PaletteUpdate
ret
-; d771
-HPBarAnim_RedrawHPBar: ; d771
+HPBarAnim_RedrawHPBar:
ld a, [wWhichHPBar]
cp $2
jr nz, .skip
@@ -253,9 +246,8 @@ HPBarAnim_RedrawHPBar: ; d771
.skip
call DrawBattleHPBar
ret
-; d784
-HPBarAnim_UpdateHPRemaining: ; d784
+HPBarAnim_UpdateHPRemaining:
ld a, [wWhichHPBar]
and a
ret z
@@ -283,9 +275,8 @@ HPBarAnim_UpdateHPRemaining: ; d784
call PrintNum
pop hl
ret
-; d7b4
-HPBarAnim_PaletteUpdate: ; d7b4
+HPBarAnim_PaletteUpdate:
ld a, [hCGB]
and a
ret z
@@ -295,9 +286,8 @@ HPBarAnim_PaletteUpdate: ; d7b4
ld c, a
farcall ApplyHPBarPals
ret
-; d7c9
-HPBarAnim_BGMapUpdate: ; d7c9
+HPBarAnim_BGMapUpdate:
ld a, [hCGB]
and a
jr nz, .cgb
@@ -369,9 +359,8 @@ HPBarAnim_BGMapUpdate: ; d7c9
ld [hBGMapThird], a
call DelayFrame
ret
-; d839
-ShortHPBar_CalcPixelFrame: ; d839
+ShortHPBar_CalcPixelFrame:
ld a, [wCurHPAnimMaxHP]
ld c, a
ld b, 0
@@ -433,4 +422,3 @@ ShortHPBar_CalcPixelFrame: ; d839
ld a, [wCurHPAnimMaxHP]
ld [wCurHPAnimOldHP], a
ret
-; d88c
diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm
index 42dd440ea..3a9749b03 100644
--- a/engine/battle/battle_transition.asm
+++ b/engine/battle/battle_transition.asm
@@ -6,7 +6,7 @@ BATTLETRANSITION_NO_CAVE_STRONGER EQU $18
BATTLETRANSITION_FINISH EQU $20
BATTLETRANSITION_END EQU $80
-DoBattleTransition: ; 8c20f
+DoBattleTransition:
call .InitGFX
ld a, [rBGP]
ld [wBGP], a
@@ -58,9 +58,8 @@ DoBattleTransition: ; 8c20f
ld [hVBlank], a
call DelayFrame
ret
-; 8c26d
-.InitGFX: ; 8c26d
+.InitGFX:
ld a, [wLinkMode]
cp LINK_MOBILE
jr z, .mobile
@@ -87,14 +86,12 @@ DoBattleTransition: ; 8c20f
ld [hl], a
call WipeLYOverrides
ret
-; 8c2a0
-.NonMobile_LoadPokeballTiles: ; 8c2a0
+.NonMobile_LoadPokeballTiles:
call LoadTrainerBattlePokeballTiles
hlbgcoord 0, 0
call ConvertTrainerBattlePokeballTilesTo2bpp
ret
-; 8c2aa
LoadTrainerBattlePokeballTiles:
; Load the tiles used in the Pokeball Graphic that fills the screen
@@ -119,9 +116,8 @@ LoadTrainerBattlePokeballTiles:
pop af
ld [rVBK], a
ret
-; 8c2cf
-ConvertTrainerBattlePokeballTilesTo2bpp: ; 8c2cf
+ConvertTrainerBattlePokeballTilesTo2bpp:
ld a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
@@ -146,17 +142,15 @@ ConvertTrainerBattlePokeballTilesTo2bpp: ; 8c2cf
pop af
ld [rSVBK], a
ret
-; 8c2f4
-TrainerBattlePokeballTiles: ; 8c2f4
+TrainerBattlePokeballTiles:
INCBIN "gfx/overworld/trainer_battle_pokeball_tiles.2bpp"
-BattleTransitionJumptable: ; 8c314
+BattleTransitionJumptable:
jumptable .Jumptable, wJumptableIndex
-; 8c323
-.Jumptable ; 8c323 (23:4323)
+.Jumptable
dw StartTrainerBattle_DetermineWhichAnimation ; 00
; BATTLETRANSITION_CAVE
@@ -213,7 +207,7 @@ BattleTransitionJumptable: ; 8c314
TRANS_STRONGER_F EQU 0 ; bit set in TRANS_CAVE_STRONGER and TRANS_NO_CAVE_STRONGER
TRANS_NO_CAVE_F EQU 1 ; bit set in TRANS_NO_CAVE and TRANS_NO_CAVE_STRONGER
-StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
+StartTrainerBattle_DetermineWhichAnimation:
; The screen flashes a different number of times depending on the level of
; your lead Pokemon relative to the opponent's.
; BUG: wBattleMonLevel and wEnemyMonLevel are not set at this point, so whatever
@@ -240,41 +234,39 @@ StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
ld a, [hl]
ld [wJumptableIndex], a
ret
-; 8c38f (23:438f)
-.StartingPoints: ; 8c38f
+.StartingPoints:
; entries correspond to TRANS_* constants
db BATTLETRANSITION_CAVE
db BATTLETRANSITION_CAVE_STRONGER
db BATTLETRANSITION_NO_CAVE
db BATTLETRANSITION_NO_CAVE_STRONGER
-; 8c393
-StartTrainerBattle_Finish: ; 8c393 (23:4393)
+StartTrainerBattle_Finish:
call ClearSprites
ld a, BATTLETRANSITION_END
ld [wJumptableIndex], a
ret
-StartTrainerBattle_NextScene: ; 8c39c (23:439c)
+StartTrainerBattle_NextScene:
ld hl, wJumptableIndex
inc [hl]
ret
-StartTrainerBattle_SetUpBGMap: ; 8c3a1 (23:43a1)
+StartTrainerBattle_SetUpBGMap:
call StartTrainerBattle_NextScene
xor a
ld [wcf64], a
ld [hBGMapMode], a
ret
-StartTrainerBattle_Flash: ; 8c3ab (23:43ab)
+StartTrainerBattle_Flash:
call .DoFlashAnimation
ret nc
call StartTrainerBattle_NextScene
ret
-.DoFlashAnimation: ; 8c3b3 (23:43b3)
+.DoFlashAnimation:
ld a, [wTimeOfDayPalset]
cp %11111111 ; dark cave
jr z, .done
@@ -299,9 +291,8 @@ StartTrainerBattle_Flash: ; 8c3ab (23:43ab)
ld [wcf64], a
scf
ret
-; 8c3db (23:43db)
-.pals ; 8c3db
+.pals
db %11111001 ; 3321
db %11111110 ; 3332
db %11111111 ; 3333
@@ -315,9 +306,8 @@ StartTrainerBattle_Flash: ; 8c3ab (23:43ab)
db %10010000 ; 2100
db %11100100 ; 3210
db %00000001 ; 0001
-; 8c3e8
-StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8)
+StartTrainerBattle_SetUpForWavyOutro:
farcall Function5602
ld a, BANK(wLYOverrides)
ld [rSVBK], a
@@ -335,7 +325,7 @@ StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8)
ld [wcf65], a
ret
-StartTrainerBattle_SineWave: ; 8c408 (23:4408)
+StartTrainerBattle_SineWave:
ld a, [wcf64]
cp $60
jr nc, .end
@@ -347,7 +337,7 @@ StartTrainerBattle_SineWave: ; 8c408 (23:4408)
ld [wJumptableIndex], a
ret
-.DoSineWave: ; 8c419 (23:4419)
+.DoSineWave:
ld hl, wcf65
ld a, [hl]
inc [hl]
@@ -375,7 +365,7 @@ StartTrainerBattle_SineWave: ; 8c408 (23:4408)
jr nz, .loop
ret
-StartTrainerBattle_SetUpForSpinOutro: ; 8c43d (23:443d)
+StartTrainerBattle_SetUpForSpinOutro:
farcall Function5602
ld a, BANK(wLYOverrides)
ld [rSVBK], a
@@ -384,7 +374,7 @@ StartTrainerBattle_SetUpForSpinOutro: ; 8c43d (23:443d)
ld [wcf64], a
ret
-StartTrainerBattle_SpinToBlack: ; 8c44f (23:444f)
+StartTrainerBattle_SpinToBlack:
xor a
ld [hBGMapMode], a
ld a, [wcf64]
@@ -418,7 +408,6 @@ endr
ld a, BATTLETRANSITION_FINISH
ld [wJumptableIndex], a
ret
-; 8c490 (23:4490)
; quadrants
const_def
@@ -431,7 +420,7 @@ endr
RIGHT_QUADRANT_F EQU 0 ; bit set in UPPER_RIGHT and LOWER_RIGHT
LOWER_QUADRANT_F EQU 1 ; bit set in LOWER_LEFT and LOWER_RIGHT
-.spintable ; 8c490
+.spintable
spintable_entry: MACRO
db \1
dw .wedge\2
@@ -458,9 +447,8 @@ ENDM
spintable_entry LOWER_LEFT, 2, 0, 14
spintable_entry LOWER_LEFT, 1, 1, 11
db -1
-; 8c4f5
-.load ; 8c4f5 (23:44f5)
+.load
ld a, [hli]
ld e, a
ld a, [hli]
@@ -512,16 +500,14 @@ ENDM
dec c
jr nz, .loop2
jr .loop
-; 8c538 (23:4538)
.wedge1 db 2, 3, 5, 4, 9, -1
.wedge2 db 1, 1, 2, 2, 4, 2, 4, 2, 3, -1
.wedge3 db 2, 1, 3, 1, 4, 1, 4, 1, 4, 1, 3, 1, 2, 1, 1, 1, 1, -1
.wedge4 db 4, 1, 4, 0, 3, 1, 3, 0, 2, 1, 2, 0, 1, -1
.wedge5 db 4, 0, 3, 0, 3, 0, 2, 0, 2, 0, 1, 0, 1, 0, 1, -1
-; 8c578
-StartTrainerBattle_SetUpForRandomScatterOutro: ; 8c578 (23:4578)
+StartTrainerBattle_SetUpForRandomScatterOutro:
farcall Function5602
ld a, BANK(wLYOverrides)
ld [rSVBK], a
@@ -532,7 +518,7 @@ StartTrainerBattle_SetUpForRandomScatterOutro: ; 8c578 (23:4578)
ld [hBGMapMode], a
ret
-StartTrainerBattle_SpeckleToBlack: ; 8c58f (23:458f)
+StartTrainerBattle_SpeckleToBlack:
ld hl, wcf64
ld a, [hl]
and a
@@ -559,7 +545,7 @@ StartTrainerBattle_SpeckleToBlack: ; 8c58f (23:458f)
ld [wJumptableIndex], a
ret
-.BlackOutRandomTile: ; 8c5b8 (23:45b8)
+.BlackOutRandomTile:
.y_loop
call Random
cp SCREEN_HEIGHT
@@ -590,7 +576,7 @@ StartTrainerBattle_SpeckleToBlack: ; 8c58f (23:458f)
ld [hl], $ff
ret
-StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc)
+StartTrainerBattle_LoadPokeBallGraphics:
ld a, [wOtherTrainerClass]
and a
jp z, .nextscene ; don't need to be here if wild
@@ -690,11 +676,11 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc)
call DelayFrame
call BattleStart_CopyTilemapAtOnce
-.nextscene ; 8c673 (23:4673)
+.nextscene
call StartTrainerBattle_NextScene
ret
-.copypals ; 8c677 (23:4677)
+.copypals
ld de, wBGPals1 palette PAL_BG_TEXT
call .copy
ld de, wBGPals2 palette PAL_BG_TEXT
@@ -707,21 +693,18 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc)
call .copy
ld de, wOBPals2 palette PAL_OW_ROCK
-.copy ; 8c698 (23:4698)
+.copy
push hl
ld bc, 1 palettes
call CopyBytes
pop hl
ret
-; 8c6a1 (23:46a1)
-.daypals ; 8c6a1
+.daypals
INCLUDE "gfx/overworld/trainer_battle_day.pal"
-; 8c6a9
-.nightpals ; 8c6a9
+.nightpals
INCLUDE "gfx/overworld/trainer_battle_nite.pal"
-; 8c6b1
.loadpokeballgfx
ld a, [wOtherTrainerClass]
@@ -746,7 +729,7 @@ PokeBallTransition:
db %00001111, %11110000
db %00000011, %11000000
-WipeLYOverrides: ; 8c6d8
+WipeLYOverrides:
ld a, [rSVBK]
push af
ld a, BANK(wLYOverrides)
@@ -760,9 +743,8 @@ WipeLYOverrides: ; 8c6d8
pop af
ld [rSVBK], a
ret
-; 8c6ef
-.wipe ; 8c6ef
+.wipe
xor a
ld c, SCREEN_HEIGHT_PX
.loop
@@ -770,14 +752,12 @@ WipeLYOverrides: ; 8c6d8
dec c
jr nz, .loop
ret
-; 8c6f7
-StartTrainerBattle_DrawSineWave: ; 8c6f7 (23:46f7)
+StartTrainerBattle_DrawSineWave:
calc_sine_wave
-; 8c768
-StartTrainerBattle_ZoomToBlack: ; 8c768 (23:4768)
+StartTrainerBattle_ZoomToBlack:
farcall Function5602
ld de, .boxes
@@ -806,9 +786,8 @@ StartTrainerBattle_ZoomToBlack: ; 8c768 (23:4768)
ld a, BATTLETRANSITION_FINISH
ld [wJumptableIndex], a
ret
-; 8c792 (23:4792)
-.boxes ; 8c792
+.boxes
zoombox: MACRO
; width, height, start y, start x
db \1, \2
@@ -824,9 +803,8 @@ ENDM
zoombox 18, 16, 1, 1
zoombox 20, 18, 0, 0
db -1
-; 8c7b7
-.Copy: ; 8c7b7 (23:47b7)
+.Copy:
ld a, $ff
.row
push bc
@@ -842,7 +820,6 @@ ENDM
dec b
jr nz, .row
ret
-; 8c7c9 (23:47c9)
Unreferenced_Function8c7c9:
ld a, $1
diff --git a/engine/battle/battlestart_copytilemapatonce.asm b/engine/battle/battlestart_copytilemapatonce.asm
index 2952e833b..9d4d48d3a 100644
--- a/engine/battle/battlestart_copytilemapatonce.asm
+++ b/engine/battle/battlestart_copytilemapatonce.asm
@@ -1,3 +1,3 @@
-BattleStart_CopyTilemapAtOnce: ; 8cf4f
+BattleStart_CopyTilemapAtOnce:
call CGBOnly_CopyTilemapAtOnce
ret
diff --git a/engine/battle/check_battle_scene.asm b/engine/battle/check_battle_scene.asm
index 577c36e33..13d0c665e 100644
--- a/engine/battle/check_battle_scene.asm
+++ b/engine/battle/check_battle_scene.asm
@@ -1,4 +1,4 @@
-CheckBattleScene: ; 4ea44
+CheckBattleScene:
; Return carry if battle scene is turned off.
ld a, BANK(wLinkMode)
diff --git a/engine/battle/consume_held_item.asm b/engine/battle/consume_held_item.asm
index d727a44e0..fe63d40a8 100644
--- a/engine/battle/consume_held_item.asm
+++ b/engine/battle/consume_held_item.asm
@@ -1,4 +1,4 @@
-ConsumeHeldItem: ; 27192
+ConsumeHeldItem:
push hl
push de
push bc
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index f7e461c80..892ecd990 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -1,6 +1,6 @@
; Core components of the battle engine.
-DoBattle: ; 3c000
+DoBattle:
xor a
ld [wBattleParticipantsNotFainted], a
ld [wBattleParticipantsIncludingFainted], a
@@ -114,9 +114,8 @@ DoBattle: ; 3c000
.tutorial_debug
jp BattleMenu
-; 3c0e5
-WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5
+WildFled_EnemyFled_LinkBattleCanceled:
call Call_LoadTempTileMapToTileMap
ld a, [wBattleResult]
and BATTLERESULT_BITMASK
@@ -156,9 +155,8 @@ WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5
ld a, 1
ld [wBattleEnded], a
ret
-; 3c12f
-BattleTurn: ; 3c12f
+BattleTurn:
.loop
call Stubbed_Function3c1bf
call CheckContestBattleOver
@@ -229,7 +227,6 @@ BattleTurn: ; 3c12f
.quit
ret
-; 3c1bf
Stubbed_Function3c1bf:
ret
@@ -248,9 +245,8 @@ Stubbed_Function3c1bf:
.finish
call CloseSRAM
ret
-; 3c1d6
-HandleBetweenTurnEffects: ; 3c1d6
+HandleBetweenTurnEffects:
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .CheckEnemyFirst
@@ -297,9 +293,8 @@ HandleBetweenTurnEffects: ; 3c1d6
call UpdateBattleMonInParty
call LoadTileMapToTempTileMap
jp HandleEncore
-; 3c23c
-CheckFaint_PlayerThenEnemy: ; 3c23c
+CheckFaint_PlayerThenEnemy:
call HasPlayerFainted
jr nz, .PlayerNotFainted
call HandlePlayerMonFaint
@@ -322,9 +317,8 @@ CheckFaint_PlayerThenEnemy: ; 3c23c
.BattleIsOver:
scf
ret
-; 3c25c
-CheckFaint_EnemyThenPlayer: ; 3c25c
+CheckFaint_EnemyThenPlayer:
call HasEnemyFainted
jr nz, .EnemyNotFainted
call HandleEnemyMonFaint
@@ -347,9 +341,8 @@ CheckFaint_EnemyThenPlayer: ; 3c25c
.BattleIsOver:
scf
ret
-; 3c27c
-HandleBerserkGene: ; 3c27c
+HandleBerserkGene:
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .reverse
@@ -424,9 +417,8 @@ HandleBerserkGene: ; 3c27c
call SwitchTurnCore
ld hl, BecameConfusedText
jp StdBattleTextBox
-; 3c300
-EnemyTriesToFlee: ; 3c300
+EnemyTriesToFlee:
ld a, [wLinkMode]
and a
jr z, .not_linked
@@ -442,9 +434,8 @@ EnemyTriesToFlee: ; 3c300
call WildFled_EnemyFled_LinkBattleCanceled
scf
ret
-; 3c314
-DetermineMoveOrder: ; 3c314
+DetermineMoveOrder:
ld a, [wLinkMode]
and a
jr z, .use_move
@@ -560,14 +551,12 @@ DetermineMoveOrder: ; 3c314
.player_first
scf
ret
-; 3c3f3
-.enemy_first ; 3c3f3
+.enemy_first
and a
ret
-; 3c3f5
-CheckContestBattleOver: ; 3c3f5
+CheckContestBattleOver:
ld a, [wBattleType]
cp BATTLETYPE_CONTEST
jr nz, .contest_not_over
@@ -584,9 +573,8 @@ CheckContestBattleOver: ; 3c3f5
.contest_not_over
and a
ret
-; 3c410
-CheckPlayerLockedIn: ; 3c410
+CheckPlayerLockedIn:
ld a, [wPlayerSubStatus4]
and 1 << SUBSTATUS_RECHARGE
jp nz, .quit
@@ -610,9 +598,8 @@ CheckPlayerLockedIn: ; 3c410
.quit
scf
ret
-; 3c434
-ParsePlayerAction: ; 3c434
+ParsePlayerAction:
call CheckPlayerLockedIn
jp c, .locked_in
ld hl, wPlayerSubStatus5
@@ -706,9 +693,8 @@ ParsePlayerAction: ; 3c434
res SUBSTATUS_RAGE, [hl]
xor a
ret
-; 3c4df
-HandleEncore: ; 3c4df
+HandleEncore:
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .player_1
@@ -764,9 +750,8 @@ HandleEncore: ; 3c4df
call SetPlayerTurn
ld hl, BattleText_TargetsEncoreEnded
jp StdBattleTextBox
-; 3c543
-TryEnemyFlee: ; 3c543
+TryEnemyFlee:
ld a, [wBattleMode]
dec a
jr nz, .Stay
@@ -819,11 +804,10 @@ TryEnemyFlee: ; 3c543
.Flee:
scf
ret
-; 3c59a
INCLUDE "data/wild/flee_mons.asm"
-CompareMovePriority: ; 3c5b4
+CompareMovePriority:
; Compare the priority of the player and enemy's moves.
; Return carry if the player goes first, or z if they match.
@@ -836,9 +820,8 @@ CompareMovePriority: ; 3c5b4
pop bc
cp b
ret
-; 3c5c5
-GetMovePriority: ; 3c5c5
+GetMovePriority:
; Return the priority (0-3) of move a.
ld b, a
@@ -864,11 +847,10 @@ GetMovePriority: ; 3c5c5
.done
ld a, [hl]
ret
-; 3c5df
INCLUDE "data/moves/effects_priorities.asm"
-GetMoveEffect: ; 3c5ec
+GetMoveEffect:
ld a, b
dec a
ld hl, Moves + MOVE_EFFECT
@@ -878,9 +860,8 @@ GetMoveEffect: ; 3c5ec
call GetFarByte
ld b, a
ret
-; 3c5fe
-Battle_EnemyFirst: ; 3c5fe
+Battle_EnemyFirst:
call LoadTileMapToTempTileMap
call TryEnemyFlee
jp c, WildFled_EnemyFled_LinkBattleCanceled
@@ -922,9 +903,8 @@ Battle_EnemyFirst: ; 3c5fe
xor a
ld [wBattlePlayerAction], a
ret
-; 3c664
-Battle_PlayerFirst: ; 3c664
+Battle_PlayerFirst:
xor a
ld [wEnemyGoesFirst], a
call SetEnemyTurn
@@ -972,23 +952,20 @@ Battle_PlayerFirst: ; 3c664
xor a
ld [wBattlePlayerAction], a
ret
-; 3c6cf
-PlayerTurn_EndOpponentProtectEndureDestinyBond: ; 3c6cf
+PlayerTurn_EndOpponentProtectEndureDestinyBond:
call SetPlayerTurn
call EndUserDestinyBond
callfar DoPlayerTurn
jp EndOpponentProtectEndureDestinyBond
-; 3c6de
-EnemyTurn_EndOpponentProtectEndureDestinyBond: ; 3c6de
+EnemyTurn_EndOpponentProtectEndureDestinyBond:
call SetEnemyTurn
call EndUserDestinyBond
callfar DoEnemyTurn
jp EndOpponentProtectEndureDestinyBond
-; 3c6ed
-EndOpponentProtectEndureDestinyBond: ; 3c6ed
+EndOpponentProtectEndureDestinyBond:
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVarAddr
res SUBSTATUS_PROTECT, [hl]
@@ -997,33 +974,30 @@ EndOpponentProtectEndureDestinyBond: ; 3c6ed
call GetBattleVarAddr
res SUBSTATUS_DESTINY_BOND, [hl]
ret
-; 3c6fe
-EndUserDestinyBond: ; 3c6fe
+EndUserDestinyBond:
ld a, BATTLE_VARS_SUBSTATUS5
call GetBattleVarAddr
res SUBSTATUS_DESTINY_BOND, [hl]
ret
-; 3c706
-HasUserFainted: ; 3c706
+HasUserFainted:
ld a, [hBattleTurn]
and a
jr z, HasPlayerFainted
-HasEnemyFainted: ; 3c70b
+HasEnemyFainted:
ld hl, wEnemyMonHP
jr CheckIfHPIsZero
-HasPlayerFainted: ; 3c710
+HasPlayerFainted:
ld hl, wBattleMonHP
-CheckIfHPIsZero: ; 3c713
+CheckIfHPIsZero:
ld a, [hli]
or [hl]
ret
-; 3c716
-ResidualDamage: ; 3c716
+ResidualDamage:
; Return z if the user fainted before
; or as a result of residual damage.
; For Sandstorm damage, see HandleWeather.
@@ -1158,9 +1132,8 @@ ResidualDamage: ; 3c716
call DelayFrames
xor a
ret
-; 3c801
-HandlePerishSong: ; 3c801
+HandlePerishSong:
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .EnemyFirst
@@ -1227,9 +1200,8 @@ HandlePerishSong: ; 3c801
ld [hli], a
ld [hl], a
ret
-; 3c874
-HandleWrap: ; 3c874
+HandleWrap:
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .EnemyFirst
@@ -1292,16 +1264,14 @@ HandleWrap: ; 3c874
.print_text
jp StdBattleTextBox
-; 3c8e4
-SwitchTurnCore: ; 3c8e4
+SwitchTurnCore:
ld a, [hBattleTurn]
xor 1
ld [hBattleTurn], a
ret
-; 3c8eb
-HandleLeftovers: ; 3c8eb
+HandleLeftovers:
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .DoEnemyFirst
@@ -1349,9 +1319,8 @@ HandleLeftovers: ; 3c8eb
call RestoreHP
ld hl, BattleText_TargetRecoveredWithItem
jp StdBattleTextBox
-; 3c93c
-HandleMysteryberry: ; 3c93c
+HandleMysteryberry:
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .DoEnemyFirst
@@ -1488,9 +1457,8 @@ HandleMysteryberry: ; 3c93c
call SwitchTurnCore
ld hl, BattleText_UserRecoveredPPUsing
jp StdBattleTextBox
-; 3ca26
-HandleFutureSight: ; 3ca26
+HandleFutureSight:
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .enemy_first
@@ -1547,9 +1515,8 @@ HandleFutureSight: ; 3ca26
call UpdateBattleMonInParty
jp UpdateEnemyMonInParty
-; 3ca8f
-HandleDefrost: ; 3ca8f
+HandleDefrost:
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .enemy_first
@@ -1607,9 +1574,8 @@ HandleDefrost: ; 3ca8f
call SetPlayerTurn
ld hl, DefrostedOpponentText
jp StdBattleTextBox
-; 3cafb
-HandleSafeguard: ; 3cafb
+HandleSafeguard:
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .player1
@@ -1646,7 +1612,7 @@ HandleSafeguard: ; 3cafb
ld hl, BattleText_SafeguardFaded
jp StdBattleTextBox
-HandleScreens: ; 3cb36
+HandleScreens:
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .Both
@@ -1681,15 +1647,13 @@ HandleScreens: ; 3cb36
.Copy:
ld hl, wStringBuffer1
jp CopyName2
-; 3cb75
.Your:
db "Your@"
.Enemy:
db "Enemy@"
-; 3cb80
-.LightScreenTick: ; 3cb80
+.LightScreenTick:
ld a, [de]
dec a
ld [de], a
@@ -1702,9 +1666,8 @@ HandleScreens: ; 3cb36
pop de
pop hl
ret
-; 3cb91
-.ReflectTick: ; 3cb91
+.ReflectTick:
inc de
ld a, [de]
dec a
@@ -1713,9 +1676,8 @@ HandleScreens: ; 3cb36
res SCREENS_REFLECT, [hl]
ld hl, BattleText_MonsReflectFaded
jp StdBattleTextBox
-; 3cb9e
-HandleWeather: ; 3cb9e
+HandleWeather:
ld a, [wBattleWeather]
cp WEATHER_NONE
ret z
@@ -1804,7 +1766,6 @@ HandleWeather: ; 3cb9e
ld h, [hl]
ld l, a
jp StdBattleTextBox
-; 3cc2d
.WeatherMessages:
; entries correspond to WEATHER_* constants
@@ -1817,20 +1778,17 @@ HandleWeather: ; 3cb9e
dw BattleText_TheRainStopped
dw BattleText_TheSunlightFaded
dw BattleText_TheSandstormSubsided
-; 3cc39
-SubtractHPFromTarget: ; 3cc39
+SubtractHPFromTarget:
call SubtractHP
jp UpdateHPBar
-; 3cc3f
-SubtractHPFromUser: ; 3cc3f
+SubtractHPFromUser:
; Subtract HP from mon
call SubtractHP
jp UpdateHPBarBattleHuds
-; 3cc45
-SubtractHP: ; 3cc45
+SubtractHP:
ld hl, wBattleMonHP
ld a, [hBattleTurn]
and a
@@ -1860,9 +1818,8 @@ SubtractHP: ; 3cc45
ld [wBuffer5], a
ld [wBuffer6], a
ret
-; 3cc76
-GetSixteenthMaxHP: ; 3cc76
+GetSixteenthMaxHP:
call GetQuarterMaxHP
; quarter result
srl c
@@ -1874,9 +1831,8 @@ GetSixteenthMaxHP: ; 3cc76
inc c
.ok
ret
-; 3cc83
-GetEighthMaxHP: ; 3cc83
+GetEighthMaxHP:
; output: bc
call GetQuarterMaxHP
; assumes nothing can have 1024 or more hp
@@ -1889,9 +1845,8 @@ GetEighthMaxHP: ; 3cc83
inc c
.end
ret
-; 3cc8e
-GetQuarterMaxHP: ; 3cc8e
+GetQuarterMaxHP:
; output: bc
call GetMaxHP
@@ -1909,9 +1864,8 @@ GetQuarterMaxHP: ; 3cc8e
inc c
.end
ret
-; 3cc9f
-GetHalfMaxHP: ; 3cc9f
+GetHalfMaxHP:
; output: bc
call GetMaxHP
@@ -1926,9 +1880,8 @@ GetHalfMaxHP: ; 3cc9f
inc c
.end
ret
-; 3ccac
-GetMaxHP: ; 3ccac
+GetMaxHP:
; output: bc, wBuffer1-2
ld hl, wBattleMonMaxHP
@@ -1945,9 +1898,8 @@ GetMaxHP: ; 3ccac
ld [wBuffer1], a
ld c, a
ret
-; 3ccc2
-Unreferenced_GetHalfHP: ; 3ccc2
+Unreferenced_GetHalfHP:
ld hl, wBattleMonHP
ld a, [hBattleTurn]
and a
@@ -1965,9 +1917,8 @@ Unreferenced_GetHalfHP: ; 3ccc2
ld a, [hl]
ld [wBuffer1], a
ret
-; 3ccde
-CheckUserHasEnoughHP: ; 3ccde
+CheckUserHasEnoughHP:
ld hl, wBattleMonHP + 1
ld a, [hBattleTurn]
and a
@@ -1980,9 +1931,8 @@ CheckUserHasEnoughHP: ; 3ccde
ld a, b
sbc [hl]
ret
-; 3ccef
-RestoreHP ; 3ccef
+RestoreHP
ld hl, wEnemyMonMaxHP
ld a, [hBattleTurn]
and a
@@ -2025,14 +1975,12 @@ RestoreHP ; 3ccef
call SwitchTurnCore
call UpdateHPBarBattleHuds
jp SwitchTurnCore
-; 3cd36
-UpdateHPBarBattleHuds: ; 3cd36
+UpdateHPBarBattleHuds:
call UpdateHPBar
jp UpdateBattleHuds
-; 3cd3c
-UpdateHPBar: ; 3cd3c
+UpdateHPBar:
hlcoord 10, 9
ld a, [hBattleTurn]
and a
@@ -2046,9 +1994,8 @@ UpdateHPBar: ; 3cd3c
predef AnimateHPBar
pop bc
ret
-; 3cd55
-HandleEnemyMonFaint: ; 3cd55
+HandleEnemyMonFaint:
call FaintEnemyPokemon
ld hl, wBattleMonHP
ld a, [hli]
@@ -2115,9 +2062,8 @@ HandleEnemyMonFaint: ; 3cd55
xor a
ld [wBattlePlayerAction], a
ret
-; 3cdca
-DoubleSwitch: ; 3cdca
+DoubleSwitch:
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .player_1
@@ -2145,9 +2091,8 @@ DoubleSwitch: ; 3cdca
xor a
ld [wBattlePlayerAction], a
ret
-; 3ce01
-UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01
+UpdateBattleStateAndExperienceAfterEnemyFaint:
call UpdateBattleMonInParty
ld a, [wBattleMode]
dec a
@@ -2236,9 +2181,8 @@ UpdateBattleStateAndExperienceAfterEnemyFaint: ; 3ce01
pop af
ld [wBattleParticipantsNotFainted], a
ret
-; 3ceaa
-IsAnyMonHoldingExpShare: ; 3ceaa
+IsAnyMonHoldingExpShare:
ld a, [wPartyCount]
ld b, a
ld hl, wPartyMon1
@@ -2292,15 +2236,13 @@ IsAnyMonHoldingExpShare: ; 3ceaa
ld a, e
and a
ret
-; 3ceec
-StopDangerSound: ; 3ceec
+StopDangerSound:
xor a
ld [wLowHealthAlarm], a
ret
-; 3cef1
-FaintYourPokemon: ; 3cef1
+FaintYourPokemon:
call StopDangerSound
call WaitSFX
ld a, $f0
@@ -2313,9 +2255,8 @@ FaintYourPokemon: ; 3cef1
call ClearBox
ld hl, BattleText_MonFainted
jp StdBattleTextBox
-; 3cf14
-FaintEnemyPokemon: ; 3cf14
+FaintEnemyPokemon:
call WaitSFX
ld de, SFX_KINESIS
call PlaySFX
@@ -2327,9 +2268,8 @@ FaintEnemyPokemon: ; 3cf14
call ClearBox
ld hl, BattleText_EnemyMonFainted
jp StdBattleTextBox
-; 3cf35
-CheckEnemyTrainerDefeated: ; 3cf35
+CheckEnemyTrainerDefeated:
ld a, [wOTPartyCount]
ld b, a
xor a
@@ -2347,9 +2287,8 @@ CheckEnemyTrainerDefeated: ; 3cf35
and a
ret
-; 3cf4a
-HandleEnemySwitch: ; 3cf4a
+HandleEnemySwitch:
ld hl, wEnemyHPPal
ld e, HP_BAR_LENGTH_PX
call UpdateHPPal
@@ -2374,9 +2313,8 @@ HandleEnemySwitch: ; 3cf4a
jr nz, EnemyPartyMonEntrance
inc a
ret
-; 3cf78
-EnemyPartyMonEntrance: ; 3cf78
+EnemyPartyMonEntrance:
push af
xor a
ld [wEnemySwitchMonIndex], a
@@ -2400,9 +2338,8 @@ EnemyPartyMonEntrance: ; 3cf78
ld [wBattlePlayerAction], a
inc a
ret
-; 3cfa4
-WinTrainerBattle: ; 3cfa4
+WinTrainerBattle:
; Player won the battle
call StopDangerSound
ld a, $1
@@ -2524,27 +2461,24 @@ WinTrainerBattle: ; 3cfa4
.KeepItAll:
ld hl, GotMoneyForWinningText
jp StdBattleTextBox
-; 3d081
-.AddMoneyToMom: ; 3d081
+.AddMoneyToMom:
push bc
ld hl, wBattleReward + 2
ld de, wMomsMoney + 2
call AddBattleMoneyToAccount
pop bc
ret
-; 3d08d
-.AddMoneyToWallet: ; 3d08d
+.AddMoneyToWallet:
push bc
ld hl, wBattleReward + 2
ld de, wMoney + 2
call AddBattleMoneyToAccount
pop bc
ret
-; 3d099
-.DoubleReward: ; 3d099
+.DoubleReward:
ld hl, wBattleReward + 2
sla [hl]
dec hl
@@ -2557,16 +2491,14 @@ WinTrainerBattle: ; 3cfa4
ld [hli], a
ld [hl], a
ret
-; 3d0ab
-.SentToMomTexts: ; 3d0ab
+.SentToMomTexts:
; entries correspond to MOM_SAVING_* constants
dw SentSomeToMomText
dw SentHalfToMomText
dw SentAllToMomText
-; 3d0b1
-.CheckMaxedOutMomMoney: ; 3d0b1
+.CheckMaxedOutMomMoney:
ld hl, wMomsMoney + 2
ld a, [hld]
cp LOW(MAX_MONEY)
@@ -2575,9 +2507,8 @@ WinTrainerBattle: ; 3cfa4
ld a, [hl]
sbc HIGH(MAX_MONEY >> 8)
ret
-; 3d0be
-AddBattleMoneyToAccount: ; 3d0be
+AddBattleMoneyToAccount:
ld c, 3
and a
push de
@@ -2610,9 +2541,8 @@ AddBattleMoneyToAccount: ; 3d0be
inc hl
ld [hl], LOW(MAX_MONEY)
ret
-; 3d0ea
-PlayVictoryMusic: ; 3d0ea
+PlayVictoryMusic:
push de
ld de, MUSIC_NONE
call PlayMusic
@@ -2646,7 +2576,6 @@ PlayVictoryMusic: ; 3d0ea
.lost
pop de
ret
-; 3d123
IsKantoGymLeader: ; 0x3d123
ld hl, KantoGymLeaders
@@ -2665,7 +2594,7 @@ IsGymLeaderCommon:
INCLUDE "data/trainers/leaders.asm"
-HandlePlayerMonFaint: ; 3d14e
+HandlePlayerMonFaint:
call FaintYourPokemon
ld hl, wEnemyMonHP
ld a, [hli]
@@ -2713,9 +2642,8 @@ HandlePlayerMonFaint: ; 3d14e
call HandleEnemySwitch
jp z, WildFled_EnemyFled_LinkBattleCanceled
jp DoubleSwitch
-; 3d1aa
-PlayerMonFaintHappinessMod: ; 3d1aa
+PlayerMonFaintHappinessMod:
ld a, [wCurBattleMon]
ld c, a
ld hl, wBattleParticipantsNotFainted
@@ -2752,9 +2680,8 @@ PlayerMonFaintHappinessMod: ; 3d1aa
and a
ret z
ret ; ??????????
-; 3d1f8
-AskUseNextPokemon: ; 3d1f8
+AskUseNextPokemon:
call EmptyBattleTextBox
call LoadTileMapToTempTileMap
; We don't need to be here if we're in a Trainer battle,
@@ -2781,9 +2708,8 @@ AskUseNextPokemon: ; 3d1f8
ld hl, wPartyMon1Speed
ld de, wEnemyMonSpeed
jp TryToRunAwayFromBattle
-; 3d227
-ForcePlayerMonChoice: ; 3d227
+ForcePlayerMonChoice:
call EmptyBattleTextBox
call LoadStandardMenuHeader
call SetUpBattlePartyMenu_NoLoop
@@ -2845,9 +2771,8 @@ ForcePlayerMonChoice: ; 3d227
and a
ld c, a
ret
-; 3d2b3
-PlayerPartyMonEntrance: ; 3d2b3
+PlayerPartyMonEntrance:
ld a, [wCurBattleMon]
ld [wLastPlayerMon], a
ld a, [wCurPartyMon]
@@ -2863,9 +2788,8 @@ PlayerPartyMonEntrance: ; 3d2b3
call LoadTileMapToTempTileMap
call SetPlayerTurn
jp SpikesDamage
-; 3d2e0
-CheckMobileBattleError: ; 3d2e0
+CheckMobileBattleError:
ld a, [wLinkMode]
cp LINK_MOBILE
jr nz, .not_mobile ; It's not a mobile battle
@@ -2881,15 +2805,13 @@ CheckMobileBattleError: ; 3d2e0
.not_mobile
xor a
ret
-; 3d2f1
-IsMobileBattle: ; 3d2f1
+IsMobileBattle:
ld a, [wLinkMode]
cp LINK_MOBILE
ret
-; 3d2f7
-SetUpBattlePartyMenu_NoLoop: ; 3d2f7
+SetUpBattlePartyMenu_NoLoop:
call ClearBGPalettes
SetUpBattlePartyMenu: ; switch to fullscreen menu?
farcall LoadPartyMenuGFX
@@ -2897,18 +2819,16 @@ SetUpBattlePartyMenu: ; switch to fullscreen menu?
farcall InitPartyMenuBGPal7
farcall InitPartyMenuGFX
ret
-; 3d313
-JumpToPartyMenuAndPrintText: ; 3d313
+JumpToPartyMenuAndPrintText:
farcall WritePartyMenuTilemap
farcall PrintPartyMenuText
call WaitBGMap
call SetPalettes
call DelayFrame
ret
-; 3d329
-SelectBattleMon: ; 3d329
+SelectBattleMon:
call IsMobileBattle
jr z, .mobile
farcall PartyMenuSelect
@@ -2917,9 +2837,8 @@ SelectBattleMon: ; 3d329
.mobile
farcall Mobile_PartyMenuSelect
ret
-; 3d33c
-PickPartyMonInBattle: ; 3d33c
+PickPartyMonInBattle:
.loop
ld a, PARTYMENUACTION_SWITCH ; Which PKMN?
ld [wPartyMenuActionText], a
@@ -2930,9 +2849,8 @@ PickPartyMonInBattle: ; 3d33c
jr z, .loop
xor a
ret
-; 3d34f
-SwitchMonAlreadyOut: ; 3d34f
+SwitchMonAlreadyOut:
ld hl, wCurBattleMon
ld a, [wCurPartyMon]
cp [hl]
@@ -2946,9 +2864,8 @@ SwitchMonAlreadyOut: ; 3d34f
.notout
xor a
ret
-; 3d362
-ForcePickPartyMonInBattle: ; 3d362
+ForcePickPartyMonInBattle:
; Can't back out.
.pick
@@ -2961,9 +2878,8 @@ ForcePickPartyMonInBattle: ; 3d362
call PlaySFX
call WaitSFX
jr .pick
-; 3d375
-PickSwitchMonInBattle: ; 3d375
+PickSwitchMonInBattle:
.pick
call PickPartyMonInBattle
ret c
@@ -2971,9 +2887,8 @@ PickSwitchMonInBattle: ; 3d375
jr c, .pick
xor a
ret
-; 3d380
-ForcePickSwitchMonInBattle: ; 3d380
+ForcePickSwitchMonInBattle:
; Can't back out.
.pick
@@ -2985,9 +2900,8 @@ ForcePickSwitchMonInBattle: ; 3d380
xor a
ret
-; 3d38e
-LostBattle: ; 3d38e
+LostBattle:
ld a, 1
ld [wBattleEnded], a
@@ -3081,21 +2995,18 @@ LostBattle: ; 3d38e
farcall Mobile_PrintOpponentBattleMessage
scf
ret
-; 3d432
-EnemyMonFaintedAnimation: ; 3d432
+EnemyMonFaintedAnimation:
hlcoord 12, 5
decoord 12, 6
jp MonFaintedAnimation
-; 3d43b
-PlayerMonFaintedAnimation: ; 3d43b
+PlayerMonFaintedAnimation:
hlcoord 1, 10
decoord 1, 11
jp MonFaintedAnimation
-; 3d444
-MonFaintedAnimation: ; 3d444
+MonFaintedAnimation:
ld a, [wcfbe]
push af
set 6, a
@@ -3144,13 +3055,11 @@ MonFaintedAnimation: ; 3d444
pop af
ld [wcfbe], a
ret
-; 3d488
.Spaces:
db " @"
-; 3d490
-SlideBattlePicOut: ; 3d490
+SlideBattlePicOut:
ld [hMapObjectIndexBuffer], a
ld c, a
.loop
@@ -3172,9 +3081,8 @@ SlideBattlePicOut: ; 3d490
dec c
jr nz, .loop
ret
-; 3d4ae
-.DoFrame: ; 3d4ae
+.DoFrame:
ld a, [hMapObjectIndexBuffer]
ld c, a
cp $8
@@ -3194,9 +3102,8 @@ SlideBattlePicOut: ; 3d490
dec c
jr nz, .back
ret
-; 3d4c3
-ForceEnemySwitch: ; 3d4c3
+ForceEnemySwitch:
call ResetEnemyBattleVars
ld a, [wEnemySwitchMonIndex]
dec a
@@ -3209,9 +3116,8 @@ ForceEnemySwitch: ; 3d4c3
call BreakAttraction
call ResetBattleParticipants
ret
-; 3d4e1
-EnemySwitch: ; 3d4e1
+EnemySwitch:
call CheckWhetherToAskSwitch
jr nc, EnemySwitch_SetMode
; Shift Mode
@@ -3238,9 +3144,8 @@ EnemySwitch: ; 3d4e1
ld [wEnemyIsSwitching], a
call LoadTileMapToTempTileMap
jp PlayerSwitch
-; 3d517
-EnemySwitch_SetMode: ; 3d517
+EnemySwitch_SetMode:
call ResetEnemyBattleVars
call CheckWhetherSwitchmonIsPredetermined
jr c, .skip
@@ -3253,9 +3158,8 @@ EnemySwitch_SetMode: ; 3d517
call ClearEnemyMonBox
call Function_BattleTextEnemySentOut
jp Function_SetEnemyMonAndSendOutAnimation
-; 3d533
-CheckWhetherSwitchmonIsPredetermined: ; 3d533
+CheckWhetherSwitchmonIsPredetermined:
; returns carry if: ???
ld a, [wLinkMode]
and a
@@ -3287,9 +3191,8 @@ CheckWhetherSwitchmonIsPredetermined: ; 3d533
.return_carry
scf
ret
-; 3d557
-ResetEnemyBattleVars: ; 3d557
+ResetEnemyBattleVars:
; and draw empty TextBox
xor a
ld [wLastPlayerCounterMove], a
@@ -3305,13 +3208,12 @@ ResetEnemyBattleVars: ; 3d557
call SlideBattlePicOut
call EmptyBattleTextBox
jp LoadStandardMenuHeader
-; 3d57a
-ResetBattleParticipants: ; 3d57a
+ResetBattleParticipants:
xor a
ld [wBattleParticipantsNotFainted], a
ld [wBattleParticipantsIncludingFainted], a
-AddBattleParticipant: ; 3d581
+AddBattleParticipant:
ld a, [wCurBattleMon]
ld c, a
ld hl, wBattleParticipantsNotFainted
@@ -3321,9 +3223,8 @@ AddBattleParticipant: ; 3d581
pop bc
ld hl, wBattleParticipantsIncludingFainted
predef_jump SmallFarFlagAction
-; 3d599
-FindMonInOTPartyToSwitchIntoBattle: ; 3d599
+FindMonInOTPartyToSwitchIntoBattle:
ld b, -1
ld a, $1
ld [wBuffer1], a
@@ -3358,9 +3259,8 @@ FindMonInOTPartyToSwitchIntoBattle: ; 3d599
ld hl, wBuffer2
set 0, [hl]
jr .loop
-; 3d5d7
-LookUpTheEffectivenessOfEveryMove: ; 3d5d7
+LookUpTheEffectivenessOfEveryMove:
push bc
ld hl, wOTPartyMon1Moves
ld a, b
@@ -3396,9 +3296,8 @@ LookUpTheEffectivenessOfEveryMove: ; 3d5d7
ret
.done
ret
-; 3d618
-IsThePlayerMonTypesEffectiveAgainstOTMon: ; 3d618
+IsThePlayerMonTypesEffectiveAgainstOTMon:
; Calculates the effectiveness of the types of the PlayerMon
; against the OTMon
push bc
@@ -3445,9 +3344,8 @@ IsThePlayerMonTypesEffectiveAgainstOTMon: ; 3d618
.reset
res 0, [hl]
ret
-; 3d672
-ScoreMonTypeMatchups: ; 3d672
+ScoreMonTypeMatchups:
.loop1
ld hl, wBuffer1
sla [hl]
@@ -3510,9 +3408,8 @@ ScoreMonTypeMatchups: ; 3d672
.quit
ret
-; 3d6ca
-LoadEnemyMonToSwitchTo: ; 3d6ca
+LoadEnemyMonToSwitchTo:
; 'b' contains the PartyNr of the mon the AI will switch to
ld a, b
ld [wCurPartyMon], a
@@ -3549,9 +3446,8 @@ LoadEnemyMonToSwitchTo: ; 3d6ca
ld a, [hl]
ld [wEnemyHPAtTimeOfPlayerSwitch + 1], a
ret
-; 3d714
-CheckWhetherToAskSwitch: ; 3d714
+CheckWhetherToAskSwitch:
ld a, [wBattleHasJustStarted]
dec a
jp z, .return_nc
@@ -3579,9 +3475,8 @@ CheckWhetherToAskSwitch: ; 3d714
.return_nc
and a
ret
-; 3d74b
-OfferSwitch: ; 3d74b
+OfferSwitch:
ld a, [wCurPartyMon]
push af
callfar Battle_GetTrainerName
@@ -3620,9 +3515,8 @@ OfferSwitch: ; 3d74b
ld [wCurPartyMon], a
scf
ret
-; 3d7a0
-ClearEnemyMonBox: ; 3d7a0
+ClearEnemyMonBox:
xor a
ld [hBGMapMode], a
call ExitMenu
@@ -3632,16 +3526,14 @@ ClearEnemyMonBox: ; 3d7a0
call ClearBox
call WaitBGMap
jp FinishBattleAnim
-; 3d7b8
-Function_BattleTextEnemySentOut: ; 3d7b8
+Function_BattleTextEnemySentOut:
callfar Battle_GetTrainerName
ld hl, BattleText_EnemySentOut
call StdBattleTextBox
jp WaitBGMap
-; 3d7c7
-Function_SetEnemyMonAndSendOutAnimation: ; 3d7c7
+Function_SetEnemyMonAndSendOutAnimation:
ld a, [wTempEnemyMonSpecies]
ld [wCurPartySpecies], a
ld [wCurSpecies], a
@@ -3688,9 +3580,8 @@ Function_SetEnemyMonAndSendOutAnimation: ; 3d7c7
ld a, $1
ld [hBGMapMode], a
ret
-; 3d834
-NewEnemyMonStatus: ; 3d834
+NewEnemyMonStatus:
xor a
ld [wLastPlayerCounterMove], a
ld [wLastEnemyCounterMove], a
@@ -3712,9 +3603,8 @@ endr
ld hl, wPlayerSubStatus5
res SUBSTATUS_CANT_RUN, [hl]
ret
-; 3d867
-ResetEnemyStatLevels: ; 3d867
+ResetEnemyStatLevels:
ld a, BASE_STAT_LEVEL
ld b, NUM_LEVEL_STATS
ld hl, wEnemyStatLevels
@@ -3723,9 +3613,8 @@ ResetEnemyStatLevels: ; 3d867
dec b
jr nz, .loop
ret
-; 3d873
-CheckPlayerPartyForFitMon: ; 3d873
+CheckPlayerPartyForFitMon:
; Has the player any mon in his Party that can fight?
ld a, [wPartyCount]
ld e, a
@@ -3741,9 +3630,8 @@ CheckPlayerPartyForFitMon: ; 3d873
jr nz, .loop
ld d, a
ret
-; 3d887
-CheckIfCurPartyMonIsFitToFight: ; 3d887
+CheckIfCurPartyMonIsFitToFight:
ld a, [wCurPartyMon]
ld hl, wPartyMon1HP
call GetPartyLocation
@@ -3772,9 +3660,8 @@ CheckIfCurPartyMonIsFitToFight: ; 3d887
.finish_fail
xor a
ret
-; 3d8b3
-TryToRunAwayFromBattle: ; 3d8b3
+TryToRunAwayFromBattle:
; Run away from battle, with or without item
ld a, [wBattleType]
cp BATTLETYPE_DEBUG
@@ -3961,9 +3848,8 @@ TryToRunAwayFromBattle: ; 3d8b3
call LoadTileMapToTempTileMap
scf
ret
-; 3da0d
-InitBattleMon: ; 3da0d
+InitBattleMon:
ld a, MON_SPECIES
call GetPartyParamLocation
ld de, wBattleMonSpecies
@@ -4002,23 +3888,21 @@ InitBattleMon: ; 3da0d
call ApplyStatusEffectOnPlayerStats
call BadgeStatBoosts
ret
-; 3da74
-BattleCheckPlayerShininess: ; 3da74
+BattleCheckPlayerShininess:
call GetPartyMonDVs
jr BattleCheckShininess
-BattleCheckEnemyShininess: ; 3da79
+BattleCheckEnemyShininess:
call GetEnemyMonDVs
-BattleCheckShininess: ; 3da7c
+BattleCheckShininess:
ld b, h
ld c, l
callfar CheckShininess
ret
-; 3da85
-GetPartyMonDVs: ; 3da85
+GetPartyMonDVs:
ld hl, wBattleMonDVs
ld a, [wPlayerSubStatus5]
bit SUBSTATUS_TRANSFORMED, a
@@ -4026,9 +3910,8 @@ GetPartyMonDVs: ; 3da85
ld hl, wPartyMon1DVs
ld a, [wCurBattleMon]
jp GetPartyLocation
-; 3da97
-GetEnemyMonDVs: ; 3da97
+GetEnemyMonDVs:
ld hl, wEnemyMonDVs
ld a, [wEnemySubStatus5]
bit SUBSTATUS_TRANSFORMED, a
@@ -4040,9 +3923,8 @@ GetEnemyMonDVs: ; 3da97
ld hl, wOTPartyMon1DVs
ld a, [wCurOTMon]
jp GetPartyLocation
-; 3dab1
-ResetPlayerStatLevels: ; 3dab1
+ResetPlayerStatLevels:
ld a, BASE_STAT_LEVEL
ld b, NUM_LEVEL_STATS
ld hl, wPlayerStatLevels
@@ -4051,9 +3933,8 @@ ResetPlayerStatLevels: ; 3dab1
dec b
jr nz, .loop
ret
-; 3dabd
-InitEnemyMon: ; 3dabd
+InitEnemyMon:
ld a, [wCurPartyMon]
ld hl, wOTPartyMon1Species
call GetPartyLocation
@@ -4104,9 +3985,8 @@ InitEnemyMon: ; 3dabd
ld a, [wCurPartyMon]
ld [wCurOTMon], a
ret
-; 3db32
-SwitchPlayerMon: ; 3db32
+SwitchPlayerMon:
call ClearSprites
ld a, [wCurBattleMon]
ld [wLastPlayerMon], a
@@ -4124,9 +4004,8 @@ SwitchPlayerMon: ; 3db32
ld a, [hli]
or [hl]
ret
-; 3db5f
-SendOutPlayerMon: ; 3db5f
+SendOutPlayerMon:
ld hl, wBattleMonDVs
predef GetUnownLetter
hlcoord 1, 5
@@ -4180,9 +4059,8 @@ SendOutPlayerMon: ; 3db5f
ld a, $1
ld [hBGMapMode], a
ret
-; 3dbde
-NewBattleMonStatus: ; 3dbde
+NewBattleMonStatus:
xor a
ld [wLastPlayerCounterMove], a
ld [wLastEnemyCounterMove], a
@@ -4209,17 +4087,15 @@ endr
ld hl, wEnemySubStatus5
res SUBSTATUS_CANT_RUN, [hl]
ret
-; 3dc18
-BreakAttraction: ; 3dc18
+BreakAttraction:
ld hl, wPlayerSubStatus1
res SUBSTATUS_IN_LOVE, [hl]
ld hl, wEnemySubStatus1
res SUBSTATUS_IN_LOVE, [hl]
ret
-; 3dc23
-SpikesDamage: ; 3dc23
+SpikesDamage:
ld hl, wPlayerScreens
ld de, wBattleMonType
ld bc, UpdatePlayerHUD
@@ -4258,9 +4134,8 @@ SpikesDamage: ; 3dc23
.hl
jp hl
-; 3dc5b
-PursuitSwitch: ; 3dc5b
+PursuitSwitch:
ld a, BATTLE_VARS_MOVE
call GetBattleVar
ld b, a
@@ -4338,9 +4213,8 @@ PursuitSwitch: ; 3dc5b
.done
and a
ret
-; 3dce6
-RecallPlayerMon: ; 3dce6
+RecallPlayerMon:
ld a, [hBattleTurn]
push af
xor a
@@ -4351,9 +4225,8 @@ RecallPlayerMon: ; 3dce6
pop af
ld [hBattleTurn], a
ret
-; 3dcf9
-HandleHealingItems: ; 3dcf9
+HandleHealingItems:
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .player_1
@@ -4375,9 +4248,8 @@ HandleHealingItems: ; 3dcf9
call HandleHPHealingItem
call UseHeldStatusHealingItem
jp UseConfusionHealingItem
-; 3dd2f
-HandleHPHealingItem: ; 3dd2f
+HandleHPHealingItem:
callfar GetOpponentItem
ld a, b
cp HELD_BERRY
@@ -4469,9 +4341,8 @@ UseOpponentItem:
callfar ConsumeHeldItem
ld hl, RecoveredUsingText
jp StdBattleTextBox
-; 3ddc8
-ItemRecoveryAnim: ; 3ddc8
+ItemRecoveryAnim:
push hl
push de
push bc
@@ -4488,9 +4359,8 @@ ItemRecoveryAnim: ; 3ddc8
pop de
pop hl
ret
-; 3dde9
-UseHeldStatusHealingItem: ; 3dde9
+UseHeldStatusHealingItem:
callfar GetOpponentItem
ld hl, HeldStatusHealingEffects
.loop
@@ -4543,11 +4413,10 @@ UseHeldStatusHealingItem: ; 3dde9
ld a, $1
and a
ret
-; 3de44
INCLUDE "data/battle/held_heal_status.asm"
-UseConfusionHealingItem: ; 3de51
+UseConfusionHealingItem:
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
bit SUBSTATUS_CONFUSED, a
@@ -4587,9 +4456,8 @@ UseConfusionHealingItem: ; 3de51
ld [bc], a
ld [hl], a
ret
-; 3de97
-HandleStatBoostingHeldItems: ; 3de97
+HandleStatBoostingHeldItems:
; The effects handled here are not used in-game.
ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
@@ -4600,18 +4468,16 @@ HandleStatBoostingHeldItems: ; 3de97
.player_1
call .DoEnemy
jp .DoPlayer
-; 3dea9
-.DoPlayer: ; 3dea9
+.DoPlayer:
call GetPartymonItem
ld a, $0
jp .HandleItem
-; 3deb1
-.DoEnemy: ; 3deb1
+.DoEnemy:
call GetOTPartymonItem
ld a, $1
-.HandleItem: ; 3deb6
+.HandleItem:
ld [hBattleTurn], a
ld d, h
ld e, l
@@ -4658,27 +4524,24 @@ HandleStatBoostingHeldItems: ; 3de97
pop bc
pop de
ret
-; 3defc
INCLUDE "data/battle/held_stat_up.asm"
-GetPartymonItem: ; 3df12
+GetPartymonItem:
ld hl, wPartyMon1Item
ld a, [wCurBattleMon]
call GetPartyLocation
ld bc, wBattleMonItem
ret
-; 3df1f
-GetOTPartymonItem: ; 3df1f
+GetOTPartymonItem:
ld hl, wOTPartyMon1Item
ld a, [wCurOTMon]
call GetPartyLocation
ld bc, wEnemyMonItem
ret
-; 3df2c
-UpdateBattleHUDs: ; 3df2c
+UpdateBattleHUDs:
push hl
push de
push bc
@@ -4693,9 +4556,8 @@ UpdateBattleHUDs: ; 3df2c
pop de
pop hl
ret
-; 3df48
-UpdatePlayerHUD:: ; 3df48
+UpdatePlayerHUD::
push hl
push de
push bc
@@ -4706,9 +4568,8 @@ UpdatePlayerHUD:: ; 3df48
pop de
pop hl
ret
-; 3df58
-DrawPlayerHUD: ; 3df58
+DrawPlayerHUD:
xor a
ld [hBGMapMode], a
@@ -4744,14 +4605,12 @@ DrawPlayerHUD: ; 3df58
call FillInExpBar
pop de
ret
-; 3df98
-UpdatePlayerHPPal: ; 3df98
+UpdatePlayerHPPal:
ld hl, wPlayerHPPal
jp UpdateHPPal
-; 3df9e
-CheckDanger: ; 3df9e
+CheckDanger:
ld hl, wBattleMonHP
ld a, [hli]
or [hl]
@@ -4774,9 +4633,8 @@ CheckDanger: ; 3df9e
.done
ret
-; 3dfbf
-PrintPlayerHUD: ; 3dfbf
+PrintPlayerHUD:
ld de, wBattleMonNick
hlcoord 10, 7
call ret_3e138
@@ -4837,9 +4695,8 @@ PrintPlayerHUD: ; 3dfbf
ld a, [wBattleMonLevel]
ld [wTempMonLevel], a
jp PrintLevel
-; 3e036
-UpdateEnemyHUD:: ; 3e036
+UpdateEnemyHUD::
push hl
push de
push bc
@@ -4849,9 +4706,8 @@ UpdateEnemyHUD:: ; 3e036
pop de
pop hl
ret
-; 3e043
-DrawEnemyHUD: ; 3e043
+DrawEnemyHUD:
xor a
ld [hBGMapMode], a
@@ -4982,28 +4838,24 @@ DrawEnemyHUD: ; 3e043
ld b, 0
call DrawBattleHPBar
ret
-; 3e127
-UpdateEnemyHPPal: ; 3e127
+UpdateEnemyHPPal:
ld hl, wEnemyHPPal
call UpdateHPPal
ret
-; 3e12e
-UpdateHPPal: ; 3e12e
+UpdateHPPal:
ld b, [hl]
call SetHPPal
ld a, [hl]
cp b
ret z
jp FinishBattleAnim
-; 3e138
-ret_3e138: ; 3e138
+ret_3e138:
ret
-; 3e139
-BattleMenu: ; 3e139
+BattleMenu:
xor a
ld [hBGMapMode], a
call LoadTempTileMapToTileMap
@@ -5049,17 +4901,15 @@ BattleMenu: ; 3e139
cp $4
jp z, BattleMenu_Run
jr .loop
-; 3e192
-BattleMenu_Fight: ; 3e192
+BattleMenu_Fight:
xor a
ld [wNumFleeAttempts], a
call Call_LoadTempTileMapToTileMap
and a
ret
-; 3e19b
-LoadBattleMenu2: ; 3e19b
+LoadBattleMenu2:
call IsMobileBattle
jr z, .mobile
@@ -5083,9 +4933,8 @@ LoadBattleMenu2: ; 3e19b
.error
scf
ret
-; 3e1c7
-BattleMenu_Pack: ; 3e1c7
+BattleMenu_Pack:
ld a, [wLinkMode]
and a
jp nz, .ItemsCantBeUsed
@@ -5135,15 +4984,13 @@ BattleMenu_Pack: ; 3e1c7
call FinishBattleAnim
call LoadTileMapToTempTileMap
jp BattleMenu
-; 3e22b
-.ItemsCantBeUsed: ; 3e22b
+.ItemsCantBeUsed:
ld hl, BattleText_ItemsCantBeUsedHere
call StdBattleTextBox
jp BattleMenu
-; 3e234
-.UseItem: ; 3e234
+.UseItem:
ld a, [wWildMon]
and a
jr nz, .run
@@ -5186,9 +5033,8 @@ BattleMenu_Pack: ; 3e1c7
call SetPalettes
scf
ret
-; 3e28d
-BattleMenu_PKMN: ; 3e28d
+BattleMenu_PKMN:
call LoadStandardMenuHeader
BattleMenuPKMN_ReturnFromStats:
call ExitMenu
@@ -5236,9 +5082,8 @@ BattleMenuPKMN_Loop:
call GetMemSGBLayout
call SetPalettes
jp BattleMenu
-; 3e2f5
-.GetMenu: ; 3e2f5
+.GetMenu:
call IsMobileBattle
jr z, .mobile
farcall BattleMonMenu
@@ -5247,9 +5092,8 @@ BattleMenuPKMN_Loop:
.mobile
farcall MobileBattleMonMenu
ret
-; 3e308
-Battle_StatsScreen: ; 3e308
+Battle_StatsScreen:
call DisableLCD
ld hl, vTiles2 tile $31
@@ -5285,9 +5129,8 @@ Battle_StatsScreen: ; 3e308
call EnableLCD
ret
-; 3e358
-TryPlayerSwitch: ; 3e358
+TryPlayerSwitch:
ld a, [wCurBattleMon]
ld d, a
ld a, [wCurPartyMon]
@@ -5326,7 +5169,7 @@ TryPlayerSwitch: ; 3e358
call SetPalettes
ld a, [wCurPartyMon]
ld [wCurBattleMon], a
-PlayerSwitch: ; 3e3ad
+PlayerSwitch:
ld a, 1
ld [wPlayerIsSwitching], a
ld a, [wLinkMode]
@@ -5374,15 +5217,13 @@ PlayerSwitch: ; 3e3ad
call BattleMonEntrance
and a
ret
-; 3e3ff
-EnemyMonEntrance: ; 3e3ff
+EnemyMonEntrance:
callfar AI_Switch
call SetEnemyTurn
jp SpikesDamage
-; 3e40b
-BattleMonEntrance: ; 3e40b
+BattleMonEntrance:
call WithdrawMonText
ld c, 50
@@ -5417,9 +5258,8 @@ BattleMonEntrance: ; 3e40b
ld a, $2
ld [wMenuCursorY], a
ret
-; 3e459
-PassedBattleMonEntrance: ; 3e459
+PassedBattleMonEntrance:
ld c, 50
call DelayFrames
@@ -5439,9 +5279,8 @@ PassedBattleMonEntrance: ; 3e459
call LoadTileMapToTempTileMap
call SetPlayerTurn
jp SpikesDamage
-; 3e489
-BattleMenu_Run: ; 3e489
+BattleMenu_Run:
call Call_LoadTempTileMapToTileMap
ld a, $3
ld [wMenuCursorY], a
@@ -5455,9 +5294,8 @@ BattleMenu_Run: ; 3e489
and a
ret nz
jp BattleMenu
-; 3e4a8
-CheckAmuletCoin: ; 3e4a8
+CheckAmuletCoin:
ld a, [wBattleMonItem]
ld b, a
callfar GetItemHeldEffect
@@ -5467,9 +5305,8 @@ CheckAmuletCoin: ; 3e4a8
ld a, 1
ld [wAmuletCoin], a
ret
-; 3e4bc
-MoveSelectionScreen: ; 3e4bc
+MoveSelectionScreen:
call IsMobileBattle
jr nz, .not_mobile
farcall MobileMoveSelectionScreen
@@ -5671,11 +5508,9 @@ MoveSelectionScreen: ; 3e4bc
call StdBattleTextBox
call Call_LoadTempTileMapToTileMap
jp MoveSelectionScreen
-; 3e61c
-.string_3e61c ; 3e61c
+.string_3e61c
db "@"
-; 3e61d
.pressed_up
ld a, [wMenuCursorY]
@@ -5685,9 +5520,8 @@ MoveSelectionScreen: ; 3e4bc
inc a
ld [wMenuCursorY], a
jp .menu_loop
-; 3e62e
-.pressed_down ; 3e62e
+.pressed_down
ld a, [wMenuCursorY]
ld b, a
ld a, [wNumMoves]
@@ -5698,9 +5532,8 @@ MoveSelectionScreen: ; 3e4bc
ld a, $1
ld [wMenuCursorY], a
jp .menu_loop
-; 3e643
-.pressed_select ; 3e643
+.pressed_select
ld a, [wMoveSwapBuffer]
and a
jr z, .start_swap
@@ -5783,9 +5616,8 @@ MoveSelectionScreen: ; 3e4bc
ld a, [wMenuCursorY]
ld [wMoveSwapBuffer], a
jp MoveSelectionScreen
-; 3e6c8
-MoveInfoBox: ; 3e6c8
+MoveInfoBox:
xor a
ld [hBGMapMode], a
@@ -5855,15 +5687,13 @@ MoveInfoBox: ; 3e6c8
.done
ret
-; 3e74f
.Disabled:
db "Disabled!@"
.Type:
db "TYPE/@"
-; 3e75f
-.PrintPP: ; 3e75f
+.PrintPP:
hlcoord 5, 11
ld a, [wLinkMode] ; What's the point of this check?
cp LINK_MOBILE
@@ -5883,9 +5713,8 @@ MoveInfoBox: ; 3e6c8
lb bc, 1, 2
call PrintNum
ret
-; 3e786
-CheckPlayerHasUsableMoves: ; 3e786
+CheckPlayerHasUsableMoves:
ld a, STRUGGLE
ld [wCurPlayerMove], a
ld a, [wPlayerDisableCount]
@@ -5931,9 +5760,8 @@ CheckPlayerHasUsableMoves: ; 3e786
call DelayFrames
xor a
ret
-; 3e7c1
-ParseEnemyAction: ; 3e7c1
+ParseEnemyAction:
ld a, [wEnemyIsSwitching]
and a
ret nz
@@ -6081,9 +5909,8 @@ ParseEnemyAction: ; 3e7c1
.struggle
ld a, STRUGGLE
jr .finish
-; 3e8c1
-ResetVarsForSubstatusRage: ; 3e8c1
+ResetVarsForSubstatusRage:
xor a
ld [wEnemyFuryCutterCount], a
ld [wEnemyProtectCount], a
@@ -6091,9 +5918,8 @@ ResetVarsForSubstatusRage: ; 3e8c1
ld hl, wEnemySubStatus4
res SUBSTATUS_RAGE, [hl]
ret
-; 3e8d1
-CheckEnemyLockedIn: ; 3e8d1
+CheckEnemyLockedIn:
ld a, [wEnemySubStatus4]
and 1 << SUBSTATUS_RECHARGE
ret nz
@@ -6106,14 +5932,12 @@ CheckEnemyLockedIn: ; 3e8d1
ld hl, wEnemySubStatus1
bit SUBSTATUS_ROLLOUT, [hl]
ret
-; 3e8e4
-LinkBattleSendReceiveAction: ; 3e8e4
+LinkBattleSendReceiveAction:
farcall _LinkBattleSendReceiveAction
ret
-; 3e8eb
-LoadEnemyMon: ; 3e8eb
+LoadEnemyMon:
; Initialize enemy monster parameters
; To do this we pull the species from wTempEnemyMonSpecies
@@ -6582,9 +6406,8 @@ LoadEnemyMon: ; 3e8eb
call CopyBytes
ret
-; 3eb38
-CheckSleepingTreeMon: ; 3eb38
+CheckSleepingTreeMon:
; Return carry if species is in the list
; for the current time of day
@@ -6615,7 +6438,7 @@ CheckSleepingTreeMon: ; 3eb38
INCLUDE "data/wild/treemons_asleep.asm"
-CheckUnownLetter: ; 3eb75
+CheckUnownLetter:
; Return carry if the Unown letter hasn't been unlocked yet
ld a, [wUnlockedUnowns]
@@ -6665,7 +6488,7 @@ CheckUnownLetter: ; 3eb75
INCLUDE "data/wild/unlocked_unowns.asm"
-Unreferenced_SwapBattlerLevels: ; 3ebc7
+Unreferenced_SwapBattlerLevels:
push bc
ld a, [wBattleMonLevel]
ld b, a
@@ -6675,9 +6498,8 @@ Unreferenced_SwapBattlerLevels: ; 3ebc7
ld [wEnemyMonLevel], a
pop bc
ret
-; 3ebd8
-BattleWinSlideInEnemyTrainerFrontpic: ; 3ebd8
+BattleWinSlideInEnemyTrainerFrontpic:
xor a
ld [wTempEnemyMonSpecies], a
call FinishBattleAnim
@@ -6717,9 +6539,8 @@ BattleWinSlideInEnemyTrainerFrontpic: ; 3ebd8
pop bc
dec hl
jr .outer_loop
-; 3ec1a
-.CopyColumn: ; 3ec1a
+.CopyColumn:
push hl
push de
push bc
@@ -6737,24 +6558,20 @@ BattleWinSlideInEnemyTrainerFrontpic: ; 3ebd8
pop de
pop hl
ret
-; 3ec2c
-ApplyStatusEffectOnPlayerStats: ; 3ec2c
+ApplyStatusEffectOnPlayerStats:
ld a, 1
jr ApplyStatusEffectOnStats
-; 3ec30
-ApplyStatusEffectOnEnemyStats: ; 3ec30
+ApplyStatusEffectOnEnemyStats:
xor a
-; 3ec31
-ApplyStatusEffectOnStats: ; 3ec31
+ApplyStatusEffectOnStats:
ld [hBattleTurn], a
call ApplyPrzEffectOnSpeed
jp ApplyBrnEffectOnAttack
-; 3ec39
-ApplyPrzEffectOnSpeed: ; 3ec39
+ApplyPrzEffectOnSpeed:
ld a, [hBattleTurn]
and a
jr z, .enemy
@@ -6798,9 +6615,8 @@ ApplyPrzEffectOnSpeed: ; 3ec39
.enemy_ok
ld [hl], b
ret
-; 3ec76
-ApplyBrnEffectOnAttack: ; 3ec76
+ApplyBrnEffectOnAttack:
ld a, [hBattleTurn]
and a
jr z, .enemy
@@ -6840,9 +6656,8 @@ ApplyBrnEffectOnAttack: ; 3ec76
.enemy_ok
ld [hl], b
ret
-; 3ecab
-ApplyStatLevelMultiplierOnAllStats: ; 3ecab
+ApplyStatLevelMultiplierOnAllStats:
; Apply StatLevelMultipliers on all 5 Stats
ld c, 0
.stat_loop
@@ -6852,9 +6667,8 @@ ApplyStatLevelMultiplierOnAllStats: ; 3ecab
cp 5
jr nz, .stat_loop
ret
-; 3ecb7
-ApplyStatLevelMultiplier: ; 3ecb7
+ApplyStatLevelMultiplier:
push bc
push bc
ld a, [wd265]
@@ -6936,11 +6750,10 @@ ApplyStatLevelMultiplier: ; 3ecb7
.okay4
pop bc
ret
-; 3ed2b
INCLUDE "data/battle/stat_multipliers_2.asm"
-BadgeStatBoosts: ; 3ed45
+BadgeStatBoosts:
; Raise the stats of the battle mon in wBattleMon
; depending on which badges have been obtained.
@@ -6997,9 +6810,8 @@ BadgeStatBoosts: ; 3ed45
srl a
call c, BoostStat
ret
-; 3ed7c
-BoostStat: ; 3ed7c
+BoostStat:
; Raise stat at hl by 1/8.
ld a, [hli]
@@ -7029,17 +6841,14 @@ BoostStat: ; 3ed7c
ld a, LOW(MAX_STAT_VALUE)
ld [hld], a
ret
-; 3ed9f
-_LoadBattleFontsHPBar: ; 3ed9f
+_LoadBattleFontsHPBar:
callfar LoadBattleFontsHPBar
ret
-; 3eda6
-_LoadHPBar: ; 3eda6
+_LoadHPBar:
callfar LoadHPBar
ret
-; 3edad
Unreferenced_LoadHPExpBarGFX:
ld de, EnemyHPBarBorderGFX
@@ -7054,16 +6863,14 @@ Unreferenced_LoadHPExpBarGFX:
ld hl, vTiles2 tile $55
lb bc, BANK(ExpBarGFX), 8
jp Get2bpp
-; 3edd1
-EmptyBattleTextBox: ; 3edd1
+EmptyBattleTextBox:
ld hl, .empty
jp BattleTextBox
.empty
db "@"
-; 3edd8
-_BattleRandom:: ; 3edd8
+_BattleRandom::
; If the normal RNG is used in a link battle it'll desync.
; To circumvent this a shared PRNG is used instead.
@@ -7130,25 +6937,22 @@ _BattleRandom:: ; 3edd8
pop bc
pop hl
ret
-; 3ee0f
-Call_PlayBattleAnim_OnlyIfVisible: ; 3ee0f
+Call_PlayBattleAnim_OnlyIfVisible:
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
ret nz
-; 3ee17
-Call_PlayBattleAnim: ; 3ee17
+Call_PlayBattleAnim:
ld a, e
ld [wFXAnimID], a
ld a, d
ld [wFXAnimID + 1], a
call WaitBGMap
predef_jump PlayBattleAnim
-; 3ee27
-FinishBattleAnim: ; 3ee27
+FinishBattleAnim:
push af
push bc
push de
@@ -7162,9 +6966,8 @@ FinishBattleAnim: ; 3ee27
pop bc
pop af
ret
-; 3ee3b
-GiveExperiencePoints: ; 3ee3b
+GiveExperiencePoints:
; Give experience.
; Don't give experience if linked or in the Battle Tower.
ld a, [wLinkMode]
@@ -7542,7 +7345,6 @@ GiveExperiencePoints: ; 3ee3b
.done
jp ResetBattleParticipants
-; 3f0d4
.EvenlyDivideExpAmongParticipants:
; count number of battle participants
@@ -7577,9 +7379,8 @@ GiveExperiencePoints: ; 3ee3b
dec c
jr nz, .count_loop2
ret
-; 3f106
-BoostExp: ; 3f106
+BoostExp:
; Multiply experience by 1.5x
push bc
; load experience value
@@ -7598,9 +7399,8 @@ BoostExp: ; 3f106
ld [hProduct + 2], a
pop bc
ret
-; 3f11b
-Text_MonGainedExpPoint: ; 3f11b
+Text_MonGainedExpPoint:
text_jump Text_Gained
start_asm
ld hl, TextJump_StringBuffer2ExpPoints
@@ -7610,19 +7410,16 @@ Text_MonGainedExpPoint: ; 3f11b
ld hl, TextJump_ABoostedStringBuffer2ExpPoints
ret
-; 3f12c
-TextJump_ABoostedStringBuffer2ExpPoints: ; 3f12c
+TextJump_ABoostedStringBuffer2ExpPoints:
text_jump Text_ABoostedStringBuffer2ExpPoints
db "@"
-; 3f131
-TextJump_StringBuffer2ExpPoints: ; 3f131
+TextJump_StringBuffer2ExpPoints:
text_jump Text_StringBuffer2ExpPoints
db "@"
-; 3f136
-AnimateExpBar: ; 3f136
+AnimateExpBar:
push bc
ld hl, wCurPartyMon
@@ -7808,7 +7605,7 @@ AnimateExpBar: ; 3f136
ld [hBGMapMode], a
ret
-SendOutMonText: ; 3f26d
+SendOutMonText:
ld a, [wLinkMode]
and a
jr z, .not_linked
@@ -7868,40 +7665,34 @@ SendOutMonText: ; 3f26d
ld hl, JumpText_YourFoesWeakGetmMon
.skip_to_textbox
jp BattleTextBox
-; 3f2d1
-JumpText_GoMon: ; 3f2d1
+JumpText_GoMon:
text_jump Text_GoMon
start_asm
jr Function_TextJump_BattleMonNick01
-; 3f2d6
-JumpText_DoItMon: ; 3f2d8
+JumpText_DoItMon:
text_jump Text_DoItMon
start_asm
jr Function_TextJump_BattleMonNick01
-; 3f2dd
-JumpText_GoForItMon: ; 3f2df
+JumpText_GoForItMon:
text_jump Text_GoForItMon
start_asm
jr Function_TextJump_BattleMonNick01
-; 3f2e4
-JumpText_YourFoesWeakGetmMon: ; 3f2e6
+JumpText_YourFoesWeakGetmMon:
text_jump Text_YourFoesWeakGetmMon
start_asm
-Function_TextJump_BattleMonNick01: ; 3f2eb
+Function_TextJump_BattleMonNick01:
ld hl, TextJump_BattleMonNick01
ret
-; 3f2ef
-TextJump_BattleMonNick01: ; 3f2ef
+TextJump_BattleMonNick01:
text_jump Text_BattleMonNick01
db "@"
-; 3f2f4
-WithdrawMonText: ; 3f2f4
+WithdrawMonText:
ld hl, .WithdrawMonText
jp BattleTextBox
@@ -7955,33 +7746,27 @@ WithdrawMonText: ; 3f2f4
ld hl, TextJump_GoodComeBack
ret
-; 3f348
-TextJump_ThatsEnoughComeBack: ; 3f348
+TextJump_ThatsEnoughComeBack:
text_jump Text_ThatsEnoughComeBack
db "@"
-; 3f34d
-TextJump_OKComeBack: ; 3f34d
+TextJump_OKComeBack:
text_jump Text_OKComeBack
db "@"
-; 3f352
-TextJump_GoodComeBack: ; 3f352
+TextJump_GoodComeBack:
text_jump Text_GoodComeBack
db "@"
-; 3f357
-Unreferenced_TextJump_ComeBack: ; 3f357
+Unreferenced_TextJump_ComeBack:
; this function doesn't seem to be used
ld hl, TextJump_ComeBack
ret
-; 3f35b
-TextJump_ComeBack: ; 3f35b
+TextJump_ComeBack:
text_jump Text_ComeBack
db "@"
-; 3f360
Unreferenced_HandleSafariAngerEatingStatus:
ld hl, wSafariMonEating
@@ -8013,18 +7798,16 @@ Unreferenced_HandleSafariAngerEatingStatus:
call Call_LoadTempTileMapToTileMap
pop hl
jp StdBattleTextBox
-; 3f390
-FillInExpBar: ; 3f390
+FillInExpBar:
push hl
call CalcExpBar
pop hl
ld de, 7
add hl, de
jp PlaceExpBar
-; 3f39c
-CalcExpBar: ; 3f39c
+CalcExpBar:
; Calculate the percent exp between this level and the next
; Level in b
push de
@@ -8123,9 +7906,8 @@ CalcExpBar: ; 3f39c
sub b
ld b, a
ret
-; 3f41c
-PlaceExpBar: ; 3f41c
+PlaceExpBar:
ld c, $8 ; number of tiles
.loop1
ld a, b
@@ -8155,15 +7937,14 @@ PlaceExpBar: ; 3f41c
.finish
ret
-; 3f43d
-GetBattleMonBackpic: ; 3f43d
+GetBattleMonBackpic:
ld a, [wPlayerSubStatus4]
bit SUBSTATUS_SUBSTITUTE, a
ld hl, BattleAnimCmd_RaiseSub
jr nz, GetBattleMonBackpic_DoAnim ; substitute
-DropPlayerSub: ; 3f447
+DropPlayerSub:
ld a, [wPlayerMinimized]
and a
ld hl, BattleAnimCmd_MinimizeOpp
@@ -8179,9 +7960,8 @@ DropPlayerSub: ; 3f447
pop af
ld [wCurPartySpecies], a
ret
-; 3f46f
-GetBattleMonBackpic_DoAnim: ; 3f46f
+GetBattleMonBackpic_DoAnim:
ld a, [hBattleTurn]
push af
xor a
@@ -8191,15 +7971,14 @@ GetBattleMonBackpic_DoAnim: ; 3f46f
pop af
ld [hBattleTurn], a
ret
-; 3f47c
-GetEnemyMonFrontpic: ; 3f47c
+GetEnemyMonFrontpic:
ld a, [wEnemySubStatus4]
bit SUBSTATUS_SUBSTITUTE, a
ld hl, BattleAnimCmd_RaiseSub
jr nz, GetEnemyMonFrontpic_DoAnim
-DropEnemySub: ; 3f486
+DropEnemySub:
ld a, [wEnemyMinimized]
and a
ld hl, BattleAnimCmd_MinimizeOpp
@@ -8218,9 +7997,8 @@ DropEnemySub: ; 3f486
pop af
ld [wCurPartySpecies], a
ret
-; 3f4b4
-GetEnemyMonFrontpic_DoAnim: ; 3f4b4
+GetEnemyMonFrontpic_DoAnim:
ld a, [hBattleTurn]
push af
call SetEnemyTurn
@@ -8229,9 +8007,8 @@ GetEnemyMonFrontpic_DoAnim: ; 3f4b4
pop af
ld [hBattleTurn], a
ret
-; 3f4c1
-StartBattle: ; 3f4c1
+StartBattle:
; 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.
@@ -8248,14 +8025,12 @@ StartBattle: ; 3f4c1
ld [wTimeOfDayPal], a
scf
ret
-; 3f4d9
-Unreferenced_DoBattle: ; 3f4d9
+Unreferenced_DoBattle:
call DoBattle
ret
-; 3f4dd
-BattleIntro: ; 3f4dd
+BattleIntro:
farcall StubbedTrainerRankings_Battles ; mobile
call LoadTrainerOrWildMonPic
xor a
@@ -8294,9 +8069,8 @@ BattleIntro: ; 3f4dd
ld a, $1
ld [hBGMapMode], a
ret
-; 3f54e
-LoadTrainerOrWildMonPic: ; 3f54e
+LoadTrainerOrWildMonPic:
ld a, [wOtherTrainerClass]
and a
jr nz, .Trainer
@@ -8306,16 +8080,14 @@ LoadTrainerOrWildMonPic: ; 3f54e
.Trainer:
ld [wTempEnemyMonSpecies], a
ret
-; 3f55e
-InitEnemy: ; 3f55e
+InitEnemy:
ld a, [wOtherTrainerClass]
and a
jp nz, InitEnemyTrainer ; trainer
jp InitEnemyWildmon ; wild
-; 3f568
-BackUpBGMap2: ; 3f568
+BackUpBGMap2:
ld a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
@@ -8337,9 +8109,8 @@ BackUpBGMap2: ; 3f568
pop af
ld [rSVBK], a
ret
-; 3f594
-InitEnemyTrainer: ; 3f594
+InitEnemyTrainer:
ld [wTrainerClass], a
farcall StubbedTrainerRankings_TrainerBattles
xor a
@@ -8393,9 +8164,8 @@ InitEnemyTrainer: ; 3f594
jr .partyloop
.done
ret
-; 3f607
-InitEnemyWildmon: ; 3f607
+InitEnemyWildmon:
ld a, WILD_BATTLE
ld [wBattleMode], a
farcall StubbedTrainerRankings_WildBattles
@@ -8428,9 +8198,8 @@ InitEnemyWildmon: ; 3f607
lb bc, 7, 7
predef PlaceGraphic
ret
-; 3f662
-Unreferenced_Function3f662: ; 3f662
+Unreferenced_Function3f662:
ld hl, wEnemyMonMoves
ld de, wListMoves_MoveIndicesBuffer
ld b, NUM_MOVES
@@ -8480,15 +8249,13 @@ Unreferenced_Function3f662: ; 3f662
dec b
jr nz, .clear
ret
-; 3f69e
-ExitBattle: ; 3f69e
+ExitBattle:
call .HandleEndOfBattle
call CleanUpBattleRAM
ret
-; 3f6a5
-.HandleEndOfBattle: ; 3f6a5
+.HandleEndOfBattle:
ld a, [wLinkMode]
and a
jr z, .not_linked
@@ -8508,9 +8275,8 @@ ExitBattle: ; 3f69e
predef EvolveAfterBattle
farcall GivePokerusAndConvertBerries
ret
-; 3f6d0
-CleanUpBattleRAM: ; 3f6d0
+CleanUpBattleRAM:
call BattleEnd_HandleRoamMons
xor a
ld [wLowHealthAlarm], a
@@ -8541,9 +8307,8 @@ CleanUpBattleRAM: ; 3f6d0
jr nz, .loop
call WaitSFX
ret
-; 3f71d
-CheckPayDay: ; 3f71d
+CheckPayDay:
ld hl, wPayDayMoney
ld a, [hli]
or [hl]
@@ -8577,9 +8342,8 @@ CheckPayDay: ; 3f71d
call ClearTileMap
call ClearBGPalettes
ret
-; 3f759
-ShowLinkBattleParticipantsAfterEnd: ; 3f759
+ShowLinkBattleParticipantsAfterEnd:
farcall StubbedTrainerRankings_LinkBattles
farcall BackupMobileEventIndex
ld a, [wCurOTMon]
@@ -8590,9 +8354,8 @@ ShowLinkBattleParticipantsAfterEnd: ; 3f759
call ClearTileMap
farcall _ShowLinkBattleParticipants
ret
-; 3f77c
-DisplayLinkBattleResult: ; 3f77c
+DisplayLinkBattleResult:
farcall CheckMobileBattleError
jp c, .Mobile_InvalidBattle
call IsMobileBattle2
@@ -8651,7 +8414,6 @@ DisplayLinkBattleResult: ; 3f77c
call DelayFrames
call ClearTileMap
ret
-; 3f7f7
.Win:
db "YOU WIN@"
@@ -8659,9 +8421,8 @@ DisplayLinkBattleResult: ; 3f77c
db "YOU LOSE@"
.Draw:
db " DRAW@"
-; 3f80f
-.Mobile_InvalidBattle: ; 3f80f
+.Mobile_InvalidBattle:
hlcoord 6, 8
ld de, .Invalid
call PlaceString
@@ -8669,19 +8430,16 @@ DisplayLinkBattleResult: ; 3f77c
call DelayFrames
call ClearTileMap
ret
-; 3f821
.Invalid:
db "INVALID BATTLE@"
-; 3f830
-IsMobileBattle2: ; 3f830
+IsMobileBattle2:
ld a, [wLinkMode]
cp LINK_MOBILE
ret
-; 3f836
-_DisplayLinkRecord: ; 3f836
+_DisplayLinkRecord:
ld a, BANK(sLinkBattleStats)
call GetSRAMBank
@@ -8700,9 +8458,8 @@ _DisplayLinkRecord: ; 3f836
call DelayFrames
call WaitPressAorB_BlinkCursor
ret
-; 3f85f
-ReadAndPrintLinkBattleRecord: ; 3f85f
+ReadAndPrintLinkBattleRecord:
call ClearTileMap
call ClearSprites
call .PrintBattleRecord
@@ -8819,24 +8576,21 @@ ReadAndPrintLinkBattleRecord: ; 3f85f
call PlaceString
scf
ret
-; 3f938
.Scores:
db " 0 0 0@"
-; 3f947
-.Format: ; 3f947
+.Format:
db " --- <LNBRK>"
db " - - -@"
-.Record: ; 3f964
+.Record:
db "<PLAYER>'s RECORD@"
-.Result: ; 3f96e
+.Result:
db "RESULT WIN LOSE DRAW@"
-.Total: ; 3f983
+.Total:
db "TOTAL WIN LOSE DRAW@"
-; 3f998
-BattleEnd_HandleRoamMons: ; 3f998
+BattleEnd_HandleRoamMons:
ld a, [wBattleType]
cp BATTLETYPE_ROAMING
jr nz, .not_roaming
@@ -8867,9 +8621,8 @@ BattleEnd_HandleRoamMons: ; 3f998
.update_roam_mons
callfar UpdateRoamMons
ret
-; 3f9d1
-GetRoamMonMapGroup: ; 3f9d1
+GetRoamMonMapGroup:
ld a, [wTempEnemyMonSpecies]
ld b, a
ld a, [wRoamMon1Species]
@@ -8882,9 +8635,8 @@ GetRoamMonMapGroup: ; 3f9d1
ret z
ld hl, wRoamMon3MapGroup
ret
-; 3f9e9
-GetRoamMonMapNumber: ; 3f9e9
+GetRoamMonMapNumber:
ld a, [wTempEnemyMonSpecies]
ld b, a
ld a, [wRoamMon1Species]
@@ -8897,9 +8649,8 @@ GetRoamMonMapNumber: ; 3f9e9
ret z
ld hl, wRoamMon3MapNumber
ret
-; 3fa01
-GetRoamMonHP: ; 3fa01
+GetRoamMonHP:
; output: hl = wRoamMonHP
ld a, [wTempEnemyMonSpecies]
ld b, a
@@ -8913,9 +8664,8 @@ GetRoamMonHP: ; 3fa01
ret z
ld hl, wRoamMon3HP
ret
-; 3fa19
-GetRoamMonDVs: ; 3fa19
+GetRoamMonDVs:
; output: hl = wRoamMonDVs
ld a, [wTempEnemyMonSpecies]
ld b, a
@@ -8929,9 +8679,8 @@ GetRoamMonDVs: ; 3fa19
ret z
ld hl, wRoamMon3DVs
ret
-; 3fa31
-GetRoamMonSpecies: ; 3fa31
+GetRoamMonSpecies:
ld a, [wTempEnemyMonSpecies]
ld hl, wRoamMon1Species
cp [hl]
@@ -8941,9 +8690,8 @@ GetRoamMonSpecies: ; 3fa31
ret z
ld hl, wRoamMon3Species
ret
-; 3fa42
-AddLastMobileBattleToLinkRecord: ; 3fa42
+AddLastMobileBattleToLinkRecord:
ld hl, wOTPlayerID
ld de, wStringBuffer1
ld bc, 2
@@ -8998,8 +8746,7 @@ AddLastMobileBattleToLinkRecord: ; 3fa42
call .StoreResult
call .FindOpponentAndAppendRecord
ret
-; 3faa0
-.StoreResult: ; 3faa0
+.StoreResult:
ld a, [wBattleResult]
and $f
cp LOSE
@@ -9018,9 +8765,8 @@ AddLastMobileBattleToLinkRecord: ; 3fa42
dec hl
inc [hl]
ret
-; 3fabe
-.CheckOverflow: ; 3fabe
+.CheckOverflow:
dec hl
ld a, [hl]
inc hl
@@ -9029,9 +8775,8 @@ AddLastMobileBattleToLinkRecord: ; 3fa42
ld a, [hl]
cp LOW(MAX_LINK_RECORD)
ret
-; 3fac8
-.FindOpponentAndAppendRecord: ; 3fac8
+.FindOpponentAndAppendRecord:
ld b, 5
ld hl, sLinkBattleRecord + 17
ld de, wd002
@@ -9123,9 +8868,8 @@ AddLastMobileBattleToLinkRecord: ; 3fa42
pop de
call CopyBytes
ret
-; 3fb54
-.LoadPointer: ; 3fb54
+.LoadPointer:
ld e, $0
ld a, [hld]
ld c, a
@@ -9150,9 +8894,8 @@ AddLastMobileBattleToLinkRecord: ; 3fa42
ret nc
inc e
ret
-; 3fb6c
-InitBattleDisplay: ; 3fb6c
+InitBattleDisplay:
call .InitBackPic
hlcoord 0, 12
ld b, 4
@@ -9195,9 +8938,8 @@ InitBattleDisplay: ; 3fb6c
xor a
ld [hSCX], a
ret
-; 3fbd6
-.BlankBGMap: ; 3fbd6
+.BlankBGMap:
ld a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
@@ -9216,15 +8958,13 @@ InitBattleDisplay: ; 3fb6c
pop af
ld [rSVBK], a
ret
-; 3fbf8
-.InitBackPic: ; 3fbf8
+.InitBackPic:
call GetTrainerBackpic
call CopyBackpic
ret
-; 3fbff
-GetTrainerBackpic: ; 3fbff
+GetTrainerBackpic:
; Load the player character's backpic (6x6) into VRAM starting from vTiles2 tile $31.
; Special exception for Dude.
@@ -9256,9 +8996,8 @@ GetTrainerBackpic: ; 3fbff
ld c, 7 * 7
predef DecompressGet2bpp
ret
-; 3fc30
-CopyBackpic: ; 3fc30
+CopyBackpic:
ld a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
@@ -9278,9 +9017,8 @@ CopyBackpic: ; 3fc30
lb bc, 6, 6
predef PlaceGraphic
ret
-; 3fc5b
-.LoadTrainerBackpicAsOAM: ; 3fc5b
+.LoadTrainerBackpicAsOAM:
ld hl, wVirtualOAMSprite00
xor a
ld [hMapObjectIndexBuffer], a
@@ -9314,9 +9052,8 @@ CopyBackpic: ; 3fc30
dec b
jr nz, .outer_loop
ret
-; 3fc8b
-BattleStartMessage: ; 3fc8b
+BattleStartMessage:
ld a, [wBattleMode]
dec a
jr z, .wild
@@ -9397,4 +9134,3 @@ BattleStartMessage: ; 3fc8b
farcall Mobile_PrintOpponentBattleMessage
ret
-; 3fd26
diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm
index ff114d870..07e8b3a2a 100644
--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -1,4 +1,4 @@
-DoPlayerTurn: ; 34000
+DoPlayerTurn:
call SetPlayerTurn
ld a, [wBattlePlayerAction]
@@ -7,10 +7,9 @@ DoPlayerTurn: ; 34000
jr DoTurn
-; 3400a
-DoEnemyTurn: ; 3400a
+DoEnemyTurn:
call SetEnemyTurn
ld a, [wLinkMode]
@@ -24,10 +23,9 @@ DoEnemyTurn: ; 3400a
ret nc
; fallthrough
-; 3401d
-DoTurn: ; 3401d
+DoTurn:
; Read in and execute the user's move effects for this turn.
xor a
@@ -41,10 +39,9 @@ DoTurn: ; 3401d
ret nz
call UpdateMoveData
-; 3402c
-DoMove: ; 3402c
+DoMove:
; Get the user's move effect.
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
@@ -115,11 +112,10 @@ DoMove: ; 3402c
.DoMoveEffectCommand:
jp hl
-; 34084
CheckTurn:
-BattleCommand_CheckTurn: ; 34084
+BattleCommand_CheckTurn:
; checkturn
; Repurposed as hardcoded turn handling. Useless as a command.
@@ -353,10 +349,9 @@ CheckPlayerTurn:
call CantMove
jp EndTurn
-; 341f0
-CantMove: ; 341f0
+CantMove:
ld a, BATTLE_VARS_SUBSTATUS1
call GetBattleVarAddr
res SUBSTATUS_ROLLOUT, [hl]
@@ -382,20 +377,18 @@ CantMove: ; 341f0
res SUBSTATUS_FLYING, [hl]
jp AppearUserRaiseSub
-; 34216
-OpponentCantMove: ; 34216
+OpponentCantMove:
call BattleCommand_SwitchTurn
call CantMove
jp BattleCommand_SwitchTurn
-; 3421f
-CheckEnemyTurn: ; 3421f
+CheckEnemyTurn:
ld hl, wEnemySubStatus4
bit SUBSTATUS_RECHARGE, [hl]
@@ -621,18 +614,16 @@ CheckEnemyTurn: ; 3421f
call CantMove
; fallthrough
-; 34385
-EndTurn: ; 34385
+EndTurn:
ld a, $1
ld [wTurnEnded], a
jp ResetDamage
-; 3438d
-MoveDisabled: ; 3438d
+MoveDisabled:
; Make sure any charged moves fail
ld a, BATTLE_VARS_SUBSTATUS3
@@ -647,10 +638,9 @@ MoveDisabled: ; 3438d
ld hl, DisabledMoveText
jp StdBattleTextBox
-; 343a5
-HitConfusion: ; 343a5
+HitConfusion:
ld hl, HurtItselfText
call StdBattleTextBox
@@ -680,10 +670,9 @@ HitConfusion: ; 343a5
call DoPlayerDamage
jp BattleCommand_RaiseSub
-; 343db
-BattleCommand_CheckObedience: ; 343db
+BattleCommand_CheckObedience:
; checkobedience
; Enemy can't disobey
@@ -984,10 +973,9 @@ BattleCommand_CheckObedience: ; 343db
jp EndMoveEffect
-; 3451f
-IgnoreSleepOnly: ; 3451f
+IgnoreSleepOnly:
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
@@ -1015,18 +1003,16 @@ IgnoreSleepOnly: ; 3451f
scf
ret
-; 34541
-BattleCommand_UsedMoveText: ; 34541
+BattleCommand_UsedMoveText:
; usedmovetext
farcall DisplayUsedMoveText
ret
-; 34548
-CheckUserIsCharging: ; 34548
+CheckUserIsCharging:
ld a, [hBattleTurn]
and a
@@ -1037,10 +1023,9 @@ CheckUserIsCharging: ; 34548
and a
ret
-; 34555
-BattleCommand_DoTurn: ; 34555
+BattleCommand_DoTurn:
call CheckUserIsCharging
ret nz
@@ -1165,9 +1150,8 @@ BattleCommand_DoTurn: ; 34555
ld b, 1
ret
-; 34602
-.continuousmoves ; 34602
+.continuousmoves
db EFFECT_RAZOR_WIND
db EFFECT_SKY_ATTACK
db EFFECT_SKULL_BASH
@@ -1177,9 +1161,8 @@ BattleCommand_DoTurn: ; 34555
db EFFECT_BIDE
db EFFECT_RAMPAGE
db -1
-; 3460b
-CheckMimicUsed: ; 3460b
+CheckMimicUsed:
ld a, [hBattleTurn]
and a
ld a, [wCurMoveNum]
@@ -1209,10 +1192,9 @@ CheckMimicUsed: ; 3460b
and a
ret
-; 34631
-BattleCommand_Critical: ; 34631
+BattleCommand_Critical:
; critical
; Determine whether this attack's hit will be critical.
@@ -1303,13 +1285,12 @@ BattleCommand_Critical: ; 34631
ret
INCLUDE "data/battle/critical_hits.asm"
-; 346b2
INCLUDE "engine/battle/move_effects/triple_kick.asm"
-BattleCommand_Stab: ; 346d2
+BattleCommand_Stab:
; STAB = Same Type Attack Bonus
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
@@ -1493,16 +1474,15 @@ BattleCommand_Stab: ; 346d2
ld [wTypeModifier], a
ret
-; 347c8
-BattleCheckTypeMatchup: ; 347c8
+BattleCheckTypeMatchup:
ld hl, wEnemyMonType1
ld a, [hBattleTurn]
and a
jr z, CheckTypeMatchup
ld hl, wBattleMonType1
-CheckTypeMatchup: ; 347d3
+CheckTypeMatchup:
; 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,
@@ -1575,10 +1555,9 @@ CheckTypeMatchup: ; 347d3
pop hl
ret
-; 34833
-BattleCommand_ResetTypeMatchup: ; 34833
+BattleCommand_ResetTypeMatchup:
; Reset the type matchup multiplier to 1.0, if the type matchup is not 0.
; If there is immunity in play, the move automatically misses.
call BattleCheckTypeMatchup
@@ -1597,7 +1576,6 @@ BattleCommand_ResetTypeMatchup: ; 34833
ld [wTypeMatchup], a
ret
-; 3484e
INCLUDE "engine/battle/ai/switch.asm"
@@ -1605,7 +1583,7 @@ INCLUDE "engine/battle/ai/switch.asm"
INCLUDE "data/types/type_matchups.asm"
-BattleCommand_DamageVariation: ; 34cfd
+BattleCommand_DamageVariation:
; damagevariation
; Modify the damage spread between 85% and 100%.
@@ -1658,10 +1636,9 @@ BattleCommand_DamageVariation: ; 34cfd
ld [hl], a
ret
-; 34d32
-BattleCommand_CheckHit: ; 34d32
+BattleCommand_CheckHit:
; checkhit
call .DreamEater
@@ -1977,10 +1954,9 @@ BattleCommand_CheckHit: ; 34d32
ret
INCLUDE "data/battle/accuracy_multipliers.asm"
-; 34ecc
-BattleCommand_EffectChance: ; 34ecc
+BattleCommand_EffectChance:
; effectchance
xor a
@@ -2007,10 +1983,9 @@ BattleCommand_EffectChance: ; 34ecc
and a
ret
-; 34eee
-BattleCommand_LowerSub: ; 34eee
+BattleCommand_LowerSub:
; lowersub
ld a, BATTLE_VARS_SUBSTATUS4
@@ -2078,19 +2053,17 @@ BattleCommand_LowerSub: ; 34eee
ld [wSomeoneIsRampaging], a
ret
-; 34f57
-BattleCommand_MoveAnim: ; 34f57
+BattleCommand_MoveAnim:
; moveanim
call BattleCommand_LowerSub
call BattleCommand_MoveAnimNoSub
jp BattleCommand_RaiseSub
-; 34f60
-BattleCommand_MoveAnimNoSub: ; 34f60
+BattleCommand_MoveAnimNoSub:
ld a, [wAttackMissed]
and a
jp nz, BattleCommand_MoveDelay
@@ -2154,10 +2127,9 @@ BattleCommand_MoveAnimNoSub: ; 34f60
ld [wNumHits], a
jp PlayFXAnimID
-; 34fd1
-BattleCommand_StatUpAnim: ; 34fd1
+BattleCommand_StatUpAnim:
ld a, [wAttackMissed]
and a
jp nz, BattleCommand_MoveDelay
@@ -2165,10 +2137,9 @@ BattleCommand_StatUpAnim: ; 34fd1
xor a
jr BattleCommand_StatUpDownAnim
-; 34fdb
-BattleCommand_StatDownAnim: ; 34fdb
+BattleCommand_StatDownAnim:
ld a, [wAttackMissed]
and a
jp nz, BattleCommand_MoveDelay
@@ -2180,10 +2151,9 @@ BattleCommand_StatDownAnim: ; 34fdb
ld a, BATTLEANIM_WOBBLE
; fallthrough
-; 34feb
-BattleCommand_StatUpDownAnim: ; 34feb
+BattleCommand_StatUpDownAnim:
ld [wNumHits], a
xor a
ld [wKickCounter], a
@@ -2193,10 +2163,9 @@ BattleCommand_StatUpDownAnim: ; 34feb
ld d, 0
jp PlayFXAnimID
-; 34ffd
-BattleCommand_SwitchTurn: ; 34ffd
+BattleCommand_SwitchTurn:
; switchturn
ld a, [hBattleTurn]
@@ -2204,10 +2173,9 @@ BattleCommand_SwitchTurn: ; 34ffd
ld [hBattleTurn], a
ret
-; 35004
-BattleCommand_RaiseSub: ; 35004
+BattleCommand_RaiseSub:
; raisesub
ld a, BATTLE_VARS_SUBSTATUS4
@@ -2226,10 +2194,9 @@ BattleCommand_RaiseSub: ; 35004
ld a, SUBSTITUTE
jp LoadAnim
-; 35023
-BattleCommand_FailureText: ; 35023
+BattleCommand_FailureText:
; failuretext
; If the move missed or failed, load the appropriate
; text, and end the effects of multi-turn or multi-
@@ -2271,10 +2238,9 @@ BattleCommand_FailureText: ; 35023
call AppearUserRaiseSub
jp EndMoveEffect
-; 3505e
-BattleCommand_ApplyDamage: ; 3505e
+BattleCommand_ApplyDamage:
; applydamage
ld a, BATTLE_VARS_SUBSTATUS1_OPP
@@ -2366,10 +2332,9 @@ BattleCommand_ApplyDamage: ; 3505e
ld [de], a
ret
-; 350e4
-GetFailureResultText: ; 350e4
+GetFailureResultText:
ld hl, DoesntAffectText
ld de, DoesntAffectText
ld a, [wTypeModifier]
@@ -2427,7 +2392,7 @@ endr
jp nz, DoEnemyDamage
jp DoPlayerDamage
-FailText_CheckOpponentProtect: ; 35157
+FailText_CheckOpponentProtect:
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVar
bit SUBSTATUS_PROTECT, a
@@ -2437,10 +2402,9 @@ FailText_CheckOpponentProtect: ; 35157
.not_protected
jp StdBattleTextBox
-; 35165
-BattleCommand_BideFailText: ; 35165
+BattleCommand_BideFailText:
ld a, [wAttackMissed]
and a
ret z
@@ -2450,10 +2414,9 @@ BattleCommand_BideFailText: ; 35165
jp z, PrintDoesntAffect
jp PrintButItFailed
-; 35175
-BattleCommand_CriticalText: ; 35175
+BattleCommand_CriticalText:
; criticaltext
; Prints the message for critical hits or one-hit KOs.
@@ -2483,10 +2446,9 @@ BattleCommand_CriticalText: ; 35175
.texts
dw CriticalHitText
dw OneHitKOText
-; 35197
-BattleCommand_StartLoop: ; 35197
+BattleCommand_StartLoop:
; startloop
ld hl, wPlayerRolloutCount
@@ -2499,10 +2461,9 @@ BattleCommand_StartLoop: ; 35197
ld [hl], a
ret
-; 351a5
-BattleCommand_SuperEffectiveLoopText: ; 351a5
+BattleCommand_SuperEffectiveLoopText:
; supereffectivelooptext
ld a, BATTLE_VARS_SUBSTATUS3
@@ -2511,10 +2472,9 @@ BattleCommand_SuperEffectiveLoopText: ; 351a5
ret nz
; fallthrough
-; 351ad
-BattleCommand_SuperEffectiveText: ; 351ad
+BattleCommand_SuperEffectiveText:
; supereffectivetext
ld a, [wTypeModifier]
@@ -2527,10 +2487,9 @@ BattleCommand_SuperEffectiveText: ; 351ad
.print
jp StdBattleTextBox
-; 351c0
-BattleCommand_CheckDestinyBond: ; 351c0
+BattleCommand_CheckDestinyBond:
; checkdestinybond
; Faint the user if it fainted an opponent using Destiny Bond.
@@ -2617,10 +2576,9 @@ BattleCommand_CheckDestinyBond: ; 351c0
.finish
jp EndMoveEffect
-; 35250
-BattleCommand_BuildOpponentRage: ; 35250
+BattleCommand_BuildOpponentRage:
; buildopponentrage
jp .start
@@ -2651,10 +2609,9 @@ BattleCommand_BuildOpponentRage: ; 35250
call StdBattleTextBox
jp BattleCommand_SwitchTurn
-; 3527b
-BattleCommand_RageDamage: ; 3527b
+BattleCommand_RageDamage:
; ragedamage
ld a, [wCurDamage]
@@ -2682,10 +2639,9 @@ BattleCommand_RageDamage: ; 3527b
ld [wCurDamage + 1], a
ret
-; 352a3
-EndMoveEffect: ; 352a3
+EndMoveEffect:
ld a, [wBattleScriptBufferAddress]
ld l, a
ld a, [wBattleScriptBufferAddress + 1]
@@ -2696,10 +2652,9 @@ EndMoveEffect: ; 352a3
ld [hl], a
ret
-; 352b1
-DittoMetalPowder: ; 352b1
+DittoMetalPowder:
ld a, MON_SPECIES
call BattlePartyAttr
ld a, [hBattleTurn]
@@ -2735,10 +2690,9 @@ DittoMetalPowder: ; 352b1
rr c
ret
-; 352dc
-BattleCommand_DamageStats: ; 352dc
+BattleCommand_DamageStats:
; damagestats
ld a, [hBattleTurn]
@@ -2746,10 +2700,9 @@ BattleCommand_DamageStats: ; 352dc
jp nz, EnemyAttackDamage
; fallthrough
-; 352e2
-PlayerAttackDamage: ; 352e2
+PlayerAttackDamage:
; Return move power d, player level e, enemy defense c and player attack b.
call ResetDamage
@@ -2831,10 +2784,9 @@ PlayerAttackDamage: ; 352e2
and a
ret
-; 3534d
-TruncateHL_BC: ; 3534d
+TruncateHL_BC:
.loop
; Truncate 16-bit values hl and bc to 8-bit values b and c respectively.
; b = hl, c = bc
@@ -2879,10 +2831,9 @@ TruncateHL_BC: ; 3534d
ld b, l
ret
-; 35378
-GetDamageStatsCritical: ; 35378
+GetDamageStatsCritical:
; Return carry if non-critical.
ld a, [wCriticalHit]
@@ -2891,10 +2842,9 @@ GetDamageStatsCritical: ; 35378
ret z
; fallthrough
-; 3537e
-GetDamageStats: ; 3537e
+GetDamageStats:
; Return the attacker's offensive stat and the defender's defensive
; stat based on whether the attacking type is physical or special.
@@ -2934,10 +2884,9 @@ GetDamageStats: ; 3537e
pop hl
ret
-; 353b5
-ThickClubBoost: ; 353b5
+ThickClubBoost:
; Return in hl the stat value at hl.
; If the attacking monster is Cubone or Marowak and
@@ -2952,10 +2901,9 @@ ThickClubBoost: ; 353b5
pop bc
ret
-; 353c3
-LightBallBoost: ; 353c3
+LightBallBoost:
; Return in hl the stat value at hl.
; If the attacking monster is Pikachu and it's
@@ -2970,10 +2918,9 @@ LightBallBoost: ; 353c3
pop bc
ret
-; 353d1
-SpeciesItemBoost: ; 353d1
+SpeciesItemBoost:
; Return in hl the stat value at hl.
; If the attacking monster is species b or c and
@@ -3013,10 +2960,9 @@ SpeciesItemBoost: ; 353d1
rl h
ret
-; 353f6
-EnemyAttackDamage: ; 353f6
+EnemyAttackDamage:
call ResetDamage
; No damage dealt with 0 power.
@@ -3094,13 +3040,12 @@ EnemyAttackDamage: ; 353f6
and a
ret
-; 35461
INCLUDE "engine/battle/move_effects/beat_up.asm"
-BattleCommand_ClearMissDamage: ; 355d5
+BattleCommand_ClearMissDamage:
; clearmissdamage
ld a, [wAttackMissed]
and a
@@ -3108,10 +3053,9 @@ BattleCommand_ClearMissDamage: ; 355d5
jp ResetDamage
-; 355dd
-HitSelfInConfusion: ; 355dd
+HitSelfInConfusion:
call ResetDamage
ld a, [hBattleTurn]
and a
@@ -3147,10 +3091,9 @@ HitSelfInConfusion: ; 355dd
ld e, a
ret
-; 35612
-BattleCommand_DamageCalc: ; 35612
+BattleCommand_DamageCalc:
; damagecalc
; Return a damage value for move power d, player level e, enemy defense c and player attack b.
@@ -3382,13 +3325,12 @@ BattleCommand_DamageCalc: ; 35612
ret
-; 35703
INCLUDE "data/types/type_boost_items.asm"
-BattleCommand_ConstantDamage: ; 35726
+BattleCommand_ConstantDamage:
; constantdamage
ld hl, wBattleMonLevel
@@ -3564,7 +3506,7 @@ INCLUDE "engine/battle/move_effects/lock_on.asm"
INCLUDE "engine/battle/move_effects/sketch.asm"
-BattleCommand_DefrostOpponent: ; 35b16
+BattleCommand_DefrostOpponent:
; defrostopponent
; Thaw the opponent if frozen, and
; raise the user's Attack one stage.
@@ -3590,7 +3532,6 @@ BattleCommand_DefrostOpponent: ; 35b16
ld [hl], a
ret
-; 35b33
INCLUDE "engine/battle/move_effects/sleep_talk.asm"
@@ -3604,7 +3545,7 @@ INCLUDE "engine/battle/move_effects/false_swipe.asm"
INCLUDE "engine/battle/move_effects/heal_bell.asm"
-FarPlayBattleAnimation: ; 35d00
+FarPlayBattleAnimation:
; play animation de
ld a, BATTLE_VARS_SUBSTATUS3
@@ -3613,9 +3554,8 @@ FarPlayBattleAnimation: ; 35d00
ret nz
; fallthrough
-; 35d08
-PlayFXAnimID: ; 35d08
+PlayFXAnimID:
ld a, e
ld [wFXAnimID], a
ld a, d
@@ -3626,10 +3566,9 @@ PlayFXAnimID: ; 35d08
callfar PlayBattleAnim
ret
-; 35d1c
-DoEnemyDamage: ; 35d1c
+DoEnemyDamage:
ld hl, wCurDamage
ld a, [hli]
ld b, a
@@ -3689,10 +3628,9 @@ DoEnemyDamage: ; 35d1c
.did_no_damage
jp RefreshBattleHuds
-; 35d7e
-DoPlayerDamage: ; 35d7e
+DoPlayerDamage:
ld hl, wCurDamage
ld a, [hli]
ld b, a
@@ -3752,10 +3690,9 @@ DoPlayerDamage: ; 35d7e
.did_no_damage
jp RefreshBattleHuds
-; 35de0
-DoSubstituteDamage: ; 35de0
+DoSubstituteDamage:
ld hl, SubTookDamageText
call StdBattleTextBox
@@ -3812,10 +3749,9 @@ DoSubstituteDamage: ; 35de0
.done
jp ResetDamage
-; 35e40
-UpdateMoveData: ; 35e40
+UpdateMoveData:
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVarAddr
@@ -3832,10 +3768,9 @@ UpdateMoveData: ; 35e40
call GetMoveName
jp CopyName1
-; 35e5c
-BattleCommand_SleepTarget: ; 35e5c
+BattleCommand_SleepTarget:
; sleeptarget
call GetOpponentItem
@@ -3906,10 +3841,9 @@ BattleCommand_SleepTarget: ; 35e5c
pop hl
jp StdBattleTextBox
-; 35ece
-.CheckAIRandomFail: ; 35ece
+.CheckAIRandomFail:
; Enemy turn
ld a, [hBattleTurn]
and a
@@ -3937,10 +3871,9 @@ BattleCommand_SleepTarget: ; 35e5c
xor a
ret
-; 35eee
-BattleCommand_PoisonTarget: ; 35eee
+BattleCommand_PoisonTarget:
; poisontarget
call CheckSubstituteOpp
@@ -3975,10 +3908,9 @@ BattleCommand_PoisonTarget: ; 35eee
farcall UseHeldStatusHealingItem
ret
-; 35f2c
-BattleCommand_Poison: ; 35f2c
+BattleCommand_Poison:
; poison
ld hl, DoesntAffectText
@@ -4066,18 +3998,16 @@ BattleCommand_Poison: ; 35f2c
pop hl
jp StdBattleTextBox
-; 35fc0
-.apply_poison ; 35fc0
+.apply_poison
call AnimateCurrentMove
call PoisonOpponent
jp RefreshBattleHuds
-; 35fc9
-.check_toxic ; 35fc9
+.check_toxic
ld a, BATTLE_VARS_SUBSTATUS5_OPP
call GetBattleVarAddr
ld a, [hBattleTurn]
@@ -4091,10 +4021,9 @@ BattleCommand_Poison: ; 35f2c
cp EFFECT_TOXIC
ret
-; 35fe1
-CheckIfTargetIsPoisonType: ; 35fe1
+CheckIfTargetIsPoisonType:
ld de, wEnemyMonType1
ld a, [hBattleTurn]
and a
@@ -4109,37 +4038,33 @@ CheckIfTargetIsPoisonType: ; 35fe1
cp POISON
ret
-; 35ff5
-PoisonOpponent: ; 35ff5
+PoisonOpponent:
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarAddr
set PSN, [hl]
jp UpdateOpponentInParty
-; 35fff
-BattleCommand_DrainTarget: ; 35fff
+BattleCommand_DrainTarget:
; draintarget
call SapHealth
ld hl, SuckedHealthText
jp StdBattleTextBox
-; 36008
-BattleCommand_EatDream: ; 36008
+BattleCommand_EatDream:
; eatdream
call SapHealth
ld hl, DreamEatenText
jp StdBattleTextBox
-; 36011
-SapHealth: ; 36011
+SapHealth:
; Divide damage by 2, store it in hDividend
ld hl, wCurDamage
ld a, [hli]
@@ -4232,10 +4157,9 @@ SapHealth: ; 36011
call RefreshBattleHuds
jp UpdateBattleMonInParty
-; 3608c
-BattleCommand_BurnTarget: ; 3608c
+BattleCommand_BurnTarget:
; burntarget
xor a
@@ -4276,10 +4200,9 @@ BattleCommand_BurnTarget: ; 3608c
farcall UseHeldStatusHealingItem
ret
-; 360dd
-Defrost: ; 360dd
+Defrost:
ld a, [hl]
and 1 << FRZ
ret z
@@ -4304,10 +4227,9 @@ Defrost: ; 360dd
ld hl, DefrostedOpponentText
jp StdBattleTextBox
-; 36102
-BattleCommand_FreezeTarget: ; 36102
+BattleCommand_FreezeTarget:
; freezetarget
xor a
@@ -4360,10 +4282,9 @@ BattleCommand_FreezeTarget: ; 36102
ld [hl], $1
ret
-; 36165
-BattleCommand_ParalyzeTarget: ; 36165
+BattleCommand_ParalyzeTarget:
; paralyzetarget
xor a
@@ -4399,80 +4320,79 @@ BattleCommand_ParalyzeTarget: ; 36165
ld hl, UseHeldStatusHealingItem
jp CallBattleCore
-; 361ac
-BattleCommand_AttackUp: ; 361ac
+BattleCommand_AttackUp:
; attackup
ld b, ATTACK
jr BattleCommand_StatUp
-BattleCommand_DefenseUp: ; 361b0
+BattleCommand_DefenseUp:
; defenseup
ld b, DEFENSE
jr BattleCommand_StatUp
-BattleCommand_SpeedUp: ; 361b4
+BattleCommand_SpeedUp:
; speedup
ld b, SPEED
jr BattleCommand_StatUp
-BattleCommand_SpecialAttackUp: ; 361b8
+BattleCommand_SpecialAttackUp:
; specialattackup
ld b, SP_ATTACK
jr BattleCommand_StatUp
-BattleCommand_SpecialDefenseUp: ; 361bc
+BattleCommand_SpecialDefenseUp:
; specialdefenseup
ld b, SP_DEFENSE
jr BattleCommand_StatUp
-BattleCommand_AccuracyUp: ; 361c0
+BattleCommand_AccuracyUp:
; accuracyup
ld b, ACCURACY
jr BattleCommand_StatUp
-BattleCommand_EvasionUp: ; 361c4
+BattleCommand_EvasionUp:
; evasionup
ld b, EVASION
jr BattleCommand_StatUp
-BattleCommand_AttackUp2: ; 361c8
+BattleCommand_AttackUp2:
; attackup2
ld b, $10 | ATTACK
jr BattleCommand_StatUp
-BattleCommand_DefenseUp2: ; 361cc
+BattleCommand_DefenseUp2:
; defenseup2
ld b, $10 | DEFENSE
jr BattleCommand_StatUp
-BattleCommand_SpeedUp2: ; 361d0
+BattleCommand_SpeedUp2:
; speedup2
ld b, $10 | SPEED
jr BattleCommand_StatUp
-BattleCommand_SpecialAttackUp2: ; 361d4
+BattleCommand_SpecialAttackUp2:
; specialattackup2
ld b, $10 | SP_ATTACK
jr BattleCommand_StatUp
-BattleCommand_SpecialDefenseUp2: ; 361d8
+BattleCommand_SpecialDefenseUp2:
; specialdefenseup2
ld b, $10 | SP_DEFENSE
jr BattleCommand_StatUp
-BattleCommand_AccuracyUp2: ; 361dc
+BattleCommand_AccuracyUp2:
; accuracyup2
ld b, $10 | ACCURACY
jr BattleCommand_StatUp
-BattleCommand_EvasionUp2: ; 361e0
+BattleCommand_EvasionUp2:
; evasionup2
ld b, $10 | EVASION
jr BattleCommand_StatUp
-BattleCommand_StatUp: ; 361e4
+BattleCommand_StatUp:
; statup
call CheckIfStatCanBeRaised
ld a, [wFailedMessage]
@@ -4480,10 +4400,9 @@ BattleCommand_StatUp: ; 361e4
ret nz
jp StatUpAnimation
-; 361ef
-CheckIfStatCanBeRaised: ; 361ef
+CheckIfStatCanBeRaised:
ld a, b
ld [wLoweredStat], a
ld hl, wPlayerStatLevels
@@ -4562,35 +4481,31 @@ CheckIfStatCanBeRaised: ; 361ef
ld [wFailedMessage], a
ret
-; 3626e
-.stats_already_max ; 3626e
+.stats_already_max
pop hl
dec [hl]
; fallthrough
-; 36270
-.cant_raise_stat ; 36270
+.cant_raise_stat
ld a, $2
ld [wFailedMessage], a
ld a, $1
ld [wAttackMissed], a
ret
-; 3627b
-.stat_raise_failed ; 3627b
+.stat_raise_failed
ld a, $1
ld [wFailedMessage], a
ret
-; 36281
-StatUpAnimation: ; 36281
+StatUpAnimation:
ld bc, wPlayerMinimized
ld hl, DropPlayerSub
ld a, [hBattleTurn]
@@ -4615,79 +4530,78 @@ StatUpAnimation: ; 36281
call WaitBGMap
jp BattleCommand_MoveDelay
-; 362ad
-BattleCommand_AttackDown: ; 362ad
+BattleCommand_AttackDown:
; attackdown
ld a, ATTACK
jr BattleCommand_StatDown
-BattleCommand_DefenseDown: ; 362b1
+BattleCommand_DefenseDown:
; defensedown
ld a, DEFENSE
jr BattleCommand_StatDown
-BattleCommand_SpeedDown: ; 362b5
+BattleCommand_SpeedDown:
; speeddown
ld a, SPEED
jr BattleCommand_StatDown
-BattleCommand_SpecialAttackDown: ; 362b9
+BattleCommand_SpecialAttackDown:
; specialattackdown
ld a, SP_ATTACK
jr BattleCommand_StatDown
-BattleCommand_SpecialDefenseDown: ; 362bd
+BattleCommand_SpecialDefenseDown:
; specialdefensedown
ld a, SP_DEFENSE
jr BattleCommand_StatDown
-BattleCommand_AccuracyDown: ; 362c1
+BattleCommand_AccuracyDown:
; accuracydown
ld a, ACCURACY
jr BattleCommand_StatDown
-BattleCommand_EvasionDown: ; 362c5
+BattleCommand_EvasionDown:
; evasiondown
ld a, EVASION
jr BattleCommand_StatDown
-BattleCommand_AttackDown2: ; 362c9
+BattleCommand_AttackDown2:
; attackdown2
ld a, $10 | ATTACK
jr BattleCommand_StatDown
-BattleCommand_DefenseDown2: ; 362cd
+BattleCommand_DefenseDown2:
; defensedown2
ld a, $10 | DEFENSE
jr BattleCommand_StatDown
-BattleCommand_SpeedDown2: ; 362d1
+BattleCommand_SpeedDown2:
; speeddown2
ld a, $10 | SPEED
jr BattleCommand_StatDown
-BattleCommand_SpecialAttackDown2: ; 362d5
+BattleCommand_SpecialAttackDown2:
; specialattackdown2
ld a, $10 | SP_ATTACK
jr BattleCommand_StatDown
-BattleCommand_SpecialDefenseDown2: ; 362d9
+BattleCommand_SpecialDefenseDown2:
; specialdefensedown2
ld a, $10 | SP_DEFENSE
jr BattleCommand_StatDown
-BattleCommand_AccuracyDown2: ; 362dd
+BattleCommand_AccuracyDown2:
; accuracydown2
ld a, $10 | ACCURACY
jr BattleCommand_StatDown
-BattleCommand_EvasionDown2: ; 362e1
+BattleCommand_EvasionDown2:
; evasiondown2
ld a, $10 | EVASION
-BattleCommand_StatDown: ; 362e3
+BattleCommand_StatDown:
; statdown
ld [wLoweredStat], a
@@ -4810,10 +4724,9 @@ BattleCommand_StatDown: ; 362e3
ld [wAttackMissed], a
ret
-; 36391
-CheckMist: ; 36391
+CheckMist:
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
cp EFFECT_ATTACK_DOWN
@@ -4838,10 +4751,9 @@ CheckMist: ; 36391
bit SUBSTATUS_MIST, a
ret
-; 363b8
-BattleCommand_StatUpMessage: ; 363b8
+BattleCommand_StatUpMessage:
ld a, [wFailedMessage]
and a
ret nz
@@ -4871,10 +4783,9 @@ BattleCommand_StatUpMessage: ; 363b8
text_jump UnknownText_0x1c0ce0
db "@"
-; 363e9
-BattleCommand_StatDownMessage: ; 363e9
+BattleCommand_StatDownMessage:
ld a, [wFailedMessage]
and a
ret nz
@@ -4903,10 +4814,9 @@ BattleCommand_StatDownMessage: ; 363e9
text_jump UnknownText_0x1c0d06
db "@"
-; 3641a
-TryLowerStat: ; 3641a
+TryLowerStat:
; Lower stat c from stat struct hl (buffer de).
push bc
@@ -4949,10 +4859,9 @@ TryLowerStat: ; 3641a
and a
ret
-; 3644c
-BattleCommand_StatUpFailText: ; 3644c
+BattleCommand_StatUpFailText:
; statupfailtext
ld a, [wFailedMessage]
and a
@@ -4970,10 +4879,9 @@ BattleCommand_StatUpFailText: ; 3644c
ld hl, WontRiseAnymoreText
jp StdBattleTextBox
-; 3646a
-BattleCommand_StatDownFailText: ; 3646a
+BattleCommand_StatDownFailText:
; statdownfailtext
ld a, [wFailedMessage]
and a
@@ -4994,10 +4902,9 @@ BattleCommand_StatDownFailText: ; 3646a
ld hl, WontDropAnymoreText
jp StdBattleTextBox
-; 3648f
-GetStatName: ; 3648f
+GetStatName:
ld hl, StatNames
ld c, "@"
.CheckName:
@@ -5020,7 +4927,7 @@ INCLUDE "data/battle/stat_names.asm"
INCLUDE "data/battle/stat_multipliers.asm"
-BattleCommand_AllStatsUp: ; 36500
+BattleCommand_AllStatsUp:
; allstatsup
; Attack
@@ -5047,18 +4954,16 @@ BattleCommand_AllStatsUp: ; 36500
call ResetMiss
call BattleCommand_SpecialDefenseUp
jp BattleCommand_StatUpMessage
-; 3652d
-ResetMiss: ; 3652d
+ResetMiss:
xor a
ld [wAttackMissed], a
ret
-; 36532
-LowerStat: ; 36532
+LowerStat:
ld [wLoweredStat], a
ld hl, wPlayerStatLevels
@@ -5129,10 +5034,9 @@ LowerStat: ; 36532
ld [wFailedMessage], a
ret
-; 3658f
-BattleCommand_TriStatusChance: ; 3658f
+BattleCommand_TriStatusChance:
; tristatuschance
call BattleCommand_EffectChance
@@ -5152,20 +5056,18 @@ BattleCommand_TriStatusChance: ; 3658f
dw BattleCommand_ParalyzeTarget ; paralyze
dw BattleCommand_FreezeTarget ; freeze
dw BattleCommand_BurnTarget ; burn
-; 365a7
-BattleCommand_Curl: ; 365a7
+BattleCommand_Curl:
; curl
ld a, BATTLE_VARS_SUBSTATUS2
call GetBattleVarAddr
set SUBSTATUS_CURLED, [hl]
ret
-; 365af
-BattleCommand_RaiseSubNoAnim: ; 365af
+BattleCommand_RaiseSubNoAnim:
ld hl, GetBattleMonBackpic
ld a, [hBattleTurn]
and a
@@ -5177,10 +5079,9 @@ BattleCommand_RaiseSubNoAnim: ; 365af
call CallBattleCore
jp WaitBGMap
-; 365c3
-BattleCommand_LowerSubNoAnim: ; 365c3
+BattleCommand_LowerSubNoAnim:
ld hl, DropPlayerSub
ld a, [hBattleTurn]
and a
@@ -5192,10 +5093,9 @@ BattleCommand_LowerSubNoAnim: ; 365c3
call CallBattleCore
jp WaitBGMap
-; 365d7
-CalcPlayerStats: ; 365d7
+CalcPlayerStats:
ld hl, wPlayerAtkLevel
ld de, wPlayerStats
ld bc, wBattleMonAttack
@@ -5216,10 +5116,9 @@ CalcPlayerStats: ; 365d7
jp BattleCommand_SwitchTurn
-; 365fd
-CalcEnemyStats: ; 365fd
+CalcEnemyStats:
ld hl, wEnemyAtkLevel
ld de, wEnemyStats
ld bc, wEnemyMonAttack
@@ -5237,10 +5136,9 @@ CalcEnemyStats: ; 365fd
jp BattleCommand_SwitchTurn
-; 3661d
-CalcStats: ; 3661d
+CalcStats:
.loop
push af
ld a, [hli]
@@ -5309,13 +5207,12 @@ CalcStats: ; 3661d
ret
-; 36671
INCLUDE "engine/battle/move_effects/bide.asm"
-BattleCommand_CheckRampage: ; 3671a
+BattleCommand_CheckRampage:
; checkrampage
ld de, wPlayerRolloutCount
@@ -5352,10 +5249,9 @@ BattleCommand_CheckRampage: ; 3671a
ld b, rampage_command
jp SkipToBattleCommand
-; 36751
-BattleCommand_Rampage: ; 36751
+BattleCommand_Rampage:
; rampage
; No rampage during Sleep Talk.
@@ -5382,23 +5278,21 @@ BattleCommand_Rampage: ; 36751
ld [wSomeoneIsRampaging], a
ret
-; 36778
INCLUDE "engine/battle/move_effects/teleport.asm"
-SetBattleDraw: ; 36804
+SetBattleDraw:
ld a, [wBattleResult]
and BATTLERESULT_BITMASK
or DRAW
ld [wBattleResult], a
ret
-; 3680f
-BattleCommand_ForceSwitch: ; 3680f
+BattleCommand_ForceSwitch:
; forceswitch
ld a, [wBattleType]
@@ -5617,10 +5511,9 @@ BattleCommand_ForceSwitch: ; 3680f
.do_text
jp StdBattleTextBox
-; 36994
-CheckPlayerHasMonToSwitchTo: ; 36994
+CheckPlayerHasMonToSwitchTo:
ld a, [wPartyCount]
ld d, a
ld e, 0
@@ -5649,10 +5542,9 @@ CheckPlayerHasMonToSwitchTo: ; 36994
and a
ret
-; 369b6
-BattleCommand_EndLoop: ; 369b6
+BattleCommand_EndLoop:
; endloop
; Loop back to 'critical'.
@@ -5786,10 +5678,9 @@ BattleCommand_EndLoop: ; 369b6
ld [wBattleScriptBufferAddress], a
ret
-; 36a82
-BattleCommand_FakeOut: ; 36a82
+BattleCommand_FakeOut:
ld a, [wAttackMissed]
and a
ret nz
@@ -5810,10 +5701,9 @@ BattleCommand_FakeOut: ; 36a82
ld [wAttackMissed], a
ret
-; 36aa0
-BattleCommand_FlinchTarget: ; 36aa0
+BattleCommand_FlinchTarget:
call CheckSubstituteOpp
ret nz
@@ -5830,19 +5720,17 @@ BattleCommand_FlinchTarget: ; 36aa0
ret nz
; fallthrough
-; 36ab5
-FlinchTarget: ; 36ab5
+FlinchTarget:
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVarAddr
set SUBSTATUS_FLINCHED, [hl]
jp EndRechargeOpp
-; 36abf
-CheckOpponentWentFirst: ; 36abf
+CheckOpponentWentFirst:
; Returns a=0, z if user went first
; Returns a=1, nz if opponent went first
push bc
@@ -5853,10 +5741,9 @@ CheckOpponentWentFirst: ; 36abf
pop bc
ret
-; 36ac9
-BattleCommand_HeldFlinch: ; 36ac9
+BattleCommand_HeldFlinch:
; kingsrock
ld a, [wAttackMissed]
@@ -5884,10 +5771,9 @@ BattleCommand_HeldFlinch: ; 36ac9
set SUBSTATUS_FLINCHED, [hl]
ret
-; 36af3
-BattleCommand_OHKO: ; 36af3
+BattleCommand_OHKO:
; ohko
call ResetDamage
@@ -5933,10 +5819,9 @@ BattleCommand_OHKO: ; 36af3
ld [wAttackMissed], a
ret
-; 36b3a
-BattleCommand_CheckCharge: ; 36b3a
+BattleCommand_CheckCharge:
; checkcharge
ld a, BATTLE_VARS_SUBSTATUS3
@@ -5949,10 +5834,9 @@ BattleCommand_CheckCharge: ; 36b3a
ld b, charge_command
jp SkipToBattleCommand
-; 36b4d
-BattleCommand_Charge: ; 36b4d
+BattleCommand_Charge:
; charge
call BattleCommand_ClearText
@@ -6092,17 +5976,15 @@ BattleCommand_Charge: ; 36b4d
; 'dug a hole!'
text_jump UnknownText_0x1c0d6c
db "@"
-; 36c2c
-BattleCommand3c: ; 36c2c
+BattleCommand3c:
; unused
ret
-; 36c2d
-BattleCommand_TrapTarget: ; 36c2d
+BattleCommand_TrapTarget:
; traptarget
ld a, [wAttackMissed]
@@ -6157,7 +6039,6 @@ BattleCommand_TrapTarget: ; 36c2d
dbw FIRE_SPIN, FireSpinTrapText ; 'was trapped!'
dbw CLAMP, ClampedByText ; 'was CLAMPED by'
dbw WHIRLPOOL, WhirlpoolTrapText ; 'was trapped!'
-; 36c7e
INCLUDE "engine/battle/move_effects/mist.asm"
@@ -6165,7 +6046,7 @@ INCLUDE "engine/battle/move_effects/mist.asm"
INCLUDE "engine/battle/move_effects/focus_energy.asm"
-BattleCommand_Recoil: ; 36cb2
+BattleCommand_Recoil:
; recoil
ld hl, wBattleMonMaxHP
@@ -6229,10 +6110,9 @@ BattleCommand_Recoil: ; 36cb2
ld hl, RecoilText
jp StdBattleTextBox
-; 36d1d
-BattleCommand_ConfuseTarget: ; 36d1d
+BattleCommand_ConfuseTarget:
; confusetarget
call GetOpponentItem
@@ -6253,7 +6133,7 @@ BattleCommand_ConfuseTarget: ; 36d1d
jr BattleCommand_FinishConfusingTarget
-BattleCommand_Confuse: ; 36d3b
+BattleCommand_Confuse:
; confuse
call GetOpponentItem
@@ -6282,7 +6162,7 @@ BattleCommand_Confuse: ; 36d3b
ld a, [wAttackMissed]
and a
jr nz, BattleCommand_Confuse_CheckSnore_Swagger_ConfuseHit
-BattleCommand_FinishConfusingTarget: ; 36d70
+BattleCommand_FinishConfusingTarget:
ld bc, wEnemyConfuseCount
ld a, [hBattleTurn]
and a
@@ -6325,9 +6205,8 @@ BattleCommand_FinishConfusingTarget: ; 36d70
ld hl, UseConfusionHealingItem
jp CallBattleCore
-; 36db6
-BattleCommand_Confuse_CheckSnore_Swagger_ConfuseHit: ; 36db6
+BattleCommand_Confuse_CheckSnore_Swagger_ConfuseHit:
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
cp EFFECT_CONFUSE_HIT
@@ -6338,10 +6217,9 @@ BattleCommand_Confuse_CheckSnore_Swagger_ConfuseHit: ; 36db6
ret z
jp PrintDidntAffect2
-; 36dc7
-BattleCommand_Paralyze: ; 36dc7
+BattleCommand_Paralyze:
; paralyze
ld a, BATTLE_VARS_STATUS_OPP
@@ -6421,10 +6299,9 @@ BattleCommand_Paralyze: ; 36dc7
call AnimateFailedMove
jp PrintDoesntAffect
-; 36e5b
-CheckMoveTypeMatchesTarget: ; 36e5b
+CheckMoveTypeMatchesTarget:
; Compare move type to opponent type.
; Return z if matching the opponent type,
; unless the move is Normal (Tri Attack).
@@ -6459,23 +6336,21 @@ CheckMoveTypeMatchesTarget: ; 36e5b
pop hl
ret
-; 36e7c
INCLUDE "engine/battle/move_effects/substitute.asm"
-BattleCommand_RechargeNextTurn: ; 36f0b
+BattleCommand_RechargeNextTurn:
; rechargenextturn
ld a, BATTLE_VARS_SUBSTATUS4
call GetBattleVarAddr
set SUBSTATUS_RECHARGE, [hl]
ret
-; 36f13
-EndRechargeOpp: ; 36f13
+EndRechargeOpp:
push hl
ld a, BATTLE_VARS_SUBSTATUS4_OPP
call GetBattleVarAddr
@@ -6483,13 +6358,12 @@ EndRechargeOpp: ; 36f13
pop hl
ret
-; 36f1d
INCLUDE "engine/battle/move_effects/rage.asm"
-BattleCommand_DoubleFlyingDamage: ; 36f25
+BattleCommand_DoubleFlyingDamage:
; doubleflyingdamage
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
@@ -6497,10 +6371,9 @@ BattleCommand_DoubleFlyingDamage: ; 36f25
ret z
jr DoubleDamage
-; 36f2f
-BattleCommand_DoubleUndergroundDamage: ; 36f2f
+BattleCommand_DoubleUndergroundDamage:
; doubleundergrounddamage
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
@@ -6508,10 +6381,9 @@ BattleCommand_DoubleUndergroundDamage: ; 36f2f
ret z
; fallthrough
-; 36f37
-DoubleDamage: ; 36f37
+DoubleDamage:
ld hl, wCurDamage + 1
sla [hl]
dec hl
@@ -6524,7 +6396,6 @@ DoubleDamage: ; 36f37
.quit
ret
-; 36f46
INCLUDE "engine/battle/move_effects/mimic.asm"
@@ -6540,7 +6411,7 @@ INCLUDE "engine/battle/move_effects/pay_day.asm"
INCLUDE "engine/battle/move_effects/conversion.asm"
-BattleCommand_ResetStats: ; 3710e
+BattleCommand_ResetStats:
; resetstats
ld a, 7 ; neutral
@@ -6573,10 +6444,9 @@ BattleCommand_ResetStats: ; 3710e
jr nz, .next
ret
-; 3713e
-BattleCommand_Heal: ; 3713e
+BattleCommand_Heal:
; heal
ld de, wBattleMonHP
@@ -6658,13 +6528,12 @@ BattleCommand_Heal: ; 3713e
ld hl, HPIsFullText
jp StdBattleTextBox
-; 371cd
INCLUDE "engine/battle/move_effects/transform.asm"
-BattleSideCopy: ; 372c6
+BattleSideCopy:
; Copy bc bytes from hl to de if it's the player's turn.
; Copy bc bytes from de to hl if it's the enemy's turn.
ld a, [hBattleTurn]
@@ -6679,17 +6548,15 @@ BattleSideCopy: ; 372c6
.copy
jp CopyBytes
-; 372d2
-BattleEffect_ButItFailed: ; 372d2
+BattleEffect_ButItFailed:
call AnimateFailedMove
jp PrintButItFailed
-; 372d8
-ClearLastMove: ; 372d8
+ClearLastMove:
ld a, BATTLE_VARS_LAST_COUNTER_MOVE
call GetBattleVarAddr
xor a
@@ -6701,10 +6568,9 @@ ClearLastMove: ; 372d8
ld [hl], a
ret
-; 372e7
-ResetActorDisable: ; 372e7
+ResetActorDisable:
ld a, [hBattleTurn]
and a
jr z, .player
@@ -6720,10 +6586,9 @@ ResetActorDisable: ; 372e7
ld [wDisabledMove], a
ret
-; 372fc
-BattleCommand_Screen: ; 372fc
+BattleCommand_Screen:
; screen
ld hl, wPlayerScreens
@@ -6768,87 +6633,76 @@ BattleCommand_Screen: ; 372fc
call AnimateFailedMove
jp PrintButItFailed
-; 3733d
-PrintDoesntAffect: ; 3733d
+PrintDoesntAffect:
; 'it doesn't affect'
ld hl, DoesntAffectText
jp StdBattleTextBox
-; 37343
-PrintNothingHappened: ; 37343
+PrintNothingHappened:
; 'but nothing happened!'
ld hl, NothingHappenedText
jp StdBattleTextBox
-; 37349
-TryPrintButItFailed: ; 37349
+TryPrintButItFailed:
ld a, [wAlreadyFailed]
and a
ret nz
; fallthrough
-; 3734e
-PrintButItFailed: ; 3734e
+PrintButItFailed:
; 'but it failed!'
ld hl, ButItFailedText
jp StdBattleTextBox
-; 37354
FailMove:
call AnimateFailedMove
; fallthrough
-; 37357
-FailMimic: ; 37357
+FailMimic:
ld hl, ButItFailedText ; 'but it failed!'
ld de, ItFailedText ; 'it failed!'
jp FailText_CheckOpponentProtect
-; 37360
-PrintDidntAffect: ; 37360
+PrintDidntAffect:
; 'it didn't affect'
ld hl, DidntAffect1Text
jp StdBattleTextBox
-; 37366
-PrintDidntAffect2: ; 37366
+PrintDidntAffect2:
call AnimateFailedMove
ld hl, DidntAffect1Text ; 'it didn't affect'
ld de, DidntAffect2Text ; 'it didn't affect'
jp FailText_CheckOpponentProtect
-; 37372
-PrintParalyze: ; 37372
+PrintParalyze:
; 'paralyzed! maybe it can't attack!'
ld hl, ParalyzedText
jp StdBattleTextBox
-; 37378
-CheckSubstituteOpp: ; 37378
+CheckSubstituteOpp:
ld a, BATTLE_VARS_SUBSTATUS4_OPP
call GetBattleVar
bit SUBSTATUS_SUBSTITUTE, a
ret
-; 37380
INCLUDE "engine/battle/move_effects/selfdestruct.asm"
@@ -6858,7 +6712,7 @@ INCLUDE "engine/battle/move_effects/mirror_move.asm"
INCLUDE "engine/battle/move_effects/metronome.asm"
-CheckUserMove: ; 37462
+CheckUserMove:
; Return z if the user has move a.
ld b, a
ld de, wBattleMonMoves
@@ -6882,10 +6736,9 @@ CheckUserMove: ; 37462
and a
ret
-; 3747b
-ResetTurn: ; 3747b
+ResetTurn:
ld hl, wPlayerCharging
ld a, [hBattleTurn]
and a
@@ -6899,13 +6752,12 @@ ResetTurn: ; 3747b
call DoMove
jp EndMoveEffect
-; 37492
INCLUDE "engine/battle/move_effects/thief.asm"
-BattleCommand_ArenaTrap: ; 37517
+BattleCommand_ArenaTrap:
; arenatrap
; Doesn't work on an absent opponent.
@@ -6931,13 +6783,12 @@ BattleCommand_ArenaTrap: ; 37517
call AnimateFailedMove
jp PrintButItFailed
-; 37536
INCLUDE "engine/battle/move_effects/nightmare.asm"
-BattleCommand_Defrost: ; 37563
+BattleCommand_Defrost:
; defrost
; Thaw the user.
@@ -6968,7 +6819,6 @@ BattleCommand_Defrost: ; 37563
ld hl, WasDefrostedText
jp StdBattleTextBox
-; 37588
INCLUDE "engine/battle/move_effects/curse.asm"
@@ -6988,11 +6838,10 @@ INCLUDE "engine/battle/move_effects/sandstorm.asm"
INCLUDE "engine/battle/move_effects/rollout.asm"
-BattleCommand5d: ; 37791
+BattleCommand5d:
; unused
ret
-; 37792
INCLUDE "engine/battle/move_effects/fury_cutter.asm"
@@ -7008,7 +6857,7 @@ INCLUDE "engine/battle/move_effects/frustration.asm"
INCLUDE "engine/battle/move_effects/safeguard.asm"
-SafeCheckSafeguard: ; 37962
+SafeCheckSafeguard:
push hl
ld hl, wEnemyScreens
ld a, [hBattleTurn]
@@ -7021,10 +6870,9 @@ SafeCheckSafeguard: ; 37962
pop hl
ret
-; 37972
-BattleCommand_CheckSafeguard: ; 37972
+BattleCommand_CheckSafeguard:
; checksafeguard
ld hl, wEnemyScreens
ld a, [hBattleTurn]
@@ -7041,7 +6889,6 @@ BattleCommand_CheckSafeguard: ; 37972
call StdBattleTextBox
jp EndMoveEffect
-; 37991
INCLUDE "engine/battle/move_effects/magnitude.asm"
@@ -7053,27 +6900,24 @@ INCLUDE "engine/battle/move_effects/pursuit.asm"
INCLUDE "engine/battle/move_effects/rapid_spin.asm"
-BattleCommand_HealMorn: ; 37b74
+BattleCommand_HealMorn:
; healmorn
ld b, MORN_F
jr BattleCommand_TimeBasedHealContinue
-; 37b78
-BattleCommand_HealDay: ; 37b78
+BattleCommand_HealDay:
; healday
ld b, DAY_F
jr BattleCommand_TimeBasedHealContinue
-; 37b7c
-BattleCommand_HealNite: ; 37b7c
+BattleCommand_HealNite:
; healnite
ld b, NITE_F
; fallthrough
-; 37b7e
-BattleCommand_TimeBasedHealContinue: ; 37b7e
+BattleCommand_TimeBasedHealContinue:
; Time- and weather-sensitive heal.
ld hl, wBattleMonMaxHP
@@ -7154,7 +6998,6 @@ BattleCommand_TimeBasedHealContinue: ; 37b7e
dw GetQuarterMaxHP
dw GetHalfMaxHP
dw GetMaxHP
-; 37be8
INCLUDE "engine/battle/move_effects/hidden_power.asm"
@@ -7170,7 +7013,7 @@ INCLUDE "engine/battle/move_effects/psych_up.asm"
INCLUDE "engine/battle/move_effects/mirror_coat.asm"
-BattleCommand_DoubleMinimizeDamage: ; 37ce6
+BattleCommand_DoubleMinimizeDamage:
; doubleminimizedamage
ld hl, wEnemyMinimized
@@ -7192,10 +7035,9 @@ BattleCommand_DoubleMinimizeDamage: ; 37ce6
ld [hl], a
ret
-; 37d02
-BattleCommand_SkipSunCharge: ; 37d02
+BattleCommand_SkipSunCharge:
; mimicsuncharge
ld a, [wBattleWeather]
cp WEATHER_SUN
@@ -7203,7 +7045,6 @@ BattleCommand_SkipSunCharge: ; 37d02
ld b, charge_command
jp SkipToBattleCommand
-; 37d0d
INCLUDE "engine/battle/move_effects/future_sight.asm"
@@ -7211,17 +7052,16 @@ INCLUDE "engine/battle/move_effects/future_sight.asm"
INCLUDE "engine/battle/move_effects/thunder.asm"
-CheckHiddenOpponent: ; 37daa
+CheckHiddenOpponent:
; BUG: This routine should account for Lock-On and Mind Reader.
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
ret
-; 37db2
-GetUserItem: ; 37db2
+GetUserItem:
; Return the effect of the user's item in bc, and its id at hl.
ld hl, wBattleMonItem
ld a, [hBattleTurn]
@@ -7232,10 +7072,9 @@ GetUserItem: ; 37db2
ld b, [hl]
jp GetItemHeldEffect
-; 37dc1
-GetOpponentItem: ; 37dc1
+GetOpponentItem:
; Return the effect of the opponent's item in bc, and its id at hl.
ld hl, wEnemyMonItem
ld a, [hBattleTurn]
@@ -7246,10 +7085,9 @@ GetOpponentItem: ; 37dc1
ld b, [hl]
jp GetItemHeldEffect
-; 37dd0
-GetItemHeldEffect: ; 37dd0
+GetItemHeldEffect:
; Return the effect of item b in bc.
ld a, b
and a
@@ -7269,10 +7107,9 @@ GetItemHeldEffect: ; 37dd0
pop hl
ret
-; 37de9
-AnimateCurrentMoveEitherSide: ; 37de9
+AnimateCurrentMoveEitherSide:
push hl
push de
push bc
@@ -7288,10 +7125,9 @@ AnimateCurrentMoveEitherSide: ; 37de9
pop hl
ret
-; 37e01
-AnimateCurrentMove: ; 37e01
+AnimateCurrentMove:
push hl
push de
push bc
@@ -7307,10 +7143,9 @@ AnimateCurrentMove: ; 37e01
pop hl
ret
-; 37e19
-PlayDamageAnim: ; 37e19
+PlayDamageAnim:
xor a
ld [wFXAnimID + 1], a
@@ -7332,10 +7167,9 @@ PlayDamageAnim: ; 37e19
jp PlayUserBattleAnim
-; 37e36
-LoadMoveAnim: ; 37e36
+LoadMoveAnim:
xor a
ld [wNumHits], a
ld [wFXAnimID + 1], a
@@ -7346,17 +7180,15 @@ LoadMoveAnim: ; 37e36
ret z
; fallthrough
-; 37e44
-LoadAnim: ; 37e44
+LoadAnim:
ld [wFXAnimID], a
; fallthrough
-; 37e47
-PlayUserBattleAnim: ; 37e47
+PlayUserBattleAnim:
push hl
push de
push bc
@@ -7366,10 +7198,9 @@ PlayUserBattleAnim: ; 37e47
pop hl
ret
-; 37e54
-PlayOpponentBattleAnim: ; 37e54
+PlayOpponentBattleAnim:
ld a, e
ld [wFXAnimID], a
ld a, d
@@ -7390,35 +7221,31 @@ PlayOpponentBattleAnim: ; 37e54
pop hl
ret
-; 37e73
-CallBattleCore: ; 37e73
+CallBattleCore:
ld a, BANK("Battle Core")
rst FarCall
ret
-; 37e77
-AnimateFailedMove: ; 37e77
+AnimateFailedMove:
call BattleCommand_LowerSub
call BattleCommand_MoveDelay
jp BattleCommand_RaiseSub
-; 37e80
-BattleCommand_MoveDelay: ; 37e80
+BattleCommand_MoveDelay:
; movedelay
; Wait 40 frames.
ld c, 40
jp DelayFrames
-; 37e85
-BattleCommand_ClearText: ; 37e85
+BattleCommand_ClearText:
; cleartext
; Used in multi-hit moves.
@@ -7427,10 +7254,9 @@ BattleCommand_ClearText: ; 37e85
.text
db "@"
-; 37e8c
-SkipToBattleCommand: ; 37e8c
+SkipToBattleCommand:
; Skip over commands until reaching command b.
ld a, [wBattleScriptBufferAddress + 1]
ld h, a
@@ -7447,10 +7273,9 @@ SkipToBattleCommand: ; 37e8c
ld [wBattleScriptBufferAddress], a
ret
-; 37ea1
-GetMoveAttr: ; 37ea1
+GetMoveAttr:
; Assuming hl = Moves + x, return attribute x of move a.
push bc
ld bc, MOVE_LENGTH
@@ -7459,10 +7284,9 @@ GetMoveAttr: ; 37ea1
pop bc
ret
-; 37ead
-GetMoveData: ; 37ead
+GetMoveData:
; Copy move struct a to de.
ld hl, Moves
ld bc, MOVE_LENGTH
@@ -7470,38 +7294,33 @@ GetMoveData: ; 37ead
ld a, BANK(Moves)
jp FarCopyBytes
-; 37ebb
-GetMoveByte: ; 37ebb
+GetMoveByte:
ld a, BANK(Moves)
jp GetFarByte
-; 37ec0
-DisappearUser: ; 37ec0
+DisappearUser:
farcall _DisappearUser
ret
-; 37ec7
-AppearUserLowerSub: ; 37ec7
+AppearUserLowerSub:
farcall _AppearUserLowerSub
ret
-; 37ece
-AppearUserRaiseSub: ; 37ece
+AppearUserRaiseSub:
farcall _AppearUserRaiseSub
ret
-; 37ed5
-_CheckBattleScene: ; 37ed5
+_CheckBattleScene:
; Checks the options. Returns carry if battle animations are disabled.
push hl
push de
@@ -7512,4 +7331,3 @@ _CheckBattleScene: ; 37ed5
pop hl
ret
-; 37ee2
diff --git a/engine/battle/hidden_power.asm b/engine/battle/hidden_power.asm
index 9d9a8dc0e..5f3791e18 100644
--- a/engine/battle/hidden_power.asm
+++ b/engine/battle/hidden_power.asm
@@ -1,4 +1,4 @@
-HiddenPowerDamage: ; fbced
+HiddenPowerDamage:
; Override Hidden Power's type and power based on the user's DVs.
ld hl, wBattleMonDVs
@@ -108,4 +108,3 @@ HiddenPowerDamage: ; fbced
pop af
ld d, a
ret
-; fbd54
diff --git a/engine/battle/link_result.asm b/engine/battle/link_result.asm
index 1dbc40aa9..0dd339fe4 100644
--- a/engine/battle/link_result.asm
+++ b/engine/battle/link_result.asm
@@ -1,4 +1,4 @@
-DetermineLinkBattleResult: ; 2b930
+DetermineLinkBattleResult:
farcall UpdateEnemyMonInParty
ld hl, wPartyMon1HP
call .CountMonsRemaining
@@ -58,7 +58,7 @@ DetermineLinkBattleResult: ; 2b930
ld [wBattleResult], a
ret
-.CountMonsRemaining: ; 2b995
+.CountMonsRemaining:
ld c, 0
ld b, 3
ld de, PARTYMON_STRUCT_LENGTH - 1
@@ -74,7 +74,7 @@ DetermineLinkBattleResult: ; 2b930
jr nz, .loop
ret
-.CalcPercentHPRemaining: ; 2b9a6
+.CalcPercentHPRemaining:
ld de, 0
ld c, $3
.loop2
@@ -117,7 +117,7 @@ DetermineLinkBattleResult: ; 2b930
jr nz, .loop2
ret
-.BothSides_CheckNumberMonsAtFullHealth: ; 2b9e1
+.BothSides_CheckNumberMonsAtFullHealth:
ld hl, wPartyMon1HP
call .CheckFaintedOrFullHealth
jr nz, .finish ; we have a pokemon that's neither fainted nor at full health
@@ -136,7 +136,7 @@ DetermineLinkBattleResult: ; 2b930
and a
ret
-.CheckFaintedOrFullHealth: ; 2ba01
+.CheckFaintedOrFullHealth:
ld d, 3
.loop3
ld a, [hli]
diff --git a/engine/battle/menu.asm b/engine/battle/menu.asm
index 705df3729..8f06b99f2 100644
--- a/engine/battle/menu.asm
+++ b/engine/battle/menu.asm
@@ -1,4 +1,4 @@
-LoadBattleMenu: ; 24ef2
+LoadBattleMenu:
ld hl, BattleMenuHeader
call LoadMenuHeader
ld a, [wBattleMenuCursorBuffer]
@@ -8,21 +8,18 @@ LoadBattleMenu: ; 24ef2
ld [wBattleMenuCursorBuffer], a
call ExitMenu
ret
-; 24f0b
-SafariBattleMenu: ; 24f0b
+SafariBattleMenu:
; untranslated
ld hl, MenuHeader_0x24f4e
call LoadMenuHeader
jr Function24f19
-; 24f13
-ContestBattleMenu: ; 24f13
+ContestBattleMenu:
ld hl, MenuHeader_0x24f89
call LoadMenuHeader
-; 24f19
-Function24f19: ; 24f19
+Function24f19:
ld a, [wBattleMenuCursorBuffer]
ld [wMenuCursorBuffer], a
call _2DMenu
@@ -30,14 +27,12 @@ Function24f19: ; 24f19
ld [wBattleMenuCursorBuffer], a
call ExitMenu
ret
-; 24f2c
-BattleMenuHeader: ; 24f2c
+BattleMenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 8, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
dw MenuData_0x24f34
db 1 ; default option
-; 24f34
MenuData_0x24f34: ; 0x24f34
db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags
@@ -52,64 +47,55 @@ Strings24f3d: ; 0x24f3d
db "<PKMN>@"
db "PACK@"
db "RUN@"
-; 24f4e
-MenuHeader_0x24f4e: ; 24f4e
+MenuHeader_0x24f4e:
db MENU_BACKUP_TILES ; flags
menu_coords 0, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
dw MenuData_0x24f56
db 1 ; default option
-; 24f56
-MenuData_0x24f56: ; 24f56
+MenuData_0x24f56:
db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags
dn 2, 2 ; rows, columns
db 11 ; spacing
dba Strings24f5f
dba Function24f7c
-; 24f5f
-Strings24f5f: ; 24f5f
+Strings24f5f:
db "サファりボール×  @" ; "SAFARI BALL× @"
db "エサをなげる@" ; "THROW BAIT"
db "いしをなげる@" ; "THROW ROCK"
db "にげる@" ; "RUN"
-; 24f7c
-Function24f7c: ; 24f7c
+Function24f7c:
hlcoord 17, 13
ld de, wSafariBallsRemaining
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
ret
-; 24f89
-MenuHeader_0x24f89: ; 24f89
+MenuHeader_0x24f89:
db MENU_BACKUP_TILES ; flags
menu_coords 2, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
dw MenuData_0x24f91
db 1 ; default option
-; 24f91
-MenuData_0x24f91: ; 24f91
+MenuData_0x24f91:
db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags
dn 2, 2 ; rows, columns
db 12 ; spacing
dba Strings24f9a
dba Function24fb2
-; 24f9a
-Strings24f9a: ; 24f9a
+Strings24f9a:
db "FIGHT@"
db "<PKMN>", "@"
db "PARKBALL× @"
db "RUN@"
-; 24fb2
-Function24fb2: ; 24fb2
+Function24fb2:
hlcoord 13, 16
ld de, wParkBallsRemaining
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
ret
-; 24fbf
diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm
index 581f5381e..1b6cb6783 100644
--- a/engine/battle/misc.asm
+++ b/engine/battle/misc.asm
@@ -1,4 +1,4 @@
-_DisappearUser: ; fbd54
+_DisappearUser:
xor a
ld [hBGMapMode], a
ld a, [hBattleTurn]
@@ -12,14 +12,14 @@ _DisappearUser: ; fbd54
call ClearBox
jr FinishAppearDisappearUser
-_AppearUserRaiseSub: ; fbd69 (3e:7d69)
+_AppearUserRaiseSub:
farcall BattleCommand_RaiseSubNoAnim
jr AppearUser
-_AppearUserLowerSub: ; fbd71 (3e:7d71)
+_AppearUserLowerSub:
farcall BattleCommand_LowerSubNoAnim
-AppearUser: ; fbd77 (3e:7d77)
+AppearUser:
xor a
ld [hBGMapMode], a
ld a, [hBattleTurn]
@@ -34,23 +34,23 @@ AppearUser: ; fbd77 (3e:7d77)
.okay
ld [hGraphicStartTile], a
predef PlaceGraphic
-FinishAppearDisappearUser: ; fbd91 (3e:7d91)
+FinishAppearDisappearUser:
ld a, $1
ld [hBGMapMode], a
ret
-GetEnemyFrontpicCoords: ; fbd96 (3e:7d96)
+GetEnemyFrontpicCoords:
hlcoord 12, 0
lb bc, 7, 7
ret
-GetPlayerBackpicCoords: ; fbd9d (3e:7d9d)
+GetPlayerBackpicCoords:
hlcoord 2, 6
lb bc, 6, 6
ret
-DoWeatherModifiers: ; fbda4
+DoWeatherModifiers:
ld de, WeatherTypeModifiers
ld a, [wBattleWeather]
@@ -148,7 +148,7 @@ DoWeatherModifiers: ; fbda4
INCLUDE "data/battle/weather_modifiers.asm"
-DoBadgeTypeBoosts: ; fbe24
+DoBadgeTypeBoosts:
ld a, [wLinkMode]
and a
ret nz
diff --git a/engine/battle/move_effects/attract.asm b/engine/battle/move_effects/attract.asm
index 026176694..45417936f 100644
--- a/engine/battle/move_effects/attract.asm
+++ b/engine/battle/move_effects/attract.asm
@@ -1,4 +1,4 @@
-BattleCommand_Attract: ; 377ce
+BattleCommand_Attract:
; attract
ld a, [wAttackMissed]
and a
@@ -21,10 +21,9 @@ BattleCommand_Attract: ; 377ce
.failed
jp FailMove
-; 377f5
-CheckOppositeGender: ; 377f5
+CheckOppositeGender:
ld a, MON_SPECIES
call BattlePartyAttr
ld a, [hl]
@@ -76,4 +75,3 @@ CheckOppositeGender: ; 377f5
.genderless_samegender
scf
ret
-; 3784b
diff --git a/engine/battle/move_effects/baton_pass.asm b/engine/battle/move_effects/baton_pass.asm
index 369565877..2937a8306 100644
--- a/engine/battle/move_effects/baton_pass.asm
+++ b/engine/battle/move_effects/baton_pass.asm
@@ -1,4 +1,4 @@
-BattleCommand_BatonPass: ; 379c9
+BattleCommand_BatonPass:
; batonpass
ld a, [hBattleTurn]
@@ -81,10 +81,9 @@ BattleCommand_BatonPass: ; 379c9
jr ResetBatonPassStatus
-; 37a67
-BatonPass_LinkPlayerSwitch: ; 37a67
+BatonPass_LinkPlayerSwitch:
ld a, [wLinkMode]
and a
ret z
@@ -101,10 +100,9 @@ BatonPass_LinkPlayerSwitch: ; 37a67
ld [wBattlePlayerAction], a
ret
-; 37a82
-BatonPass_LinkEnemySwitch: ; 37a82
+BatonPass_LinkEnemySwitch:
ld a, [wLinkMode]
and a
ret z
@@ -129,17 +127,15 @@ BatonPass_LinkEnemySwitch: ; 37a82
.switch
jp CloseWindow
-; 37aab
-FailedBatonPass: ; 37aab
+FailedBatonPass:
call AnimateFailedMove
jp PrintButItFailed
-; 37ab1
-ResetBatonPassStatus: ; 37ab1
+ResetBatonPassStatus:
; Reset status changes that aren't passed by Baton Pass.
; Nightmare isn't passed.
@@ -178,10 +174,9 @@ ResetBatonPassStatus: ; 37ab1
ld [wEnemyWrapCount], a
ret
-; 37ae9
-CheckAnyOtherAlivePartyMons: ; 37ae9
+CheckAnyOtherAlivePartyMons:
ld hl, wPartyMon1HP
ld a, [wPartyCount]
ld d, a
@@ -189,10 +184,9 @@ CheckAnyOtherAlivePartyMons: ; 37ae9
ld e, a
jr CheckAnyOtherAliveMons
-; 37af6
-CheckAnyOtherAliveEnemyMons: ; 37af6
+CheckAnyOtherAliveEnemyMons:
ld hl, wOTPartyMon1HP
ld a, [wOTPartyCount]
ld d, a
@@ -200,9 +194,8 @@ CheckAnyOtherAliveEnemyMons: ; 37af6
ld e, a
; fallthrough
-; 37b01
-CheckAnyOtherAliveMons: ; 37b01
+CheckAnyOtherAliveMons:
; Check for nonzero HP starting from partymon
; HP at hl for d partymons, besides current mon e.
@@ -238,4 +231,3 @@ CheckAnyOtherAliveMons: ; 37b01
and a
ret
-; 37b1d
diff --git a/engine/battle/move_effects/beat_up.asm b/engine/battle/move_effects/beat_up.asm
index 8ea308d90..40a375e0d 100644
--- a/engine/battle/move_effects/beat_up.asm
+++ b/engine/battle/move_effects/beat_up.asm
@@ -1,4 +1,4 @@
-BattleCommand_BeatUp: ; 35461
+BattleCommand_BeatUp:
; beatup
call ResetDamage
@@ -193,17 +193,15 @@ BattleCommand_BeatUp: ; 35461
ld d, a
ret
-; 355b0
-.beatup_fail ; 355b0
+.beatup_fail
ld b, buildopponentrage_command
jp SkipToBattleCommand
-; 355b5
-BattleCommand_BeatUpFailText: ; 355b5
+BattleCommand_BeatUpFailText:
; beatupfailtext
ld a, [wBeatUpHitAtLeastOnce]
@@ -212,10 +210,9 @@ BattleCommand_BeatUpFailText: ; 355b5
jp PrintButItFailed
-; 355bd
-GetBeatupMonLocation: ; 355bd
+GetBeatupMonLocation:
push bc
ld c, a
ld b, 0
diff --git a/engine/battle/move_effects/belly_drum.asm b/engine/battle/move_effects/belly_drum.asm
index bd300c9cd..aec3a1d68 100644
--- a/engine/battle/move_effects/belly_drum.asm
+++ b/engine/battle/move_effects/belly_drum.asm
@@ -1,4 +1,4 @@
-BattleCommand_BellyDrum: ; 37c1a
+BattleCommand_BellyDrum:
; bellydrum
; This command is buggy because it raises the user's attack
; before checking that it has enough HP to use the move.
@@ -33,4 +33,3 @@ BattleCommand_BellyDrum: ; 37c1a
call AnimateFailedMove
jp PrintButItFailed
-; 37c55
diff --git a/engine/battle/move_effects/bide.asm b/engine/battle/move_effects/bide.asm
index d9958ca53..b28773df9 100644
--- a/engine/battle/move_effects/bide.asm
+++ b/engine/battle/move_effects/bide.asm
@@ -1,4 +1,4 @@
-BattleCommand_StoreEnergy: ; 36671
+BattleCommand_StoreEnergy:
; storeenergy
ld a, BATTLE_VARS_SUBSTATUS3
@@ -69,10 +69,9 @@ BattleCommand_StoreEnergy: ; 36671
call StdBattleTextBox
jp EndMoveEffect
-; 366e5
-BattleCommand_UnleashEnergy: ; 366e5
+BattleCommand_UnleashEnergy:
; unleashenergy
ld de, wPlayerDamageTaken
@@ -102,4 +101,3 @@ BattleCommand_UnleashEnergy: ; 366e5
call AnimateCurrentMove
jp EndMoveEffect
-; 3671a
diff --git a/engine/battle/move_effects/conversion.asm b/engine/battle/move_effects/conversion.asm
index d66d23a5e..bc2c746df 100644
--- a/engine/battle/move_effects/conversion.asm
+++ b/engine/battle/move_effects/conversion.asm
@@ -1,4 +1,4 @@
-BattleCommand_Conversion: ; 3707f
+BattleCommand_Conversion:
; conversion
ld hl, wBattleMonMoves
@@ -95,4 +95,3 @@ BattleCommand_Conversion: ; 3707f
ld hl, TransformedTypeText
jp StdBattleTextBox
-; 3710e
diff --git a/engine/battle/move_effects/conversion2.asm b/engine/battle/move_effects/conversion2.asm
index c0e390926..b1d0e6282 100644
--- a/engine/battle/move_effects/conversion2.asm
+++ b/engine/battle/move_effects/conversion2.asm
@@ -1,4 +1,4 @@
-BattleCommand_Conversion2: ; 359e6
+BattleCommand_Conversion2:
; conversion2
ld a, [wAttackMissed]
@@ -63,4 +63,3 @@ BattleCommand_Conversion2: ; 359e6
.failed
jp FailMove
-; 35a53
diff --git a/engine/battle/move_effects/counter.asm b/engine/battle/move_effects/counter.asm
index b811b293c..9d10d1865 100644
--- a/engine/battle/move_effects/counter.asm
+++ b/engine/battle/move_effects/counter.asm
@@ -1,4 +1,4 @@
-BattleCommand_Counter: ; 35813
+BattleCommand_Counter:
; counter
ld a, 1
@@ -57,4 +57,3 @@ BattleCommand_Counter: ; 35813
ld [wAttackMissed], a
ret
-; 35864
diff --git a/engine/battle/move_effects/curse.asm b/engine/battle/move_effects/curse.asm
index b11b9f3fb..e0fc0144c 100644
--- a/engine/battle/move_effects/curse.asm
+++ b/engine/battle/move_effects/curse.asm
@@ -1,4 +1,4 @@
-BattleCommand_Curse: ; 37588
+BattleCommand_Curse:
; curse
ld de, wBattleMonType1
@@ -94,4 +94,3 @@ BattleCommand_Curse: ; 37588
call AnimateFailedMove
ld hl, WontRiseAnymoreText
jp StdBattleTextBox
-; 37618
diff --git a/engine/battle/move_effects/destiny_bond.asm b/engine/battle/move_effects/destiny_bond.asm
index 2dc125ddf..427c8b08a 100644
--- a/engine/battle/move_effects/destiny_bond.asm
+++ b/engine/battle/move_effects/destiny_bond.asm
@@ -1,4 +1,4 @@
-BattleCommand_DestinyBond: ; 35bff
+BattleCommand_DestinyBond:
; destinybond
ld a, BATTLE_VARS_SUBSTATUS5
@@ -8,4 +8,3 @@ BattleCommand_DestinyBond: ; 35bff
ld hl, DestinyBondEffectText
jp StdBattleTextBox
-; 35c0f
diff --git a/engine/battle/move_effects/disable.asm b/engine/battle/move_effects/disable.asm
index 5df785d24..b1055b200 100644
--- a/engine/battle/move_effects/disable.asm
+++ b/engine/battle/move_effects/disable.asm
@@ -1,4 +1,4 @@
-BattleCommand_Disable: ; 36fed
+BattleCommand_Disable:
; disable
ld a, [wAttackMissed]
@@ -71,4 +71,3 @@ BattleCommand_Disable: ; 36fed
.failed
jp FailMove
-; 3705c
diff --git a/engine/battle/move_effects/encore.asm b/engine/battle/move_effects/encore.asm
index e6607fb11..e65925f52 100644
--- a/engine/battle/move_effects/encore.asm
+++ b/engine/battle/move_effects/encore.asm
@@ -1,4 +1,4 @@
-BattleCommand_Encore: ; 35864
+BattleCommand_Encore:
; encore
ld hl, wEnemyMonMoves
@@ -119,4 +119,3 @@ BattleCommand_Encore: ; 35864
.failed
jp PrintDidntAffect2
-; 35926
diff --git a/engine/battle/move_effects/endure.asm b/engine/battle/move_effects/endure.asm
index ed4329ff5..f0555a737 100644
--- a/engine/battle/move_effects/endure.asm
+++ b/engine/battle/move_effects/endure.asm
@@ -1,4 +1,4 @@
-BattleCommand_Endure: ; 3766f
+BattleCommand_Endure:
; endure
; Endure shares code with Protect. See protect.asm.
@@ -14,4 +14,3 @@ BattleCommand_Endure: ; 3766f
ld hl, BracedItselfText
jp StdBattleTextBox
-; 37683
diff --git a/engine/battle/move_effects/false_swipe.asm b/engine/battle/move_effects/false_swipe.asm
index f00de91e7..c61aa534a 100644
--- a/engine/battle/move_effects/false_swipe.asm
+++ b/engine/battle/move_effects/false_swipe.asm
@@ -1,4 +1,4 @@
-BattleCommand_FalseSwipe: ; 35c94
+BattleCommand_FalseSwipe:
; falseswipe
; Makes sure wCurDamage < MonHP
@@ -47,4 +47,3 @@ BattleCommand_FalseSwipe: ; 35c94
and a
ret
-; 35cc9
diff --git a/engine/battle/move_effects/focus_energy.asm b/engine/battle/move_effects/focus_energy.asm
index 2a3726c53..8fa6b19ff 100644
--- a/engine/battle/move_effects/focus_energy.asm
+++ b/engine/battle/move_effects/focus_energy.asm
@@ -1,4 +1,4 @@
-BattleCommand_FocusEnergy: ; 36c98
+BattleCommand_FocusEnergy:
; focusenergy
ld a, BATTLE_VARS_SUBSTATUS4
@@ -14,4 +14,3 @@ BattleCommand_FocusEnergy: ; 36c98
call AnimateFailedMove
jp PrintButItFailed
-; 36cb2
diff --git a/engine/battle/move_effects/foresight.asm b/engine/battle/move_effects/foresight.asm
index 8c51bb220..4235e0878 100644
--- a/engine/battle/move_effects/foresight.asm
+++ b/engine/battle/move_effects/foresight.asm
@@ -1,4 +1,4 @@
-BattleCommand_Foresight: ; 376a0
+BattleCommand_Foresight:
; foresight
ld a, [wAttackMissed]
@@ -20,4 +20,3 @@ BattleCommand_Foresight: ; 376a0
.failed
jp FailMove
-; 376c2
diff --git a/engine/battle/move_effects/frustration.asm b/engine/battle/move_effects/frustration.asm
index 3f8456ced..5e45636be 100644
--- a/engine/battle/move_effects/frustration.asm
+++ b/engine/battle/move_effects/frustration.asm
@@ -1,4 +1,4 @@
-BattleCommand_FrustrationPower: ; 3790e
+BattleCommand_FrustrationPower:
; frustrationpower
push bc
@@ -26,4 +26,3 @@ BattleCommand_FrustrationPower: ; 3790e
pop bc
ret
-; 37939
diff --git a/engine/battle/move_effects/fury_cutter.asm b/engine/battle/move_effects/fury_cutter.asm
index 91679368f..b34264d62 100644
--- a/engine/battle/move_effects/fury_cutter.asm
+++ b/engine/battle/move_effects/fury_cutter.asm
@@ -1,4 +1,4 @@
-BattleCommand_FuryCutter: ; 37792
+BattleCommand_FuryCutter:
; furycutter
ld hl, wPlayerFuryCutterCount
@@ -38,10 +38,9 @@ BattleCommand_FuryCutter: ; 37792
ld [hl], a
ret
-; 377be
-ResetFuryCutterCount: ; 377be
+ResetFuryCutterCount:
push hl
@@ -58,4 +57,3 @@ ResetFuryCutterCount: ; 377be
pop hl
ret
-; 377ce
diff --git a/engine/battle/move_effects/future_sight.asm b/engine/battle/move_effects/future_sight.asm
index fa2148ab7..c1b5c0e72 100644
--- a/engine/battle/move_effects/future_sight.asm
+++ b/engine/battle/move_effects/future_sight.asm
@@ -1,4 +1,4 @@
-BattleCommand_CheckFutureSight: ; 37d0d
+BattleCommand_CheckFutureSight:
; checkfuturesight
ld hl, wPlayerFutureSightCount
@@ -25,9 +25,8 @@ BattleCommand_CheckFutureSight: ; 37d0d
ld b, futuresight_command
jp SkipToBattleCommand
-; 37d34
-BattleCommand_FutureSight: ; 37d34
+BattleCommand_FutureSight:
; futuresight
call CheckUserIsCharging
@@ -82,4 +81,3 @@ BattleCommand_FutureSight: ; 37d34
call PrintButItFailed
jp EndMoveEffect
-; 37d94
diff --git a/engine/battle/move_effects/heal_bell.asm b/engine/battle/move_effects/heal_bell.asm
index c79362f9c..060ac3423 100644
--- a/engine/battle/move_effects/heal_bell.asm
+++ b/engine/battle/move_effects/heal_bell.asm
@@ -1,4 +1,4 @@
-BattleCommand_HealBell: ; 35cc9
+BattleCommand_HealBell:
; healbell
ld a, BATTLE_VARS_SUBSTATUS1
@@ -33,4 +33,3 @@ BattleCommand_HealBell: ; 35cc9
jp z, CalcPlayerStats
jp CalcEnemyStats
-; 35d00
diff --git a/engine/battle/move_effects/hidden_power.asm b/engine/battle/move_effects/hidden_power.asm
index f96becf97..19d7e0b32 100644
--- a/engine/battle/move_effects/hidden_power.asm
+++ b/engine/battle/move_effects/hidden_power.asm
@@ -1,4 +1,4 @@
-BattleCommand_HiddenPower: ; 37be8
+BattleCommand_HiddenPower:
; hiddenpower
ld a, [wAttackMissed]
@@ -7,4 +7,3 @@ BattleCommand_HiddenPower: ; 37be8
farcall HiddenPowerDamage
ret
-; 37bf4
diff --git a/engine/battle/move_effects/leech_seed.asm b/engine/battle/move_effects/leech_seed.asm
index 328a2c416..44019a6ad 100644
--- a/engine/battle/move_effects/leech_seed.asm
+++ b/engine/battle/move_effects/leech_seed.asm
@@ -1,4 +1,4 @@
-BattleCommand_LeechSeed: ; 36f9d
+BattleCommand_LeechSeed:
; leechseed
ld a, [wAttackMissed]
and a
@@ -39,4 +39,3 @@ BattleCommand_LeechSeed: ; 36f9d
ld hl, EvadedText
jp StdBattleTextBox
-; 36fe1
diff --git a/engine/battle/move_effects/lock_on.asm b/engine/battle/move_effects/lock_on.asm
index 36d8db926..7b6503575 100644
--- a/engine/battle/move_effects/lock_on.asm
+++ b/engine/battle/move_effects/lock_on.asm
@@ -1,4 +1,4 @@
-BattleCommand_LockOn: ; 35a53
+BattleCommand_LockOn:
; lockon
call CheckSubstituteOpp
@@ -20,4 +20,3 @@ BattleCommand_LockOn: ; 35a53
call AnimateFailedMove
jp PrintDidntAffect
-; 35a74
diff --git a/engine/battle/move_effects/magnitude.asm b/engine/battle/move_effects/magnitude.asm
index f56ec5c1b..4dcf919d7 100644
--- a/engine/battle/move_effects/magnitude.asm
+++ b/engine/battle/move_effects/magnitude.asm
@@ -1,4 +1,4 @@
-BattleCommand_GetMagnitude: ; 37991
+BattleCommand_GetMagnitude:
; getmagnitude
push bc
diff --git a/engine/battle/move_effects/metronome.asm b/engine/battle/move_effects/metronome.asm
index 6835ab569..b5632d005 100644
--- a/engine/battle/move_effects/metronome.asm
+++ b/engine/battle/move_effects/metronome.asm
@@ -1,4 +1,4 @@
-BattleCommand_Metronome: ; 37418
+BattleCommand_Metronome:
; metronome
call ClearLastMove
@@ -40,7 +40,6 @@ BattleCommand_Metronome: ; 37418
ld [hl], b
call UpdateMoveData
jp ResetTurn
-; 37454
INCLUDE "data/battle/metronome_exception_moves.asm"
diff --git a/engine/battle/move_effects/mimic.asm b/engine/battle/move_effects/mimic.asm
index 712b42df1..2f91d6a1d 100644
--- a/engine/battle/move_effects/mimic.asm
+++ b/engine/battle/move_effects/mimic.asm
@@ -1,4 +1,4 @@
-BattleCommand_Mimic: ; 36f46
+BattleCommand_Mimic:
; mimic
call ClearLastMove
@@ -49,4 +49,3 @@ BattleCommand_Mimic: ; 36f46
.fail
jp FailMimic
-; 36f9d
diff --git a/engine/battle/move_effects/mirror_coat.asm b/engine/battle/move_effects/mirror_coat.asm
index 41e296108..f8b8ca114 100644
--- a/engine/battle/move_effects/mirror_coat.asm
+++ b/engine/battle/move_effects/mirror_coat.asm
@@ -1,4 +1,4 @@
-BattleCommand_MirrorCoat: ; 37c95
+BattleCommand_MirrorCoat:
; mirrorcoat
ld a, 1
@@ -58,4 +58,3 @@ BattleCommand_MirrorCoat: ; 37c95
ld [wAttackMissed], a
ret
-; 37ce6
diff --git a/engine/battle/move_effects/mirror_move.asm b/engine/battle/move_effects/mirror_move.asm
index c4f208d77..089403839 100644
--- a/engine/battle/move_effects/mirror_move.asm
+++ b/engine/battle/move_effects/mirror_move.asm
@@ -1,4 +1,4 @@
-BattleCommand_MirrorMove: ; 373c9
+BattleCommand_MirrorMove:
; mirrormove
call ClearLastMove
@@ -49,4 +49,3 @@ BattleCommand_MirrorMove: ; 373c9
.done
call BattleCommand_MoveDelay
jp ResetTurn
-; 37418
diff --git a/engine/battle/move_effects/mist.asm b/engine/battle/move_effects/mist.asm
index 9ffd86c8e..52e4e59f4 100644
--- a/engine/battle/move_effects/mist.asm
+++ b/engine/battle/move_effects/mist.asm
@@ -1,4 +1,4 @@
-BattleCommand_Mist: ; 36c7e
+BattleCommand_Mist:
; mist
ld a, BATTLE_VARS_SUBSTATUS4
@@ -14,4 +14,3 @@ BattleCommand_Mist: ; 36c7e
call AnimateFailedMove
jp PrintButItFailed
-; 36c98
diff --git a/engine/battle/move_effects/nightmare.asm b/engine/battle/move_effects/nightmare.asm
index 788e3de41..dd85c722d 100644
--- a/engine/battle/move_effects/nightmare.asm
+++ b/engine/battle/move_effects/nightmare.asm
@@ -1,4 +1,4 @@
-BattleCommand_Nightmare: ; 37536
+BattleCommand_Nightmare:
; nightmare
; Can't hit an absent opponent.
@@ -35,4 +35,3 @@ BattleCommand_Nightmare: ; 37536
.failed
call AnimateFailedMove
jp PrintButItFailed
-; 37563
diff --git a/engine/battle/move_effects/pain_split.asm b/engine/battle/move_effects/pain_split.asm
index 2db3726c6..a4dbd3d44 100644
--- a/engine/battle/move_effects/pain_split.asm
+++ b/engine/battle/move_effects/pain_split.asm
@@ -1,4 +1,4 @@
-BattleCommand_PainSplit: ; 35926
+BattleCommand_PainSplit:
; painsplit
ld a, [wAttackMissed]
@@ -65,7 +65,7 @@ BattleCommand_PainSplit: ; 35926
inc de
inc de
-.EnemyShareHP: ; 359ac
+.EnemyShareHP:
ld c, [hl]
dec hl
ld a, [wCurDamage + 1]
@@ -89,9 +89,7 @@ BattleCommand_PainSplit: ; 35926
ld [wBuffer6], a
ret
-; 359cd
.ButItFailed:
jp PrintDidntAffect2
-; 359d0
diff --git a/engine/battle/move_effects/pay_day.asm b/engine/battle/move_effects/pay_day.asm
index a5d2fed0d..53705d434 100644
--- a/engine/battle/move_effects/pay_day.asm
+++ b/engine/battle/move_effects/pay_day.asm
@@ -1,4 +1,4 @@
-BattleCommand_PayDay: ; 3705c
+BattleCommand_PayDay:
; payday
xor a
@@ -25,4 +25,3 @@ BattleCommand_PayDay: ; 3705c
ld hl, CoinsScatteredText
jp StdBattleTextBox
-; 3707f
diff --git a/engine/battle/move_effects/perish_song.asm b/engine/battle/move_effects/perish_song.asm
index 8c88c8739..221ecfb46 100644
--- a/engine/battle/move_effects/perish_song.asm
+++ b/engine/battle/move_effects/perish_song.asm
@@ -1,4 +1,4 @@
-BattleCommand_PerishSong: ; 376c2
+BattleCommand_PerishSong:
; perishsong
@@ -37,4 +37,3 @@ BattleCommand_PerishSong: ; 376c2
.failed
call AnimateFailedMove
jp PrintButItFailed
-; 376f8
diff --git a/engine/battle/move_effects/present.asm b/engine/battle/move_effects/present.asm
index a2ef5bc64..2bbea8028 100644
--- a/engine/battle/move_effects/present.asm
+++ b/engine/battle/move_effects/present.asm
@@ -1,4 +1,4 @@
-BattleCommand_Present: ; 37874
+BattleCommand_Present:
; present
ld a, [wLinkMode]
diff --git a/engine/battle/move_effects/protect.asm b/engine/battle/move_effects/protect.asm
index 6c65e0ed1..768e51cbb 100644
--- a/engine/battle/move_effects/protect.asm
+++ b/engine/battle/move_effects/protect.asm
@@ -1,4 +1,4 @@
-BattleCommand_Protect: ; 37618
+BattleCommand_Protect:
; protect
call ProtectChance
ret c
@@ -11,10 +11,9 @@ BattleCommand_Protect: ; 37618
ld hl, ProtectedItselfText
jp StdBattleTextBox
-; 3762c
-ProtectChance: ; 3762c
+ProtectChance:
ld de, wPlayerProtectCount
ld a, [hBattleTurn]
@@ -77,4 +76,3 @@ ProtectChance: ; 3762c
call PrintButItFailed
scf
ret
-; 3766f
diff --git a/engine/battle/move_effects/psych_up.asm b/engine/battle/move_effects/psych_up.asm
index c57fff9cd..743e93c86 100644
--- a/engine/battle/move_effects/psych_up.asm
+++ b/engine/battle/move_effects/psych_up.asm
@@ -1,4 +1,4 @@
-BattleCommand_PsychUp: ; 37c55
+BattleCommand_PsychUp:
; psychup
ld hl, wEnemyStatLevels
@@ -48,4 +48,3 @@ BattleCommand_PsychUp: ; 37c55
ld hl, CopiedStatsText
jp StdBattleTextBox
-; 37c95
diff --git a/engine/battle/move_effects/pursuit.asm b/engine/battle/move_effects/pursuit.asm
index 969e08f73..640957516 100644
--- a/engine/battle/move_effects/pursuit.asm
+++ b/engine/battle/move_effects/pursuit.asm
@@ -1,4 +1,4 @@
-BattleCommand_Pursuit: ; 37b1d
+BattleCommand_Pursuit:
; pursuit
; Double damage if the opponent is switching.
@@ -23,4 +23,3 @@ BattleCommand_Pursuit: ; 37b1d
ld [hl], a
ret
-; 37b39
diff --git a/engine/battle/move_effects/rage.asm b/engine/battle/move_effects/rage.asm
index ac01f8137..1f40cc1fb 100644
--- a/engine/battle/move_effects/rage.asm
+++ b/engine/battle/move_effects/rage.asm
@@ -1,8 +1,7 @@
-BattleCommand_Rage: ; 36f1d
+BattleCommand_Rage:
; rage
ld a, BATTLE_VARS_SUBSTATUS4
call GetBattleVarAddr
set SUBSTATUS_RAGE, [hl]
ret
-; 36f25
diff --git a/engine/battle/move_effects/rain_dance.asm b/engine/battle/move_effects/rain_dance.asm
index 6c587d551..fa8881c3c 100644
--- a/engine/battle/move_effects/rain_dance.asm
+++ b/engine/battle/move_effects/rain_dance.asm
@@ -1,4 +1,4 @@
-BattleCommand_StartRain: ; 37bf4
+BattleCommand_StartRain:
; startrain
ld a, WEATHER_RAIN
ld [wBattleWeather], a
@@ -8,4 +8,3 @@ BattleCommand_StartRain: ; 37bf4
ld hl, DownpourText
jp StdBattleTextBox
-; 37c07
diff --git a/engine/battle/move_effects/rapid_spin.asm b/engine/battle/move_effects/rapid_spin.asm
index 84bcbad7f..089be7667 100644
--- a/engine/battle/move_effects/rapid_spin.asm
+++ b/engine/battle/move_effects/rapid_spin.asm
@@ -1,4 +1,4 @@
-BattleCommand_ClearHazards: ; 37b39
+BattleCommand_ClearHazards:
; clearhazards
ld a, BATTLE_VARS_SUBSTATUS4
@@ -35,4 +35,3 @@ BattleCommand_ClearHazards: ; 37b39
ld hl, ReleasedByText
jp StdBattleTextBox
-; 37b74
diff --git a/engine/battle/move_effects/return.asm b/engine/battle/move_effects/return.asm
index e1d568e7c..ee83843b3 100644
--- a/engine/battle/move_effects/return.asm
+++ b/engine/battle/move_effects/return.asm
@@ -1,4 +1,4 @@
-BattleCommand_HappinessPower: ; 3784b
+BattleCommand_HappinessPower:
; happinesspower
push bc
ld hl, wBattleMonHappiness
@@ -24,4 +24,3 @@ BattleCommand_HappinessPower: ; 3784b
pop bc
ret
-; 37874
diff --git a/engine/battle/move_effects/rollout.asm b/engine/battle/move_effects/rollout.asm
index f6966c48a..da890f48f 100644
--- a/engine/battle/move_effects/rollout.asm
+++ b/engine/battle/move_effects/rollout.asm
@@ -1,7 +1,7 @@
MAX_ROLLOUT_COUNT EQU 5
-BattleCommand_CheckCurl: ; 37718
+BattleCommand_CheckCurl:
; checkcurl
ld de, wPlayerRolloutCount
@@ -22,10 +22,9 @@ BattleCommand_CheckCurl: ; 37718
xor a
ld [de], a
ret
-; 37734
-BattleCommand_RolloutPower: ; 37734
+BattleCommand_RolloutPower:
; rolloutpower
ld a, BATTLE_VARS_STATUS
@@ -96,4 +95,3 @@ BattleCommand_RolloutPower: ; 37734
.done_damage
ret
-; 37791
diff --git a/engine/battle/move_effects/safeguard.asm b/engine/battle/move_effects/safeguard.asm
index 1dc233eab..e4e2e0951 100644
--- a/engine/battle/move_effects/safeguard.asm
+++ b/engine/battle/move_effects/safeguard.asm
@@ -1,4 +1,4 @@
-BattleCommand_Safeguard: ; 37939
+BattleCommand_Safeguard:
; safeguard
ld hl, wPlayerScreens
@@ -22,4 +22,3 @@ BattleCommand_Safeguard: ; 37939
call AnimateFailedMove
jp PrintButItFailed
-; 37962
diff --git a/engine/battle/move_effects/sandstorm.asm b/engine/battle/move_effects/sandstorm.asm
index 5aaa61deb..77d6e24b5 100644
--- a/engine/battle/move_effects/sandstorm.asm
+++ b/engine/battle/move_effects/sandstorm.asm
@@ -1,4 +1,4 @@
-BattleCommand_StartSandstorm: ; 376f8
+BattleCommand_StartSandstorm:
; startsandstorm
ld a, [wBattleWeather]
@@ -16,4 +16,3 @@ BattleCommand_StartSandstorm: ; 376f8
.failed
call AnimateFailedMove
jp PrintButItFailed
-; 37718
diff --git a/engine/battle/move_effects/selfdestruct.asm b/engine/battle/move_effects/selfdestruct.asm
index 6f6b0966f..3c7b05ef9 100644
--- a/engine/battle/move_effects/selfdestruct.asm
+++ b/engine/battle/move_effects/selfdestruct.asm
@@ -1,4 +1,4 @@
-BattleCommand_Selfdestruct: ; 37380
+BattleCommand_Selfdestruct:
farcall StubbedTrainerRankings_Selfdestruct
ld a, BATTLEANIM_PLAYER_DAMAGE
ld [wNumHits], a
@@ -28,4 +28,3 @@ BattleCommand_Selfdestruct: ; 37380
call WaitBGMap
jp RefreshBattleHuds
-; 373c9
diff --git a/engine/battle/move_effects/sketch.asm b/engine/battle/move_effects/sketch.asm
index 93f7ff30c..1f2e67dd4 100644
--- a/engine/battle/move_effects/sketch.asm
+++ b/engine/battle/move_effects/sketch.asm
@@ -1,4 +1,4 @@
-BattleCommand_Sketch: ; 35a74
+BattleCommand_Sketch:
; sketch
call ClearLastMove
@@ -116,4 +116,3 @@ BattleCommand_Sketch: ; 35a74
call AnimateFailedMove
jp PrintDidntAffect
-; 35b16
diff --git a/engine/battle/move_effects/sleep_talk.asm b/engine/battle/move_effects/sleep_talk.asm
index 3f62d4e36..ce7a27ed5 100644
--- a/engine/battle/move_effects/sleep_talk.asm
+++ b/engine/battle/move_effects/sleep_talk.asm
@@ -1,4 +1,4 @@
-BattleCommand_SleepTalk: ; 35b33
+BattleCommand_SleepTalk:
; sleeptalk
call ClearLastMove
@@ -142,4 +142,3 @@ BattleCommand_SleepTalk: ; 35b33
cp EFFECT_BIDE
ret
-; 35bff
diff --git a/engine/battle/move_effects/snore.asm b/engine/battle/move_effects/snore.asm
index 49fb1b210..4544b7fbd 100644
--- a/engine/battle/move_effects/snore.asm
+++ b/engine/battle/move_effects/snore.asm
@@ -1,4 +1,4 @@
-BattleCommand_Snore: ; 359d0
+BattleCommand_Snore:
; snore
ld a, BATTLE_VARS_STATUS
call GetBattleVar
@@ -10,4 +10,3 @@ BattleCommand_Snore: ; 359d0
call FailMove
jp EndMoveEffect
-; 359e6
diff --git a/engine/battle/move_effects/spikes.asm b/engine/battle/move_effects/spikes.asm
index 6cab0b96f..1eca7ae53 100644
--- a/engine/battle/move_effects/spikes.asm
+++ b/engine/battle/move_effects/spikes.asm
@@ -1,4 +1,4 @@
-BattleCommand_Spikes: ; 37683
+BattleCommand_Spikes:
; spikes
ld hl, wEnemyScreens
@@ -24,4 +24,3 @@ BattleCommand_Spikes: ; 37683
.failed
jp FailMove
-; 376a0
diff --git a/engine/battle/move_effects/spite.asm b/engine/battle/move_effects/spite.asm
index 30a908ae7..7c9499074 100644
--- a/engine/battle/move_effects/spite.asm
+++ b/engine/battle/move_effects/spite.asm
@@ -1,4 +1,4 @@
-BattleCommand_Spite: ; 35c0f
+BattleCommand_Spite:
; spite
ld a, [wAttackMissed]
@@ -85,4 +85,3 @@ BattleCommand_Spite: ; 35c0f
.failed
jp PrintDidntAffect2
-; 35c94
diff --git a/engine/battle/move_effects/splash.asm b/engine/battle/move_effects/splash.asm
index 5b5e504b8..ed9eeb4ca 100644
--- a/engine/battle/move_effects/splash.asm
+++ b/engine/battle/move_effects/splash.asm
@@ -1,6 +1,5 @@
-BattleCommand_Splash: ; 36fe1
+BattleCommand_Splash:
call AnimateCurrentMove
farcall StubbedTrainerRankings_Splash
jp PrintNothingHappened
-; 36fed
diff --git a/engine/battle/move_effects/substitute.asm b/engine/battle/move_effects/substitute.asm
index 1deaa848d..f439afd78 100644
--- a/engine/battle/move_effects/substitute.asm
+++ b/engine/battle/move_effects/substitute.asm
@@ -1,4 +1,4 @@
-BattleCommand_Substitute: ; 36e7c
+BattleCommand_Substitute:
; substitute
call BattleCommand_MoveDelay
@@ -87,4 +87,3 @@ BattleCommand_Substitute: ; 36e7c
.jp_stdbattletextbox
jp StdBattleTextBox
-; 36f0b
diff --git a/engine/battle/move_effects/sunny_day.asm b/engine/battle/move_effects/sunny_day.asm
index ef8c37c5c..ad2298401 100644
--- a/engine/battle/move_effects/sunny_day.asm
+++ b/engine/battle/move_effects/sunny_day.asm
@@ -1,4 +1,4 @@
-BattleCommand_StartSun: ; 37c07
+BattleCommand_StartSun:
; startsun
ld a, WEATHER_SUN
ld [wBattleWeather], a
@@ -8,4 +8,3 @@ BattleCommand_StartSun: ; 37c07
ld hl, SunGotBrightText
jp StdBattleTextBox
-; 37c1a
diff --git a/engine/battle/move_effects/teleport.asm b/engine/battle/move_effects/teleport.asm
index 1bd1eb725..b9c7f9fb2 100644
--- a/engine/battle/move_effects/teleport.asm
+++ b/engine/battle/move_effects/teleport.asm
@@ -1,4 +1,4 @@
-BattleCommand_Teleport: ; 36778
+BattleCommand_Teleport:
; teleport
ld a, [wBattleType]
@@ -88,4 +88,3 @@ BattleCommand_Teleport: ; 36778
ld hl, FledFromBattleText
jp StdBattleTextBox
-; 36804
diff --git a/engine/battle/move_effects/thief.asm b/engine/battle/move_effects/thief.asm
index 5397c2bdf..d9d2f47fd 100644
--- a/engine/battle/move_effects/thief.asm
+++ b/engine/battle/move_effects/thief.asm
@@ -1,4 +1,4 @@
-BattleCommand_Thief: ; 37492
+BattleCommand_Thief:
; thief
ld a, [hBattleTurn]
@@ -113,4 +113,3 @@ BattleCommand_Thief: ; 37492
ld e, l
ld hl, wEnemyMonItem
ret
-; 37517
diff --git a/engine/battle/move_effects/thunder.asm b/engine/battle/move_effects/thunder.asm
index 3705e1a28..1a87176bd 100644
--- a/engine/battle/move_effects/thunder.asm
+++ b/engine/battle/move_effects/thunder.asm
@@ -1,4 +1,4 @@
-BattleCommand_ThunderAccuracy: ; 37d94
+BattleCommand_ThunderAccuracy:
; thunderaccuracy
ld a, BATTLE_VARS_MOVE_TYPE
@@ -17,4 +17,3 @@ BattleCommand_ThunderAccuracy: ; 37d94
ld [hl], 100 percent
ret
-; 37daa
diff --git a/engine/battle/move_effects/transform.asm b/engine/battle/move_effects/transform.asm
index 5ae7c1511..fe85658e6 100644
--- a/engine/battle/move_effects/transform.asm
+++ b/engine/battle/move_effects/transform.asm
@@ -1,5 +1,5 @@
-BattleCommand_Transform: ; 371cd
+BattleCommand_Transform:
; transform
call ClearLastMove
@@ -138,4 +138,3 @@ BattleCommand_Transform: ; 371cd
ld hl, TransformedText
jp StdBattleTextBox
-; 372c6
diff --git a/engine/battle/move_effects/triple_kick.asm b/engine/battle/move_effects/triple_kick.asm
index cef56a1ae..4fb939d7c 100644
--- a/engine/battle/move_effects/triple_kick.asm
+++ b/engine/battle/move_effects/triple_kick.asm
@@ -1,4 +1,4 @@
-BattleCommand_TripleKick: ; 346b2
+BattleCommand_TripleKick:
; triplekick
ld a, [wKickCounter]
@@ -26,14 +26,12 @@ BattleCommand_TripleKick: ; 346b2
ld [hl], a
ret
-; 346cd
-BattleCommand_KickCounter: ; 346cd
+BattleCommand_KickCounter:
; kickcounter
ld hl, wKickCounter
inc [hl]
ret
-; 346d2
diff --git a/engine/battle/read_trainer_attributes.asm b/engine/battle/read_trainer_attributes.asm
index 0b9507e0d..12554ebaf 100644
--- a/engine/battle/read_trainer_attributes.asm
+++ b/engine/battle/read_trainer_attributes.asm
@@ -1,4 +1,4 @@
-GetTrainerClassName: ; 3952d
+GetTrainerClassName:
ld hl, wRivalName
ld a, c
cp RIVAL1
@@ -19,7 +19,7 @@ GetTrainerClassName: ; 3952d
pop de
ret
-GetOTName: ; 39550
+GetOTName:
ld hl, wOTPlayerName
ld a, [wLinkMode]
and a
@@ -44,7 +44,7 @@ GetOTName: ; 39550
pop de
ret
-GetTrainerAttributes: ; 3957b
+GetTrainerAttributes:
ld a, [wTrainerClass]
ld c, a
call GetOTName
diff --git a/engine/battle/read_trainer_dvs.asm b/engine/battle/read_trainer_dvs.asm
index c021e8e8c..67ea0fe3c 100644
--- a/engine/battle/read_trainer_dvs.asm
+++ b/engine/battle/read_trainer_dvs.asm
@@ -1,4 +1,4 @@
-GetTrainerDVs: ; 270c4
+GetTrainerDVs:
; Return the DVs of wOtherTrainerClass in bc
push hl
@@ -17,4 +17,3 @@ GetTrainerDVs: ; 270c4
pop hl
ret
-; 270d6
diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm
index 3227236c1..3b1fe3bca 100644
--- a/engine/battle/read_trainer_party.asm
+++ b/engine/battle/read_trainer_party.asm
@@ -1,4 +1,4 @@
-ReadTrainerParty: ; 39771
+ReadTrainerParty:
ld a, [wInBattleTowerBattle]
bit 0, a
ret nz
@@ -79,17 +79,15 @@ ReadTrainerParty: ; 39771
call TrainerType2
call CloseSRAM
jr .done
-; 397e3
-TrainerTypes: ; 397e3
+TrainerTypes:
; entries correspond to TRAINERTYPE_* constants
dw TrainerType1 ; level, species
dw TrainerType2 ; level, species, moves
dw TrainerType3 ; level, species, item
dw TrainerType4 ; level, species, item, moves
-; 397eb
-TrainerType1: ; 397eb
+TrainerType1:
; normal (level, species)
ld h, d
ld l, e
@@ -107,9 +105,8 @@ TrainerType1: ; 397eb
predef TryAddMonToParty
pop hl
jr .loop
-; 39806
-TrainerType2: ; 39806
+TrainerType2:
; moves
ld h, d
ld l, e
@@ -184,9 +181,8 @@ TrainerType2: ; 39806
pop hl
jr .loop
-; 39871
-TrainerType3: ; 39871
+TrainerType3:
; item
ld h, d
ld l, e
@@ -213,9 +209,8 @@ TrainerType3: ; 39871
ld a, [hli]
ld [de], a
jr .loop
-; 3989d (e:589d)
-TrainerType4: ; 3989d
+TrainerType4:
; item + moves
ld h, d
ld l, e
@@ -305,9 +300,8 @@ TrainerType4: ; 3989d
pop hl
jr .loop
-; 3991b
-ComputeTrainerReward: ; 3991b (e:591b)
+ComputeTrainerReward:
ld hl, hProduct
xor a
ld [hli], a
@@ -328,7 +322,7 @@ ComputeTrainerReward: ; 3991b (e:591b)
ret
-Battle_GetTrainerName:: ; 39939
+Battle_GetTrainerName::
ld a, [wInBattleTowerBattle]
bit 0, a
ld hl, wOTPlayerName
@@ -339,7 +333,7 @@ Battle_GetTrainerName:: ; 39939
ld a, [wOtherTrainerClass]
ld c, a
-GetTrainerName:: ; 3994c
+GetTrainerName::
ld a, c
cp CAL
jr nz, .not_cal2
@@ -379,20 +373,18 @@ GetTrainerName:: ; 3994c
jr nz, .skip
jr .loop
-CopyTrainerName: ; 39984
+CopyTrainerName:
ld de, wStringBuffer1
push de
ld bc, NAME_LENGTH
call CopyBytes
pop de
ret
-; 39990
-Function39990: ; 39990
+Function39990:
; This function is useless.
ld de, wStringBuffer1
push de
ld bc, NAME_LENGTH
pop de
ret
-; 39999
diff --git a/engine/battle/returntobattle_useball.asm b/engine/battle/returntobattle_useball.asm
index 952239f94..0aff780c9 100644
--- a/engine/battle/returntobattle_useball.asm
+++ b/engine/battle/returntobattle_useball.asm
@@ -1,4 +1,4 @@
-_ReturnToBattle_UseBall: ; 2715c
+_ReturnToBattle_UseBall:
call ClearBGPalettes
call ClearTileMap
ld a, [wBattleType]
diff --git a/engine/battle/sliding_intro.asm b/engine/battle/sliding_intro.asm
index 667f18191..6b866c6d8 100644
--- a/engine/battle/sliding_intro.asm
+++ b/engine/battle/sliding_intro.asm
@@ -1,4 +1,4 @@
-BattleIntroSlidingPics: ; 4e980
+BattleIntroSlidingPics:
ld a, [rSVBK]
push af
ld a, BANK(wLYOverrides)
@@ -12,9 +12,8 @@ BattleIntroSlidingPics: ; 4e980
pop af
ld [rSVBK], a
ret
-; 4e998
-.subfunction1 ; 4e998
+.subfunction1
call .subfunction4
ld a, $90
ld [hSCX], a
@@ -23,9 +22,8 @@ BattleIntroSlidingPics: ; 4e980
lb de, %11100100, %11100100
call DmgToCgbObjPals
ret
-; 4e9ab
-.subfunction2 ; 4e9ab
+.subfunction2
ld d, $90
ld e, $72
ld a, $48
@@ -57,9 +55,8 @@ BattleIntroSlidingPics: ; 4e980
dec a
jr nz, .loop1
ret
-; 4e9d6
-.subfunction3 ; 4e9d6
+.subfunction3
ld hl, wVirtualOAMSprite00XCoord
ld c, $12 ; 18
ld de, SPRITEOAMSTRUCT_LENGTH
@@ -70,17 +67,15 @@ BattleIntroSlidingPics: ; 4e980
dec c
jr nz, .loop3
ret
-; 4e9e5
-.subfunction4 ; 4e9e5
+.subfunction4
ld hl, wLYOverrides
ld a, $90
ld bc, SCREEN_HEIGHT_PX
call ByteFill
ret
-; 4e9f1
-.subfunction5 ; 4e9f1
+.subfunction5
ld hl, wLYOverrides
ld a, d
ld c, $3e ; 62
@@ -101,4 +96,3 @@ BattleIntroSlidingPics: ; 4e980
dec c
jr nz, .loop6
ret
-; 4ea0a
diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm
index 84cd1e858..5c2a633a8 100644
--- a/engine/battle/start_battle.asm
+++ b/engine/battle/start_battle.asm
@@ -1,4 +1,4 @@
-ShowLinkBattleParticipants: ; 2ee18
+ShowLinkBattleParticipants:
; If we're not in a communications room,
; we don't need to be here.
ld a, [wLinkMode]
@@ -12,7 +12,7 @@ ShowLinkBattleParticipants: ; 2ee18
call ClearSprites
ret
-FindFirstAliveMonAndStartBattle: ; 2ee2f
+FindFirstAliveMonAndStartBattle:
xor a
ld [hMapAnims], a
call DelayFrame
@@ -46,7 +46,7 @@ FindFirstAliveMonAndStartBattle: ; 2ee2f
ld [hMapAnims], a
ret
-PlayBattleMusic: ; 2ee6c
+PlayBattleMusic:
push hl
push de
push bc
@@ -148,7 +148,7 @@ PlayBattleMusic: ; 2ee6c
pop hl
ret
-ClearBattleRAM: ; 2ef18
+ClearBattleRAM:
xor a
ld [wBattlePlayerAction], a
ld [wBattleResult], a
diff --git a/engine/battle/trainer_huds.asm b/engine/battle/trainer_huds.asm
index 0a18098ed..3930549b2 100644
--- a/engine/battle/trainer_huds.asm
+++ b/engine/battle/trainer_huds.asm
@@ -1,4 +1,4 @@
-BattleStart_TrainerHuds: ; 2c000
+BattleStart_TrainerHuds:
ld a, $e4
ld [rOBP0], a
call LoadBallIconGFX
@@ -7,16 +7,14 @@ BattleStart_TrainerHuds: ; 2c000
dec a
ret z
jp ShowOTTrainerMonsRemaining
-; 2c012
-EnemySwitch_TrainerHud: ; 2c012
+EnemySwitch_TrainerHud:
ld a, $e4
ld [rOBP0], a
call LoadBallIconGFX
jp ShowOTTrainerMonsRemaining
-; 2c01c
-ShowPlayerMonsRemaining: ; 2c01c
+ShowPlayerMonsRemaining:
call DrawPlayerPartyIconHUDBorder
ld hl, wPartyMon1HP
ld de, wPartyCount
@@ -30,9 +28,8 @@ ShowPlayerMonsRemaining: ; 2c01c
ld [wPlaceBallsDirection], a
ld hl, wVirtualOAMSprite00
jp LoadTrainerHudOAM
-; 2c03a
-ShowOTTrainerMonsRemaining: ; 2c03a
+ShowOTTrainerMonsRemaining:
call DrawEnemyHUDBorder
ld hl, wOTPartyMon1HP
ld de, wOTPartyCount
@@ -46,9 +43,8 @@ ShowOTTrainerMonsRemaining: ; 2c03a
ld [wPlaceBallsDirection], a
ld hl, wVirtualOAMSprite00 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH
jp LoadTrainerHudOAM
-; 2c059
-StageBallTilesData: ; 2c059
+StageBallTilesData:
ld a, [de]
push af
ld de, wBuffer1
@@ -69,9 +65,8 @@ StageBallTilesData: ; 2c059
dec a
jr nz, .loop2
ret
-; 2c075
-.GetHUDTile: ; 2c075
+.GetHUDTile:
ld a, [hli]
and a
jr nz, .got_hp
@@ -102,9 +97,8 @@ StageBallTilesData: ; 2c059
ld bc, PARTYMON_STRUCT_LENGTH + MON_HP - MON_STATUS
add hl, bc
ret
-; 2c095
-DrawPlayerHUDBorder: ; 2c095
+DrawPlayerHUDBorder:
ld hl, .tiles
ld de, wTrainerHUDTiles
ld bc, 4
@@ -118,9 +112,8 @@ DrawPlayerHUDBorder: ; 2c095
db $77 ; bottom right
db $6f ; bottom left
db $76 ; bottom side
-; 2c0ad
-DrawPlayerPartyIconHUDBorder: ; 2c0ad
+DrawPlayerPartyIconHUDBorder:
ld hl, .tiles
ld de, wTrainerHUDTiles
ld bc, 4
@@ -134,9 +127,8 @@ DrawPlayerPartyIconHUDBorder: ; 2c0ad
db $5c ; bottom right
db $6f ; bottom left
db $76 ; bottom side
-; 2c0c5
-DrawEnemyHUDBorder: ; 2c0c5
+DrawEnemyHUDBorder:
ld hl, .tiles
ld de, wTrainerHUDTiles
ld bc, 4
@@ -160,9 +152,8 @@ DrawEnemyHUDBorder: ; 2c0c5
db $74 ; bottom left
db $78 ; bottom right
db $76 ; bottom side
-; 2c0f1
-PlaceHUDBorderTiles: ; 2c0f1
+PlaceHUDBorderTiles:
ld a, [wTrainerHUDTiles]
ld [hl], a
ld bc, SCREEN_WIDTH
@@ -180,9 +171,8 @@ PlaceHUDBorderTiles: ; 2c0f1
ld a, [wEndFlypoint]
ld [hl], a
ret
-; 2c10d
-LinkBattle_TrainerHuds: ; 2c10d
+LinkBattle_TrainerHuds:
call LoadBallIconGFX
ld hl, wPartyMon1HP
ld de, wPartyCount
@@ -205,9 +195,8 @@ LinkBattle_TrainerHuds: ; 2c10d
ld [hl], 13 * 8
ld hl, wVirtualOAMSprite00 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH
jp LoadTrainerHudOAM
-; 2c143
-LoadTrainerHudOAM: ; 2c143
+LoadTrainerHudOAM:
ld de, wBuffer1
ld c, PARTY_LENGTH
.loop
@@ -228,21 +217,18 @@ LoadTrainerHudOAM: ; 2c143
dec c
jr nz, .loop
ret
-; 2c165
-LoadBallIconGFX: ; 2c165
+LoadBallIconGFX:
ld de, .gfx
ld hl, vTiles0 tile $31
lb bc, BANK(LoadBallIconGFX), 4
call Get2bpp_2
ret
-; 2c172
-.gfx ; 2c172
+.gfx
INCBIN "gfx/battle/balls.2bpp"
-; 2c1b2
-_ShowLinkBattleParticipants: ; 2c1b2
+_ShowLinkBattleParticipants:
call ClearBGPalettes
call LoadFontsExtra
hlcoord 2, 3
@@ -266,4 +252,3 @@ _ShowLinkBattleParticipants: ; 2c1b2
ld a, $e4
ld [rOBP0], a
ret
-; 2c1ef
diff --git a/engine/battle/unreferenced_getgen1trainerclassname.asm b/engine/battle/unreferenced_getgen1trainerclassname.asm
index da8e98b61..045325234 100644
--- a/engine/battle/unreferenced_getgen1trainerclassname.asm
+++ b/engine/battle/unreferenced_getgen1trainerclassname.asm
@@ -1,4 +1,4 @@
-Unreferenced_GetGen1TrainerClassName: ; 50a28
+Unreferenced_GetGen1TrainerClassName:
ld hl, Gen1TrainerClassNames
ld a, [wTrainerClass]
dec a
diff --git a/engine/battle/used_move_text.asm b/engine/battle/used_move_text.asm
index f2182f378..2bb6b7845 100644
--- a/engine/battle/used_move_text.asm
+++ b/engine/battle/used_move_text.asm
@@ -1,11 +1,10 @@
-DisplayUsedMoveText: ; 105db0
+DisplayUsedMoveText:
; battle command 03
ld hl, UsedMoveText
call BattleTextBox
jp WaitBGMap
-; 105db9
-UsedMoveText: ; 105db9
+UsedMoveText:
; this is a stream of text and asm from 105db9 to 105ef6
text_jump _ActorNameText
start_asm
@@ -58,18 +57,16 @@ UsedMoveText: ; 105db9
ret c
ld hl, UsedMove1Text
ret
-; 105e04
-UsedMove1Text: ; 105e04
+UsedMove1Text:
text_jump _UsedMove1Text
start_asm
jr UsedMoveText_CheckObedience
-; 105e0b
-UsedMove2Text: ; 105e0b
+UsedMove2Text:
text_jump _UsedMove2Text
start_asm
-UsedMoveText_CheckObedience: ; 105e10
+UsedMoveText_CheckObedience:
; check obedience
ld a, [wAlreadyDisobeyed]
and a
@@ -77,7 +74,6 @@ UsedMoveText_CheckObedience: ; 105e10
; print "instead,"
ld hl, .UsedInsteadText
ret
-; 105e1a
.UsedInsteadText:
text_jump _UsedInsteadText
@@ -85,9 +81,8 @@ UsedMoveText_CheckObedience: ; 105e10
.GetMoveNameText:
ld hl, MoveNameText
ret
-; 105e23
-MoveNameText: ; 105e23
+MoveNameText:
text_jump _MoveNameText
start_asm
; get start address
@@ -111,40 +106,33 @@ MoveNameText: ; 105e23
ld h, [hl]
ld l, a
ret
-; 105e39
-.endusedmovetexts ; 105e39
+.endusedmovetexts
; entries correspond to MoveGrammar sets
dw EndUsedMove1Text
dw EndUsedMove2Text
dw EndUsedMove3Text
dw EndUsedMove4Text
dw EndUsedMove5Text
-; 105e43
-EndUsedMove1Text: ; 105e43
+EndUsedMove1Text:
text_jump _EndUsedMove1Text
db "@"
-; 105e48
-EndUsedMove2Text: ; 105e48
+EndUsedMove2Text:
text_jump _EndUsedMove2Text
db "@"
-; 105e4d
-EndUsedMove3Text: ; 105e4d
+EndUsedMove3Text:
text_jump _EndUsedMove3Text
db "@"
-; 105e52
-EndUsedMove4Text: ; 105e52
+EndUsedMove4Text:
text_jump _EndUsedMove4Text
db "@"
-; 105e57
-EndUsedMove5Text: ; 105e57
+EndUsedMove5Text:
text_jump _EndUsedMove5Text
db "@"
-; 105e5c
-GetMoveGrammar: ; 105e5c
+GetMoveGrammar:
; store move grammar type in wd265
push bc
@@ -178,12 +166,11 @@ GetMoveGrammar: ; 105e5c
; we're done
pop bc
ret
-; 105e7a
INCLUDE "data/moves/grammar.asm"
-UpdateUsedMoves: ; 105ed0
+UpdateUsedMoves:
; append move a to wPlayerUsedMoves unless it has already been used
push bc
@@ -237,4 +224,3 @@ UpdateUsedMoves: ; 105ed0
; list updated
pop bc
ret
-; 105ef6