summaryrefslogtreecommitdiff
path: root/battle
diff options
context:
space:
mode:
authorPikalaxALT <PikalaxALT@gmail.com>2015-11-10 16:53:37 -0500
committerPikalaxALT <PikalaxALT@gmail.com>2015-11-10 16:53:37 -0500
commitd13fb46d405eb1cbc78c4f7c8823cfce5cfdbfab (patch)
treecc41006e4160aac7de10704bff7eaea30dc81591 /battle
parentba05bfeafec51b183986ecaacd22c718ec21f56a (diff)
enum macros/move_anim.asm, resolve battle/anims.asm function labels
Diffstat (limited to 'battle')
-rw-r--r--battle/ai/scoring.asm2
-rw-r--r--battle/anim_commands.asm232
-rw-r--r--battle/anim_objects.asm16
-rw-r--r--battle/anims.asm37
-rw-r--r--battle/bg_effects.asm88
-rw-r--r--battle/core.asm217
-rw-r--r--battle/effect_commands.asm17
-rw-r--r--battle/misc.asm10
8 files changed, 318 insertions, 301 deletions
diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm
index 7dd204978..5445671ac 100644
--- a/battle/ai/scoring.asm
+++ b/battle/ai/scoring.asm
@@ -2859,7 +2859,7 @@ endr
AI_Smart_Stomp: ; 39200
; 80% chance to encourage this move if the player has used Minimize.
- ld a, [wc6fe]
+ ld a, [wPlayerMinimized]
and a
ret z
diff --git a/battle/anim_commands.asm b/battle/anim_commands.asm
index 839449d19..7372899f5 100644
--- a/battle/anim_commands.asm
+++ b/battle/anim_commands.asm
@@ -353,54 +353,54 @@ endr
BattleAnimCommands:: ; cc2a4 (33:42a4)
- dw BattleAnimCmd_D0
- dw BattleAnimCmd_D1
- dw BattleAnimCmd_D2
- dw BattleAnimCmd_D3
- dw BattleAnimCmd_D4
- dw BattleAnimCmd_D5
- dw BattleAnimCmd_D6
- dw BattleAnimCmd_D7
- dw BattleAnimCmd_D8
- dw BattleAnimCmd_D9
- dw BattleAnimCmd_DA
- dw BattleAnimCmd_DB
- dw BattleAnimCmd_DC
- dw BattleAnimCmd_DD
- dw BattleAnimCmd_DE
- dw BattleAnimCmd_DF
- dw BattleAnimCmd_E0
- dw BattleAnimCmd_E1
- dw BattleAnimCmd_E2
- dw BattleAnimCmd_E3
- dw BattleAnimCmd_E4
- dw BattleAnimCmd_E5
- dw BattleAnimCmd_E6
+ dw BattleAnimCmd_Obj
+ dw BattleAnimCmd_1GFX
+ dw BattleAnimCmd_2GFX
+ dw BattleAnimCmd_3GFX
+ dw BattleAnimCmd_4GFX
+ dw BattleAnimCmd_5GFX
+ dw BattleAnimCmd_IncObj
+ dw BattleAnimCmd_SetObj
+ dw BattleAnimCmd_IncBGEffect
+ dw BattleAnimCmd_EnemyFeetObj
+ dw BattleAnimCmd_PlayerHeadObj
+ dw BattleAnimCmd_CheckPokeball
+ dw BattleAnimCmd_Transform
+ dw BattleAnimCmd_RaiseSub
+ dw BattleAnimCmd_DropSub
+ dw BattleAnimCmd_ResetObp0
+ dw BattleAnimCmd_Sound
+ dw BattleAnimCmd_Cry
+ dw BattleAnimCmd_MinimizeOpp
+ dw BattleAnimCmd_OAMOn
+ dw BattleAnimCmd_OAMOff
+ dw BattleAnimCmd_ClearObjs
+ dw BattleAnimCmd_BeatUp
dw BattleAnimCmd_E7
- dw BattleAnimCmd_E8
- dw BattleAnimCmd_E9
- dw BattleAnimCmd_EA
- dw BattleAnimCmd_EB
- dw BattleAnimCmd_EC
- dw BattleAnimCmd_ED
- dw BattleAnimCmd_EE
- dw BattleAnimCmd_EF
- dw BattleAnimCmd_F0
- dw BattleAnimCmd_F1
- dw BattleAnimCmd_F2
- dw BattleAnimCmd_F3
- dw BattleAnimCmd_F4
+ dw BattleAnimCmd_UpdateActorPic
+ dw BattleAnimCmd_Minimize
+ dw BattleAnimCmd_EA ; dummy
+ dw BattleAnimCmd_EB ; dummy
+ dw BattleAnimCmd_EC ; dummy
+ dw BattleAnimCmd_ED ; dummy
+ dw BattleAnimCmd_JumpAnd
+ dw BattleAnimCmd_JumpUntil
+ dw BattleAnimCmd_BGEffect
+ dw BattleAnimCmd_BGP
+ dw BattleAnimCmd_OBP0
+ dw BattleAnimCmd_OBP1
+ dw BattleAnimCmd_ClearSprites
dw BattleAnimCmd_F5
dw BattleAnimCmd_F6
dw BattleAnimCmd_F7
- dw BattleAnimCmd_F8
- dw BattleAnimCmd_F9
- dw BattleAnimCmd_FA
- dw BattleAnimCmd_FB
- dw BattleAnimCmd_FC
- dw BattleAnimCmd_FD
- dw BattleAnimCmd_FE
- dw BattleAnimCmd_FF
+ dw BattleAnimCmd_JumpIf
+ dw BattleAnimCmd_SetVar
+ dw BattleAnimCmd_IncVar
+ dw BattleAnimCmd_JumpVar
+ dw BattleAnimCmd_Jump
+ dw BattleAnimCmd_Loop
+ dw BattleAnimCmd_Call
+ dw BattleAnimCmd_Ret
BattleAnimCmd_EA:
@@ -409,7 +409,7 @@ BattleAnimCmd_EC:
BattleAnimCmd_ED: ; cc304 (33:4304)
ret
-BattleAnimCmd_FF: ; cc305 (33:4305)
+BattleAnimCmd_Ret: ; cc305 (33:4305)
ld hl, BattleAnimFlags
res 1, [hl]
ld hl, BattleAnimParent
@@ -422,7 +422,7 @@ BattleAnimCmd_FF: ; cc305 (33:4305)
ld [hl], d
ret
-BattleAnimCmd_FE: ; cc317 (33:4317)
+BattleAnimCmd_Call: ; cc317 (33:4317)
call GetBattleAnimByte
ld e, a
call GetBattleAnimByte
@@ -445,7 +445,7 @@ BattleAnimCmd_FE: ; cc317 (33:4317)
set 1, [hl]
ret
-BattleAnimCmd_FC: ; cc339 (33:4339)
+BattleAnimCmd_Jump: ; cc339 (33:4339)
call GetBattleAnimByte
ld e, a
call GetBattleAnimByte
@@ -456,7 +456,7 @@ BattleAnimCmd_FC: ; cc339 (33:4339)
ld [hl], d
ret
-BattleAnimCmd_FD: ; cc348 (33:4348)
+BattleAnimCmd_Loop: ; cc348 (33:4348)
call GetBattleAnimByte
ld hl, BattleAnimFlags
bit 2, [hl]
@@ -497,7 +497,7 @@ endr
ld [hl], e
ret
-BattleAnimCmd_EF: ; cc383 (33:4383)
+BattleAnimCmd_JumpUntil: ; cc383 (33:4383)
ld hl, wKickCounter
ld a, [hl]
and a
@@ -527,17 +527,17 @@ endr
ld [hl], e
ret
-BattleAnimCmd_F9: ; cc3a6 (33:43a6)
+BattleAnimCmd_SetVar: ; cc3a6 (33:43a6)
call GetBattleAnimByte
ld [BattleAnimVar], a
ret
-BattleAnimCmd_FA: ; cc3ad (33:43ad)
+BattleAnimCmd_IncVar: ; cc3ad (33:43ad)
ld hl, BattleAnimVar
inc [hl]
ret
-BattleAnimCmd_FB: ; cc3b2 (33:43b2)
+BattleAnimCmd_JumpVar: ; cc3b2 (33:43b2)
call GetBattleAnimByte
ld hl, BattleAnimVar
cp [hl]
@@ -566,7 +566,7 @@ endr
ld [hl], d
ret
-BattleAnimCmd_F8: ; cc3d6 (33:43d6)
+BattleAnimCmd_JumpIf: ; cc3d6 (33:43d6)
call GetBattleAnimByte
ld hl, wKickCounter
cp [hl]
@@ -595,7 +595,7 @@ endr
ld [hl], d
ret
-BattleAnimCmd_EE: ; cc3fa (33:43fa)
+BattleAnimCmd_JumpAnd: ; cc3fa (33:43fa)
call GetBattleAnimByte
ld e, a
ld a, [wKickCounter]
@@ -624,7 +624,7 @@ endr
ld [hl], d
ret
-BattleAnimCmd_D0: ; cc41f (33:441f)
+BattleAnimCmd_Obj: ; cc41f (33:441f)
call GetBattleAnimByte
ld [BattleAnimTemps], a
call GetBattleAnimByte
@@ -636,7 +636,7 @@ BattleAnimCmd_D0: ; cc41f (33:441f)
call Functioncc9a1
ret
-BattleAnimCmd_F0: ; cc43b (33:443b)
+BattleAnimCmd_BGEffect: ; cc43b (33:443b)
call GetBattleAnimByte
ld [BattleAnimTemps], a
call GetBattleAnimByte
@@ -648,23 +648,23 @@ BattleAnimCmd_F0: ; cc43b (33:443b)
call Functionccb4f
ret
-BattleAnimCmd_F1: ; cc457 (33:4457)
+BattleAnimCmd_BGP: ; cc457 (33:4457)
call GetBattleAnimByte
ld [wcfc7], a
ret
-BattleAnimCmd_F2: ; cc45e (33:445e)
+BattleAnimCmd_OBP0: ; cc45e (33:445e)
call GetBattleAnimByte
ld [wcfc8], a
ret
-BattleAnimCmd_F3: ; cc465 (33:4465)
+BattleAnimCmd_OBP1: ; cc465 (33:4465)
call GetBattleAnimByte
ld [wcfc9], a
ret
-BattleAnimCmd_DF: ; cc46c (33:446c)
- ld a, [hSGB] ; $ff00+$e7
+BattleAnimCmd_ResetObp0: ; cc46c (33:446c)
+ ld a, [hSGB]
and a
ld a, $e0
jr z, .asm_cc475
@@ -673,7 +673,7 @@ BattleAnimCmd_DF: ; cc46c (33:446c)
ld [wcfc8], a
ret
-BattleAnimCmd_E5: ; cc479 (33:4479)
+BattleAnimCmd_ClearObjs: ; cc479 (33:4479)
ld hl, OTPartyMon3HP
ld a, $a0
.asm_cc47e
@@ -683,11 +683,11 @@ BattleAnimCmd_E5: ; cc479 (33:4479)
jr nz, .asm_cc47e
ret
-BattleAnimCmd_D1:
-BattleAnimCmd_D2:
-BattleAnimCmd_D3:
-BattleAnimCmd_D4:
-BattleAnimCmd_D5: ; cc485 (33:4485)
+BattleAnimCmd_1GFX:
+BattleAnimCmd_2GFX:
+BattleAnimCmd_3GFX:
+BattleAnimCmd_4GFX:
+BattleAnimCmd_5GFX: ; cc485 (33:4485)
ld a, [BattleAnimByte]
and $f
ld c, a
@@ -722,7 +722,7 @@ endr
jr nz, .asm_cc492
ret
-BattleAnimCmd_D6: ; cc4c0 (33:44c0)
+BattleAnimCmd_IncObj: ; cc4c0 (33:44c0)
call GetBattleAnimByte
ld e, $a
ld bc, OTPartyMon3HP
@@ -746,7 +746,7 @@ BattleAnimCmd_D6: ; cc4c0 (33:44c0)
inc [hl]
ret
-BattleAnimCmd_D8: ; cc4e3 (33:44e3)
+BattleAnimCmd_IncBGEffect: ; cc4e3 (33:44e3)
call GetBattleAnimByte
ld e, $5
ld bc, ActiveBGEffects
@@ -770,7 +770,7 @@ BattleAnimCmd_D8: ; cc4e3 (33:44e3)
inc [hl]
ret
-BattleAnimCmd_D7: ; cc506 (33:4506)
+BattleAnimCmd_SetObj: ; cc506 (33:4506)
call GetBattleAnimByte
ld e, $a
ld bc, OTPartyMon3HP
@@ -795,7 +795,7 @@ BattleAnimCmd_D7: ; cc506 (33:4506)
ld [hl], a
ret
-BattleAnimCmd_D9: ; cc52c (33:452c)
+BattleAnimCmd_EnemyFeetObj: ; cc52c (33:452c)
ld hl, w5_d300
.asm_cc52f
@@ -851,7 +851,7 @@ Functioncc561: ; cc561 (33:4561)
jr nz, Functioncc561
ret
-BattleAnimCmd_DA: ; cc57e (33:457e)
+BattleAnimCmd_PlayerHeadObj: ; cc57e (33:457e)
ld hl, w5_d300
.asm_cc581
@@ -907,7 +907,7 @@ Functioncc5b3: ; cc5b3 (33:45b3)
jr nz, Functioncc5b3
ret
-BattleAnimCmd_DB: ; cc5d0 (33:45d0)
+BattleAnimCmd_CheckPokeball: ; cc5d0 (33:45d0)
callab GetPokeBallWobble
ld a, c
ld [BattleAnimVar], a
@@ -916,15 +916,15 @@ BattleAnimCmd_DB: ; cc5d0 (33:45d0)
BattleAnimCmd_E7: ; cc5db (33:45db)
ret
-BattleAnimCmd_DC: ; cc5dc (33:45dc)
- ld a, [rSVBK] ; $ff00+$70
+BattleAnimCmd_Transform: ; cc5dc (33:45dc)
+ ld a, [rSVBK]
push af
ld a, 1
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
ld a, [CurPartySpecies] ; CurPartySpecies
push af
- ld a, [hBattleTurn] ; $ff00+$e4
+ ld a, [hBattleTurn]
and a
jr z, .player
@@ -948,13 +948,13 @@ BattleAnimCmd_DC: ; cc5dc (33:45dc)
pop af
ld [CurPartySpecies], a ; CurPartySpecies
pop af
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
ret
-BattleAnimCmd_E8: ; cc622 (33:4622)
+BattleAnimCmd_UpdateActorPic: ; cc622 (33:4622)
ld de, VTiles0 tile $00
- ld a, [hBattleTurn] ; $ff00+$e4
+ ld a, [hBattleTurn]
and a
jr z, .player
@@ -971,12 +971,12 @@ BattleAnimCmd_E8: ; cc622 (33:4622)
call Request2bpp
ret
-BattleAnimCmd_DD: ; cc640 (33:4640)
+BattleAnimCmd_RaiseSub: ; cc640 (33:4640)
- ld a, [rSVBK] ; $ff00+$70
+ ld a, [rSVBK]
push af
ld a, 1
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
xor a
call GetSRAMBank
@@ -992,7 +992,7 @@ GetSubstitutePic: ; cc64c
or b
jr nz, .loop
- ld a, [hBattleTurn] ; $ff00+$e4
+ ld a, [hBattleTurn]
and a
jr z, .player
@@ -1037,7 +1037,7 @@ GetSubstitutePic: ; cc64c
.done
call CloseSRAM
pop af
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
ret
CopyMonsterSpriteTile: ; cc6c6 (33:46c6)
@@ -1046,18 +1046,18 @@ CopyMonsterSpriteTile: ; cc6c6 (33:46c6)
call FarCopyBytes
ret
-BattleAnimCmd_E2: ; cc6cf (33:46cf)
- ld a, [rSVBK] ; $ff00+$70
+BattleAnimCmd_MinimizeOpp: ; cc6cf (33:46cf)
+ ld a, [rSVBK]
push af
ld a, $1
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
xor a
call GetSRAMBank
call GetMinimizePic
call Request2bpp
call CloseSRAM
pop af
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
ret
GetMinimizePic: ; cc6e7 (33:46e7)
@@ -1071,7 +1071,7 @@ GetMinimizePic: ; cc6e7 (33:46e7)
or b
jr nz, .loop
- ld a, [hBattleTurn] ; $ff00+$e4
+ ld a, [hBattleTurn]
and a
jr z, .player
@@ -1102,11 +1102,11 @@ MinimizePic: ; cc725
INCBIN "gfx/battle/minimize.2bpp"
; cc735
-BattleAnimCmd_E9: ; cc735 (33:4735)
- ld a, [rSVBK] ; $ff00+$70
+BattleAnimCmd_Minimize: ; cc735 (33:4735)
+ ld a, [rSVBK]
push af
ld a, $1
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
xor a
call GetSRAMBank
call GetMinimizePic
@@ -1114,18 +1114,18 @@ BattleAnimCmd_E9: ; cc735 (33:4735)
call Request2bpp
call CloseSRAM
pop af
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
ret
-BattleAnimCmd_DE: ; cc750 (33:4750)
- ld a, [rSVBK] ; $ff00+$70
+BattleAnimCmd_DropSub: ; cc750 (33:4750)
+ ld a, [rSVBK]
push af
ld a, $1
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
ld a, [CurPartySpecies] ; CurPartySpecies
push af
- ld a, [hBattleTurn] ; $ff00+$e4
+ ld a, [hBattleTurn]
and a
jr z, .player
@@ -1139,21 +1139,21 @@ BattleAnimCmd_DE: ; cc750 (33:4750)
pop af
ld [CurPartySpecies], a ; CurPartySpecies
pop af
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
ret
-BattleAnimCmd_E6: ; cc776 (33:4776)
- ld a, [rSVBK] ; $ff00+$70
+BattleAnimCmd_BeatUp: ; cc776 (33:4776)
+ ld a, [rSVBK]
push af
ld a, $1
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
ld a, [CurPartySpecies] ; CurPartySpecies
push af
ld a, [wKickCounter]
ld [CurPartySpecies], a ; CurPartySpecies
- ld a, [hBattleTurn] ; $ff00+$e4
+ ld a, [hBattleTurn]
and a
jr z, .player
@@ -1175,20 +1175,20 @@ BattleAnimCmd_E6: ; cc776 (33:4776)
ld b, $1
call GetSGBLayout
pop af
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
ret
-BattleAnimCmd_E3: ; cc7bb (33:47bb)
+BattleAnimCmd_OAMOn: ; cc7bb (33:47bb)
xor a
- ld [hOAMUpdate], a ; $ff00+$d8
+ ld [hOAMUpdate], a
ret
-BattleAnimCmd_E4: ; cc7bf (33:47bf)
+BattleAnimCmd_OAMOff: ; cc7bf (33:47bf)
ld a, $1
- ld [hOAMUpdate], a ; $ff00+$d8
+ ld [hOAMUpdate], a
ret
-BattleAnimCmd_F4: ; cc7c4 (33:47c4)
+BattleAnimCmd_ClearSprites: ; cc7c4 (33:47c4)
ld hl, BattleAnimFlags
set 3, [hl]
ret
@@ -1202,7 +1202,7 @@ BattleAnimCmd_F6: ; cc7cb (33:47cb)
BattleAnimCmd_F7: ; cc7cc (33:47cc)
ret
-BattleAnimCmd_E0: ; cc7cd (33:47cd)
+BattleAnimCmd_Sound: ; cc7cd (33:47cd)
call GetBattleAnimByte
ld e, a
srl a
@@ -1232,7 +1232,7 @@ Datacc7f8: ; cc7f8
; cc7fc
Functioncc7fc: ; cc7fc (33:47fc)
- ld a, [hBattleTurn] ; $ff00+$e4
+ ld a, [hBattleTurn]
and a
jr nz, .enemy
@@ -1244,7 +1244,7 @@ Functioncc7fc: ; cc7fc (33:47fc)
xor 1
ret
-BattleAnimCmd_E1: ; cc807 (33:4807)
+BattleAnimCmd_Cry: ; cc807 (33:4807)
call GetBattleAnimByte
and 3
ld e, a
@@ -1254,12 +1254,12 @@ rept 4
add hl, de
endr
- ld a, [rSVBK] ; $ff00+$70
+ ld a, [rSVBK]
push af
ld a, 1
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
- ld a, [hBattleTurn] ; $ff00+$e4
+ ld a, [hBattleTurn]
and a
jr nz, .enemy
@@ -1316,7 +1316,7 @@ endr
.done
pop af
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
ret
; cc871 (33:4871)
diff --git a/battle/anim_objects.asm b/battle/anim_objects.asm
index 943b550b3..3fc6e7c7d 100644
--- a/battle/anim_objects.asm
+++ b/battle/anim_objects.asm
@@ -946,14 +946,14 @@ endr
Functioncd249: ; cd249 (33:5249)
ld hl, Unknown_cd26c
- ld a, [rSVBK] ; $ff00+$70
+ ld a, [rSVBK]
push af
ld a, $1
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
ld a, [CurItem] ; CurItem
ld e, a
pop af
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
.asm_cd25a
ld a, [hli]
cp $ff
@@ -1694,7 +1694,7 @@ Jumptable_cd66d: ; cd66d (33:566d)
Functioncd677: ; cd677 (33:5677)
call Functionce72c
ld a, $42
- ld [hLCDStatCustom], a ; $ff00+$c6
+ ld [hLCDStatCustom], a
ld a, $58
ld [hLCDStatCustom + 1], a
ld a, $5e
@@ -1753,7 +1753,7 @@ Functioncd6c6: ; cd6c6 (33:56c6)
cp $70
jr c, asm_cd6da
xor a
- ld [hLCDStatCustom], a ; $ff00+$c6
+ ld [hLCDStatCustom], a
ld [hLCDStatCustom + 1], a
ld [hLCDStatCustom + 2], a
@@ -2839,7 +2839,7 @@ Jumptable_cdcc6: ; cdcc6 (33:5cc6)
Functioncdcca: ; cdcca (33:5cca)
- ld a, [hBattleTurn] ; $ff00+$e4
+ ld a, [hBattleTurn]
and a
jr z, .asm_cdcd9
ld hl, $b
@@ -3842,7 +3842,7 @@ Jumptable_ce258: ; ce258 (33:6258)
Functionce260: ; ce260 (33:6260)
call Functionce72c
- ld a, [hBattleTurn] ; $ff00+$e4
+ ld a, [hBattleTurn]
and a
jr nz, .asm_ce26c
ld a, $f0
@@ -3893,7 +3893,7 @@ Functionce29f: ; ce29f (33:629f)
srl a
ld e, a
ld d, $0
- ld a, [hSGB] ; $ff00+$e7
+ ld a, [hSGB]
and a
jr nz, .asm_ce2b6
ld hl, Unknown_ce2c4
diff --git a/battle/anims.asm b/battle/anims.asm
index 51b3448b2..d18cfff43 100644
--- a/battle/anims.asm
+++ b/battle/anims.asm
@@ -303,10 +303,11 @@ BattleAnim_SweetScent2: ; c929c
; c92c1
BattleAnim_ThrowPokeBall: ; c92c1
- anim_jumpif $0, BattleAnim_ThrowPokeBall_branch_c92f2
- anim_jumpif $1, BattleAnim_ThrowPokeBall_branch_c9347
- anim_jumpif $2, BattleAnim_ThrowPokeBall_branch_c9305
- anim_jumpif $4, BattleAnim_ThrowPokeBall_branch_c9326
+ anim_jumpif NO_ITEM, .TheTrainerBlockedTheBall
+ anim_jumpif MASTER_BALL, .MasterBall
+ anim_jumpif ULTRA_BALL, .UltraBall
+ anim_jumpif GREAT_BALL, .GreatBall
+ ; any other ball
anim_2gfx ANIM_GFX_POKE_BALL, ANIM_GFX_SMOKE
anim_sound $1a, SFX_THROW_BALL
anim_obj $15, 68, 92, $40
@@ -317,10 +318,10 @@ BattleAnim_ThrowPokeBall: ; c92c1
anim_sound $1, SFX_BALL_POOF
anim_obj $1c, 136, 64, $10
anim_wait 16
- anim_jump BattleAnim_ThrowPokeBall_branch_c9392
+ anim_jump .Shake
; c92f2
-BattleAnim_ThrowPokeBall_branch_c92f2: ; c92f2
+.TheTrainerBlockedTheBall: ; c92f2
anim_2gfx ANIM_GFX_POKE_BALL, ANIM_GFX_HIT
anim_sound $1a, SFX_THROW_BALL
anim_obj $16, 64, 92, $20
@@ -330,7 +331,7 @@ BattleAnim_ThrowPokeBall_branch_c92f2: ; c92f2
anim_ret
; c9305
-BattleAnim_ThrowPokeBall_branch_c9305: ; c9305
+.UltraBall: ; c9305
anim_2gfx ANIM_GFX_POKE_BALL, ANIM_GFX_SMOKE
anim_sound $1a, SFX_THROW_BALL
anim_obj $15, 68, 92, $40
@@ -341,10 +342,10 @@ BattleAnim_ThrowPokeBall_branch_c9305: ; c9305
anim_sound $1, SFX_BALL_POOF
anim_obj $1c, 136, 64, $10
anim_wait 16
- anim_jump BattleAnim_ThrowPokeBall_branch_c9392
+ anim_jump .Shake
; c9326
-BattleAnim_ThrowPokeBall_branch_c9326: ; c9326
+.GreatBall: ; c9326
anim_2gfx ANIM_GFX_POKE_BALL, ANIM_GFX_SMOKE
anim_sound $1a, SFX_THROW_BALL
anim_obj $15, 68, 92, $40
@@ -355,10 +356,10 @@ BattleAnim_ThrowPokeBall_branch_c9326: ; c9326
anim_sound $1, SFX_BALL_POOF
anim_obj $1c, 136, 64, $10
anim_wait 16
- anim_jump BattleAnim_ThrowPokeBall_branch_c9392
+ anim_jump .Shake
; c9347
-BattleAnim_ThrowPokeBall_branch_c9347: ; c9347
+.MasterBall: ; c9347
anim_3gfx ANIM_GFX_POKE_BALL, ANIM_GFX_SMOKE, ANIM_GFX_SPEED
anim_sound $1a, SFX_THROW_BALL
anim_obj $15, 64, 92, $20
@@ -379,7 +380,7 @@ BattleAnim_ThrowPokeBall_branch_c9347: ; c9347
anim_obj $2b, 136, 56, $36
anim_obj $2b, 136, 56, $37
anim_wait 64
-BattleAnim_ThrowPokeBall_branch_c9392: ; c9392
+.Shake: ; c9392
anim_bgeffect ANIM_BG_RETURN_MON, $0, $0, $0
anim_wait 8
anim_incobj $2
@@ -393,22 +394,22 @@ BattleAnim_ThrowPokeBall_branch_c9392: ; c9392
anim_wait 32
anim_wait 8
anim_setvar $0
-BattleAnim_ThrowPokeBall_branch_c93aa: ; c93aa
+.Loop: ; c93aa
anim_wait 48
anim_checkpokeball
- anim_jumpvar $1, BattleAnim_ThrowPokeBall_branch_c93bc
- anim_jumpvar $2, BattleAnim_ThrowPokeBall_branch_c93be
+ anim_jumpvar $1, .Click
+ anim_jumpvar $2, .BreakFree
anim_incobj $1
anim_sound $1, SFX_BALL_WIGGLE
- anim_jump BattleAnim_ThrowPokeBall_branch_c93aa
+ anim_jump .Loop
; c93bc
-BattleAnim_ThrowPokeBall_branch_c93bc: ; c93bc
+.Click: ; c93bc
anim_clearsprites
anim_ret
; c93be
-BattleAnim_ThrowPokeBall_branch_c93be: ; c93be
+.BreakFree: ; c93be
anim_setobj $1, $b
anim_sound $1, SFX_BALL_POOF
anim_obj $1c, 136, 64, $10
diff --git a/battle/bg_effects.asm b/battle/bg_effects.asm
index f7245ce3b..96e51db2f 100644
--- a/battle/bg_effects.asm
+++ b/battle/bg_effects.asm
@@ -343,14 +343,14 @@ Functionc81c0: ; c81c0 (32:41c0)
call ClearBox
pop bc
xor a
- ld [hBGMapThird], a ; $ff00+$d5
+ ld [hBGMapThird], a
ld a, $1
- ld [hBGMapMode], a ; $ff00+$d4
+ ld [hBGMapMode], a
ret
Functionc81e3: ; c81e3 (32:41e3)
xor a
- ld [hBGMapMode], a ; $ff00+$d4
+ ld [hBGMapMode], a
call EndBattleBGEffect
ret
@@ -441,13 +441,13 @@ Functionc825a: ; c825a (32:425a)
.asm_c8271
call ClearBox
ld a, $1
- ld [hBGMapMode], a ; $ff00+$d4
+ ld [hBGMapMode], a
pop bc
ret
Functionc827a: ; c827a (32:427a)
xor a
- ld [hBGMapMode], a ; $ff00+$d4
+ ld [hBGMapMode], a
call EndBattleBGEffect
ret
@@ -507,13 +507,13 @@ Functionc82c7: ; c82c7 (32:42c7)
.asm_c82de
call ClearBox
ld a, $1
- ld [hBGMapMode], a ; $ff00+$d4
+ ld [hBGMapMode], a
pop bc
ret
Functionc82e7: ; c82e7 (32:42e7)
xor a
- ld [hBGMapMode], a ; $ff00+$d4
+ ld [hBGMapMode], a
call EndBattleBGEffect
ret
@@ -595,9 +595,9 @@ Functionc831d: ; c831d (32:431d)
jr nz, .asm_c8344
.asm_c8355
xor a
- ld [hBGMapThird], a ; $ff00+$d5
+ ld [hBGMapThird], a
ld a, $1
- ld [hBGMapMode], a ; $ff00+$d4
+ ld [hBGMapMode], a
call Functionc80e5
ld hl, $3
add hl, bc
@@ -606,7 +606,7 @@ Functionc831d: ; c831d (32:431d)
Functionc8365: ; c8365 (32:4365)
xor a
- ld [hBGMapMode], a ; $ff00+$d4
+ ld [hBGMapMode], a
ld hl, $3
add hl, bc
ld a, [hl]
@@ -723,7 +723,7 @@ endr
.asm_c841d
call Functionc80e5
ld a, $1
- ld [hBGMapMode], a ; $ff00+$d4
+ ld [hBGMapMode], a
ret
.asm_c8425
call Functionc843b
@@ -731,7 +731,7 @@ endr
Functionc842a: ; c842a (32:442a)
xor a
- ld [hBGMapMode], a ; $ff00+$d4
+ ld [hBGMapMode], a
ld hl, $1
add hl, bc
ld [hl], $0
@@ -739,7 +739,7 @@ Functionc842a: ; c842a (32:442a)
Functionc8434: ; c8434 (32:4434)
xor a
- ld [hBGMapMode], a ; $ff00+$d4
+ ld [hBGMapMode], a
call EndBattleBGEffect
ret
@@ -902,7 +902,7 @@ Functionc854e: ; c854e (32:454e)
call Functionc8f69
Functionc8557: ; c8557 (32:4557)
- ld a, [hLCDStatCustom] ; $ff00+$c6
+ ld a, [hLCDStatCustom]
and a
ret z
push bc
@@ -967,7 +967,7 @@ Functionc85a2: ; c85a2 (32:45a2)
call Functionc80e5
call Functionc8eca
ld a, $42
- ld [hLCDStatCustom], a ; $ff00+$c6
+ ld [hLCDStatCustom], a
xor a
ld [hLCDStatCustom + 1], a
ld a, $5e
@@ -1042,7 +1042,7 @@ Functionc8610: ; c8610 (32:4610)
call Functionc80e5
call Functionc8eca
ld a, $43
- ld [hLCDStatCustom], a ; $ff00+$c6
+ ld [hLCDStatCustom], a
xor a
ld [hLCDStatCustom + 1], a
ld a, $5f
@@ -1530,7 +1530,7 @@ Functionc88a5: ; c88a5 (32:48a5)
sub d
ld d, a
ld h, LYOverridesBackup / $100
- ld a, [hSCY] ; $ff00+$d0
+ ld a, [hSCY]
or a
jr nz, .asm_c88d0
ld a, [hLCDStatCustom + 1]
@@ -1546,7 +1546,7 @@ Functionc88a5: ; c88a5 (32:48a5)
ld l, a
ld [hl], $0
.asm_c88d6
- ld a, [hSCY] ; $ff00+$d0
+ ld a, [hSCY]
ld l, a
ld a, [hLCDStatCustom + 1]
sub l
@@ -1953,7 +1953,7 @@ Functionc8ae5: ; c8ae5 (32:4ae5)
ret
Functionc8b00: ; c8b00 (32:4b00)
- ld a, [hCGB] ; $ff00+$e6
+ ld a, [hCGB]
and a
jr nz, asm_c8b7a
call Functionc80d7 ; ; ; call does not return
@@ -1969,7 +1969,7 @@ Functionc8b0e: ; c8b0e (32:4b0e)
ld a, $e4
call Functionc8ecb
ld a, $47
- ld [hLCDStatCustom], a ; $ff00+$c6
+ ld [hLCDStatCustom], a
xor a
ld [hLCDStatCustom + 1], a
ld a, $60
@@ -2266,7 +2266,7 @@ Functionc8cab: ; c8cab (32:4cab)
call Functionc80e5
call Functionc8eca
ld a, $43
- ld [hLCDStatCustom], a ; $ff00+$c6
+ ld [hLCDStatCustom], a
xor a
ld [hLCDStatCustom + 1], a
ld a, $37
@@ -2307,7 +2307,7 @@ Functionc8ce1: ; c8ce1 (32:4ce1)
push af
call DelayFrame
pop af
- ld [hSCY], a ; $ff00+$d0
+ ld [hSCY], a
xor $ff
inc a
ld [OTPartyMon3SpclAtk], a
@@ -2318,7 +2318,7 @@ Functionc8cf9: ; c8cf9 (32:4cf9)
jr nc, .asm_c8cff
xor a
.asm_c8cff
- ld [hSCX], a ; $ff00+$cf
+ ld [hSCX], a
ret
Functionc8d02: ; c8d02 (32:4d02)
@@ -2326,7 +2326,7 @@ Functionc8d02: ; c8d02 (32:4d02)
jr nc, .asm_c8d08
xor a
.asm_c8d08
- ld [hSCY], a ; $ff00+$d0
+ ld [hSCY], a
ret
Functionc8d0b: ; c8d0b (32:4d0b)
@@ -2373,7 +2373,7 @@ Functionc8d3a: ; c8d3a (32:4d3a)
jr nc, .asm_c8d53
ld d, $6
call Functionc905d
- ld [hSCX], a ; $ff00+$cf
+ ld [hSCX], a
ld hl, $3
add hl, bc
ld a, [hl]
@@ -2382,7 +2382,7 @@ Functionc8d3a: ; c8d3a (32:4d3a)
ret
.asm_c8d53
xor a
- ld [hSCX], a ; $ff00+$cf
+ ld [hSCX], a
ret
Functionc8d57: ; c8d57 (32:4d57)
@@ -2410,7 +2410,7 @@ Functionc8d57: ; c8d57 (32:4d57)
ret
Functionc8d77: ; c8d77 (32:4d77)
- ld a, [hCGB] ; $ff00+$e6
+ ld a, [hCGB]
and a
jr nz, asm_c8dd4
push de
@@ -2469,7 +2469,7 @@ Functionc8daa: ; c8daa (32:4daa)
Functionc8dc9: ; c8dc9 (32:4dc9)
call Functionc8f19
ld a, $e4
- ld [rBGP], a ; $ff00+$47
+ ld [rBGP], a
call EndBattleBGEffect
ret
asm_c8dd4: ; c8dd4 (32:4dd4)
@@ -2563,10 +2563,10 @@ Functionc8e49: ; c8e49 (32:4e49)
Functionc8e52: ; c8e52 (32:4e52)
ld h, a
- ld a, [rSVBK] ; $ff00+$70
+ ld a, [rSVBK]
push af
ld a, $5
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
ld a, h
push bc
push af
@@ -2583,17 +2583,17 @@ Functionc8e52: ; c8e52 (32:4e52)
call CopyPals
pop bc
pop af
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
ld a, $1
- ld [hCGBPalUpdate], a ; $ff00+$e5
+ ld [hCGBPalUpdate], a
ret
Functionc8e7f: ; c8e7f (32:4e7f)
ld h, a
- ld a, [rSVBK] ; $ff00+$70
+ ld a, [rSVBK]
push af
ld a, $5
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
ld a, h
push bc
push af
@@ -2610,9 +2610,9 @@ Functionc8e7f: ; c8e7f (32:4e7f)
call CopyPals
pop bc
pop af
- ld [rSVBK], a ; $ff00+$70
+ ld [rSVBK], a
ld a, $1
- ld [hCGBPalUpdate], a ; $ff00+$e5
+ ld [hCGBPalUpdate], a
ret
Functionc8eac: ; c8eac (32:4eac)
@@ -2660,7 +2660,7 @@ Functionc8ecb: ; c8ecb (32:4ecb)
ret
Functionc8ede: ; c8ede (32:4ede)
- ld [hLCDStatCustom], a ; $ff00+$c6
+ ld [hLCDStatCustom], a
call Functionc9038
jr nz, .asm_c8eea
ld de, $36
@@ -2675,7 +2675,7 @@ Functionc8ede: ; c8ede (32:4ede)
ret
Functionc8ef4: ; c8ef4 (32:4ef4)
- ld [hLCDStatCustom], a ; $ff00+$c6
+ ld [hLCDStatCustom], a
call Functionc9038
jr nz, .asm_c8f00
ld de, $36
@@ -2695,15 +2695,15 @@ Functionc8f0a: ; c8f0a (32:4f0a)
ld [hLCDStatCustom + 2], a
call Functionc8eca
xor a
- ld [hLCDStatCustom], a ; $ff00+$c6
+ ld [hLCDStatCustom], a
call EndBattleBGEffect
ret
Functionc8f19: ; c8f19 (32:4f19)
xor a
- ld [hLCDStatCustom], a ; $ff00+$c6
+ ld [hLCDStatCustom], a
ld a, $e4
- ld [rBGP], a ; $ff00+$47
+ ld [rBGP], a
ld [wcfc7], a
ld [wcfc9], a
ld [hLCDStatCustom + 1], a
@@ -2902,7 +2902,7 @@ Functionc901b: ; c901b (32:501b)
Functionc9038: ; c9038 (32:5038)
ld hl, $2
add hl, bc
- ld a, [hBattleTurn] ; $ff00+$e4
+ ld a, [hBattleTurn]
and $1
xor [hl]
ret
@@ -2910,7 +2910,7 @@ Functionc9038: ; c9038 (32:5038)
Functionc9042: ; c9042 (32:5042)
ld hl, $2
add hl, bc
- ld a, [hBattleTurn] ; $ff00+$e4
+ ld a, [hBattleTurn]
and $1
xor [hl]
jr nz, .asm_c9053
@@ -2923,7 +2923,7 @@ Functionc9042: ; c9042 (32:5042)
ret
Functionc9059: ; c9059 (32:5059)
- ld a, [hSGB] ; $ff00+$e7
+ ld a, [hSGB]
and a
ret
diff --git a/battle/core.asm b/battle/core.asm
index f57940db6..39d7d1102 100644
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -174,8 +174,8 @@ Function3c12f: ; 3c12f
ld [wPlayerIsSwitching], a
ld [wEnemyIsSwitching], a
ld [wd264], a
- ld [wc73f], a
- ld [wc740], a
+ ld [wPlayerJustGotFrozen], a
+ ld [wEnemyJustGotFrozen], a
ld [CurDamage], a
ld [CurDamage + 1], a
@@ -1604,19 +1604,21 @@ HandleFutureSight: ; 3ca26
HanleDefrost: ; 3ca8f
ld a, [hLinkPlayerNumber]
cp $1
- jr z, .asm_3ca9a
- call .asm_3ca9d
- jr .asm_3cac9
+ jr z, .enemy_first
+ call .do_player_turn
+ jr .do_enemy_turn
-.asm_3ca9a
- call .asm_3cac9
-.asm_3ca9d
+.enemy_first
+ call .do_enemy_turn
+.do_player_turn
ld a, [BattleMonStatus]
bit FRZ, a
ret z
- ld a, [wc73f]
+
+ ld a, [wPlayerJustGotFrozen]
and a
ret nz
+
call BattleRandom
cp 10 percent
ret nc
@@ -1631,11 +1633,11 @@ HanleDefrost: ; 3ca8f
ld hl, DefrostedOpponentText
jp StdBattleTextBox
-.asm_3cac9
+.do_enemy_turn
ld a, [EnemyMonStatus]
bit FRZ, a
ret z
- ld a, [wc740]
+ ld a, [wEnemyJustGotFrozen]
and a
ret nz
call BattleRandom
@@ -3654,9 +3656,9 @@ LoadEnemyPkmnToSwitchTo: ; 3d6ca
ld hl, EnemyMonHP
ld a, [hli]
- ld [wc6ea], a
+ ld [wEnemyHPAtTimeOfPlayerSwitch], a
ld a, [hl]
- ld [wc6eb], a
+ ld [wEnemyHPAtTimeOfPlayerSwitch + 1], a
ret
; 3d714
@@ -3814,7 +3816,7 @@ endr
ld [EnemyProtectCount], a
ld [wEnemyRageCounter], a
ld [EnemyDisabledMove], a
- ld [wc6fa], a
+ ld [wEnemyMinimized], a
ld [wPlayerWrapCount], a
ld [wEnemyWrapCount], a
ld [EnemyTurnsTaken], a
@@ -4317,7 +4319,7 @@ endr
ld [PlayerProtectCount], a
ld [wPlayerRageCounter], a
ld [DisabledMove], a
- ld [wc6fe], a
+ ld [wPlayerMinimized], a
ld [wEnemyWrapCount], a
ld [wPlayerWrapCount], a
ld [PlayerTurnsTaken], a
@@ -5166,9 +5168,9 @@ BattleMenu: ; 3e139
; Auto input: choose "ITEM"
ld a, [InputType]
or a
- jr z, .asm_3e171
+ jr z, .skip_dude_pack_select
callba _DudeAutoInput_DownA
-.asm_3e171
+.skip_dude_pack_select
call LoadBattleMenu2
ret c
@@ -5242,26 +5244,26 @@ BattleMenu_Pack: ; 3e1c7
callba BattlePack
ld a, [wd0ec]
and a
- jr z, .asm_3e20d
- jr .asm_3e209
+ jr z, .didnt_use_item
+ jr .got_item
.tutorial
callba Function107bb
ld a, POKE_BALL
ld [CurItem], a
call DoItemEffect
- jr .asm_3e209
+ jr .got_item
.contest
ld a, PARK_BALL
ld [CurItem], a
call DoItemEffect
-.asm_3e209
+.got_item
call Function3e234
ret
-.asm_3e20d
+.didnt_use_item
call ClearPalettes
call DelayFrame
call Function3ed9f
@@ -7862,7 +7864,7 @@ Function3f136: ; 3f136
ld e, a
push de
ld de, TempMonExp + 2
- call Function3f39c
+ call CalcExpBar
push bc
ld hl, TempMonExp + 2
ld a, [wd004]
@@ -7950,7 +7952,7 @@ endr
push bc
ld b, d
ld de, TempMonExp + 2
- call Function3f39c
+ call CalcExpBar
ld a, b
pop bc
ld c, a
@@ -7986,7 +7988,7 @@ Function3f22c: ; 3f22c
push bc
push de
hlcoord 17, 11
- call Function3f41c
+ call PlaceExpBar
pop de
ld a, $1
ld [hBGMapMode], a
@@ -8002,7 +8004,7 @@ Function3f22c: ; 3f22c
push bc
push de
hlcoord 17, 11
- call Function3f41c
+ call PlaceExpBar
pop de
ld a, $1
ld [hBGMapMode], a
@@ -8030,32 +8032,33 @@ Function3f22c: ; 3f22c
SendOutPkmnText: ; 3f26d
ld a, [wLinkMode]
and a
- jr z, .asm_3f27c
+ jr z, .not_linked
ld hl, JumpText_GoPkmn ; If we're in a LinkBattle print just "Go <PlayerMon>"
- ld a, [wd264] ; besides this variable is set. which stands for ???
+ ld a, [wd264] ; unless this (unidentified) variable is set
and a
- jr nz, .asm_3f2ce
+ jr nz, .skip_to_textbox
-.asm_3f27c
+.not_linked
; Depending on the HP of the enemy Pkmn, the game prints a different text
ld hl, EnemyMonHP
ld a, [hli]
or [hl]
ld hl, JumpText_GoPkmn
- jr z, .asm_3f2ce
+ jr z, .skip_to_textbox
+ ; compute enemy helth remaining as a percentage
xor a
ld [hMultiplicand + 0], a
ld hl, EnemyMonHP
ld a, [hli]
- ld [wc6ea], a
+ ld [wEnemyHPAtTimeOfPlayerSwitch], a
ld [hMultiplicand + 1], a
ld a, [hl]
- ld [wc6eb], a
+ ld [wEnemyHPAtTimeOfPlayerSwitch + 1], a
ld [hMultiplicand + 2], a
- ld a, $19
+ ld a, 25
ld [hMultiplier], a
call Multiply
ld hl, EnemyMonMaxHP
@@ -8066,22 +8069,25 @@ SendOutPkmnText: ; 3f26d
srl a
rr b
ld a, b
- ld b, $4
+ ld b, 4
ld [hDivisor], a
call Divide
+
ld a, [hQuotient + 2]
ld hl, JumpText_GoPkmn
- cp $46
- jr nc, .asm_3f2ce
+ cp 70
+ jr nc, .skip_to_textbox
+
ld hl, JumpText_DoItPkmn
- cp $28
- jr nc, .asm_3f2ce
+ cp 40
+ jr nc, .skip_to_textbox
+
ld hl, JumpText_GoForItPkmn
- cp $a
- jr nc, .asm_3f2ce
- ld hl, JumpText_YourFoesWeakGetmPkmn
+ cp 10
+ jr nc, .skip_to_textbox
-.asm_3f2ce
+ ld hl, JumpText_YourFoesWeakGetmPkmn
+.skip_to_textbox
jp BattleTextBox
; 3f2d1
@@ -8130,13 +8136,13 @@ TextJump_BattleMonNickComma: ; 3f2fa
start_asm
; 3f2ff
-Function3f2ff: ; 3f2ff
+WithdrawPkmnText: ; 3f2ff
; Print text to withdraw Pkmn
; depending on HP the message is different
push de
push bc
ld hl, EnemyMonHP + 1
- ld de, wc6eb
+ ld de, wEnemyHPAtTimeOfPlayerSwitch + 1
ld b, [hl]
dec hl
ld a, [de]
@@ -8147,7 +8153,7 @@ Function3f2ff: ; 3f2ff
ld a, [de]
sbc b
ld [hMultiplicand + 1], a
- ld a, $19
+ ld a, 25
ld [hMultiplier], a
call Multiply
ld hl, EnemyMonMaxHP
@@ -8158,7 +8164,7 @@ Function3f2ff: ; 3f2ff
srl a
rr b
ld a, b
- ld b, $4
+ ld b, 4
ld [hDivisor], a
call Divide
pop bc
@@ -8169,11 +8175,11 @@ Function3f2ff: ; 3f2ff
ret z
ld hl, TextJump_ComeBack
- cp $1e
+ cp 30
ret c
ld hl, TextJump_OKComeBack
- cp $46
+ cp 70
ret c
ld hl, TextJump_GoodComeBack
@@ -8207,23 +8213,23 @@ TextJump_ComeBack: ; 3f35b
; 3f360
-Function3f360: ; 3f360
- ld hl, wc6f0
+HandleSafariAngerEatingStatus: ; unreferenced
+ ld hl, wSafariMonEating
ld a, [hl]
and a
- jr z, .asm_3f36d
+ jr z, .angry
dec [hl]
ld hl, BattleText_WildPkmnIsEating
- jr .asm_3f388
+ jr .finish
-.asm_3f36d
- dec hl
+.angry
+ dec hl ; wSafariMonAngerCount
ld a, [hl]
and a
ret z
dec [hl]
ld hl, BattleText_WildPkmnIsAngry
- jr nz, .asm_3f388
+ jr nz, .finish
push hl
ld a, [EnemyMonSpecies]
ld [CurSpecies], a
@@ -8232,7 +8238,7 @@ Function3f360: ; 3f360
ld [EnemyMonCatchRate], a
pop hl
-.asm_3f388
+.finish
push hl
call Call_LoadTempTileMapToTileMap
pop hl
@@ -8242,19 +8248,22 @@ Function3f360: ; 3f360
FillInExpBar: ; 3f390
push hl
- call Function3f39c
+ call CalcExpBar
pop hl
- ld de, $0007
+ ld de, 7
add hl, de
- jp Function3f41c
+ jp PlaceExpBar
; 3f39c
-Function3f39c: ; 3f39c
+CalcExpBar: ; 3f39c
+; Calculate the percent exp between this level and the next
+; Level in b
push de
ld d, b
push de
callab CalcExpAtLevel
pop de
+; exp at current level gets pushed to the stack
ld hl, hMultiplicand
ld a, [hli]
push af
@@ -8262,16 +8271,18 @@ Function3f39c: ; 3f39c
push af
ld a, [hl]
push af
+; next level
inc d
callab CalcExpAtLevel
- ld hl, hProduct + 3
+; back up the next level exp, and subtract the two levels
+ ld hl, hMultiplicand + 2
ld a, [hl]
- ld [hPrintNum8], a
+ ld [hMathBuffer + 2], a
pop bc
sub b
ld [hld], a
ld a, [hl]
- ld [hPrintNum7], a
+ ld [hMathBuffer + 1], a
pop bc
sbc b
ld [hld], a
@@ -8281,21 +8292,24 @@ Function3f39c: ; 3f39c
sbc b
ld [hl], a
pop de
- ld hl, hProduct + 2
+
+ ld hl, hMultiplicand + 1
ld a, [hli]
push af
ld a, [hl]
push af
+
+; get the amount of exp remaining to the next level
ld a, [de]
dec de
ld c, a
- ld a, [hPrintNum8]
+ ld a, [hMathBuffer + 2]
sub c
ld [hld], a
ld a, [de]
dec de
ld b, a
- ld a, [hPrintNum7]
+ ld a, [hMathBuffer + 1]
sbc b
ld [hld], a
ld a, [de]
@@ -8305,6 +8319,7 @@ Function3f39c: ; 3f39c
ld [hld], a
xor a
ld [hl], a
+; multiply by 64
ld a, $40
ld [hMultiplier], a
call Multiply
@@ -8312,10 +8327,10 @@ Function3f39c: ; 3f39c
ld c, a
pop af
ld b, a
-.asm_3f3f4
+.loop
ld a, b
and a
- jr z, .asm_3f40c
+ jr z, .done
srl b
rr c
ld hl, hProduct
@@ -8326,12 +8341,12 @@ Function3f39c: ; 3f39c
rr [hl]
inc hl
rr [hl]
- jr .asm_3f3f4
+ jr .loop
-.asm_3f40c
+.done
ld a, c
ld [hDivisor], a
- ld b, $4
+ ld b, 4
call Divide
ld a, [hQuotient + 2]
ld b, a
@@ -8341,49 +8356,49 @@ Function3f39c: ; 3f39c
ret
; 3f41c
-Function3f41c: ; 3f41c
- ld c, $8
-.asm_3f41e
+PlaceExpBar: ; 3f41c
+ ld c, $8 ; number of tiles
+.loop1
ld a, b
sub $8
- jr c, .asm_3f42c
+ jr c, .next
ld b, a
- ld a, $6a
+ ld a, $6a ; full bar
ld [hld], a
dec c
- jr z, .asm_3f43c
- jr .asm_3f41e
+ jr z, .finish
+ jr .loop1
-.asm_3f42c
+.next
add $8
- jr z, .asm_3f434
- add $54
- jr .asm_3f436
+ jr z, .loop2
+ add $54 ; tile to the left of small exp bar tile
+ jr .skip
-.asm_3f434
- ld a, $62
+.loop2
+ ld a, $62 ; empty bar
-.asm_3f436
+.skip
ld [hld], a
- ld a, $62
+ ld a, $62 ; empty bar
dec c
- jr nz, .asm_3f434
+ jr nz, .loop2
-.asm_3f43c
+.finish
ret
; 3f43d
GetMonBackpic: ; 3f43d
ld a, [PlayerSubStatus4]
bit SUBSTATUS_SUBSTITUTE, a
- ld hl, BattleAnimCmd_DD
- jr nz, Function3f46f ; substitute
+ ld hl, BattleAnimCmd_RaiseSub
+ jr nz, GetBackpic_DoAnim ; substitute
Function3f447: ; 3f447
- ld a, [wc6fe]
+ ld a, [wPlayerMinimized]
and a
- ld hl, BattleAnimCmd_E2
- jr nz, Function3f46f
+ ld hl, BattleAnimCmd_MinimizeOpp
+ jr nz, GetBackpic_DoAnim
ld a, [CurPartySpecies]
push af
ld a, [BattleMonSpecies]
@@ -8397,7 +8412,7 @@ Function3f447: ; 3f447
ret
; 3f46f
-Function3f46f: ; 3f46f
+GetBackpic_DoAnim: ; 3f46f
ld a, [hBattleTurn]
push af
xor a
@@ -8412,14 +8427,14 @@ Function3f46f: ; 3f46f
GetMonFrontpic: ; 3f47c
ld a, [EnemySubStatus4]
bit SUBSTATUS_SUBSTITUTE, a
- ld hl, BattleAnimCmd_DD
- jr nz, Function3f4b4
+ ld hl, BattleAnimCmd_RaiseSub
+ jr nz, GetFrontpic_DoAnim
Function3f486: ; 3f486
- ld a, [wc6fa]
+ ld a, [wEnemyMinimized]
and a
- ld hl, BattleAnimCmd_E2
- jr nz, Function3f4b4
+ ld hl, BattleAnimCmd_MinimizeOpp
+ jr nz, GetFrontpic_DoAnim
ld a, [CurPartySpecies]
push af
@@ -8436,7 +8451,7 @@ Function3f486: ; 3f486
ret
; 3f4b4
-Function3f4b4: ; 3f4b4
+GetFrontpic_DoAnim: ; 3f4b4
ld a, [hBattleTurn]
push af
call SetEnemyTurn
diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm
index 871518331..ed1fb85a1 100644
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -5361,13 +5361,14 @@ BattleCommand_FreezeTarget: ; 36102
callba UseHeldStatusHealingItem
ret nz
+
call OpponentCantMove
call EndRechargeOpp
- ld hl, wc740
+ ld hl, wEnemyJustGotFrozen
ld a, [hBattleTurn]
and a
jr z, .finish
- ld hl, wc73f
+ ld hl, wPlayerJustGotFrozen
.finish
ld [hl], $1
ret
@@ -5582,12 +5583,12 @@ CheckIfStatCanBeRaised: ; 361ef
StatUpAnimation: ; 36281
- ld bc, wc6fe
+ ld bc, wPlayerMinimized
ld hl, Function3f447
ld a, [hBattleTurn]
and a
jr z, .do_player ; 0x3628a $6
- ld bc, wc6fa
+ ld bc, wEnemyMinimized
ld hl, Function3f486
.do_player
ld a, BATTLE_VARS_MOVE_ANIM
@@ -8338,9 +8339,9 @@ endr
jr c, .mimic_anims
ld a, [hBattleTurn]
and a
- ld a, [wc6fe]
+ ld a, [wPlayerMinimized]
jr z, .got_byte
- ld a, [wc6fa]
+ ld a, [wEnemyMinimized]
.got_byte
and a
jr nz, .mimic_anims
@@ -9528,11 +9529,11 @@ BattleCommand_MirrorCoat: ; 37c95
BattleCommand_DoubleMinimizeDamage: ; 37ce6
; doubleminimizedamage
- ld hl, wc6fa
+ ld hl, wEnemyMinimized
ld a, [hBattleTurn]
and a
jr z, .ok
- ld hl, wc6fe
+ ld hl, wPlayerMinimized
.ok
ld a, [hl]
and a
diff --git a/battle/misc.asm b/battle/misc.asm
index 429e4aae6..d47573df9 100644
--- a/battle/misc.asm
+++ b/battle/misc.asm
@@ -1,7 +1,7 @@
_DisappearUser: ; fbd54
xor a
- ld [hBGMapMode], a ; $ff00+$d4
- ld a, [hBattleTurn] ; $ff00+$e4
+ ld [hBGMapMode], a
+ ld a, [hBattleTurn]
and a
jr z, .player
call GetEnemyFrontpicCoords
@@ -21,8 +21,8 @@ _AppearUserLowerSub: ; fbd71 (3e:7d71)
AppearUser: ; fbd77 (3e:7d77)
xor a
- ld [hBGMapMode], a ; $ff00+$d4
- ld a, [hBattleTurn] ; $ff00+$e4
+ ld [hBGMapMode], a
+ ld a, [hBattleTurn]
and a
jr z, .player
call GetEnemyFrontpicCoords
@@ -36,7 +36,7 @@ AppearUser: ; fbd77 (3e:7d77)
predef FillBox
FinishAppearDisappearUser: ; fbd91 (3e:7d91)
ld a, $1
- ld [hBGMapMode], a ; $ff00+$d4
+ ld [hBGMapMode], a
ret
GetEnemyFrontpicCoords: ; fbd96 (3e:7d96)