ref: 8c265476455c4793d263c7f2e6386904fbd3e305
parent: a613ed915c32d3befec54a98dae98e21649e19ce
author: pikalaxalt <PikalaxALT@gmail.com>
date: Thu May 5 11:07:37 EDT 2016
Mobile and more battle anims
--- a/battle/anim_commands.asm
+++ b/battle/anim_commands.asm
@@ -382,7 +382,7 @@
dw BattleAnimCmd_EB ; dummy
dw BattleAnimCmd_EC ; dummy
dw BattleAnimCmd_ED ; dummy
- dw BattleAnimCmd_JumpAnd
+ dw BattleAnimCmd_IfParamAnd
dw BattleAnimCmd_JumpUntil
dw BattleAnimCmd_BGEffect
dw BattleAnimCmd_BGP
@@ -392,10 +392,10 @@
dw BattleAnimCmd_F5
dw BattleAnimCmd_F6
dw BattleAnimCmd_F7
- dw BattleAnimCmd_JumpIf
+ dw BattleAnimCmd_IfParamEqual
dw BattleAnimCmd_SetVar
dw BattleAnimCmd_IncVar
- dw BattleAnimCmd_JumpVar
+ dw BattleAnimCmd_IfVarEqual
dw BattleAnimCmd_Jump
dw BattleAnimCmd_Loop
dw BattleAnimCmd_Call
@@ -535,7 +535,7 @@
inc [hl]
ret
-BattleAnimCmd_JumpVar: ; cc3b2 (33:43b2)
+BattleAnimCmd_IfVarEqual: ; cc3b2 (33:43b2)
call GetBattleAnimByte
ld hl, BattleAnimVar
cp [hl]
@@ -563,7 +563,7 @@
ld [hl], d
ret
-BattleAnimCmd_JumpIf: ; cc3d6 (33:43d6)
+BattleAnimCmd_IfParamEqual: ; cc3d6 (33:43d6)
call GetBattleAnimByte
ld hl, wBattleAnimParam
cp [hl]
@@ -591,7 +591,7 @@
ld [hl], d
ret
-BattleAnimCmd_JumpAnd: ; cc3fa (33:43fa)
+BattleAnimCmd_IfParamAnd: ; cc3fa (33:43fa)
call GetBattleAnimByte
ld e, a
ld a, [wBattleAnimParam]
@@ -608,6 +608,7 @@
dec hl
ld [hl], e
ret
+
.jump
call GetBattleAnimByte
ld e, a
--- a/battle/anims.asm
+++ b/battle/anims.asm
@@ -303,10 +303,10 @@
; c92c1
BattleAnim_ThrowPokeBall
- anim_jumpif NO_ITEM, .TheTrainerBlockedTheBall
- anim_jumpif MASTER_BALL, .MasterBall
- anim_jumpif ULTRA_BALL, .UltraBall
- anim_jumpif GREAT_BALL, .GreatBall
+ anim_if_param_equal NO_ITEM, .TheTrainerBlockedTheBall
+ anim_if_param_equal MASTER_BALL, .MasterBall
+ anim_if_param_equal ULTRA_BALL, .UltraBall
+ anim_if_param_equal GREAT_BALL, .GreatBall
; any other ball
anim_2gfx ANIM_GFX_POKE_BALL, ANIM_GFX_SMOKE
anim_sound 6, 2, SFX_THROW_BALL
@@ -316,7 +316,7 @@
anim_setobj $2, $7
anim_wait 16
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, -15, 0, 8, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -15, 0, 8, 0, $10
anim_wait 16
anim_jump .Shake
; c92f2
@@ -324,7 +324,7 @@
.TheTrainerBlockedTheBall:
anim_2gfx ANIM_GFX_POKE_BALL, ANIM_GFX_HIT
anim_sound 6, 2, SFX_THROW_BALL
- anim_obj ANIM_OBJ_16, 8, 0, 11, 4, $20
+ anim_obj ANIM_OBJ_POKE_BALL_BLOCKED, 8, 0, 11, 4, $20
anim_wait 20
anim_obj ANIM_OBJ_01, 14, 0, 5, 0, $0
anim_wait 32
@@ -340,7 +340,7 @@
anim_setobj $2, $7
anim_wait 16
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, -15, 0, 8, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -15, 0, 8, 0, $10
anim_wait 16
anim_jump .Shake
; c9326
@@ -354,7 +354,7 @@
anim_setobj $2, $7
anim_wait 16
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, -15, 0, 8, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -15, 0, 8, 0, $10
anim_wait 16
anim_jump .Shake
; c9347
@@ -368,17 +368,17 @@
anim_setobj $2, $7
anim_wait 16
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, -15, 0, 8, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -15, 0, 8, 0, $10
anim_wait 24
anim_sound 0, 1, SFX_MASTER_BALL
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $30
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $31
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $32
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $33
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $34
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $35
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $36
- anim_obj ANIM_OBJ_2B, -15, 0, 7, 0, $37
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $30
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $31
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $32
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $33
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $34
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $35
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $36
+ anim_obj ANIM_OBJ_MASTER_BALL_SPARKLE, -15, 0, 7, 0, $37
anim_wait 64
.Shake:
anim_bgeffect ANIM_BG_RETURN_MON, $0, $0, $0
@@ -397,8 +397,8 @@
.Loop:
anim_wait 48
anim_checkpokeball
- anim_jumpvar $1, .Click
- anim_jumpvar $2, .BreakFree
+ anim_if_var_equal $1, .Click
+ anim_if_var_equal $2, .BreakFree
anim_incobj 1
anim_sound 0, 1, SFX_BALL_WIGGLE
anim_jump .Loop
@@ -412,7 +412,7 @@
.BreakFree:
anim_setobj $1, $b
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, -15, 0, 8, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -15, 0, 8, 0, $10
anim_wait 2
anim_bgeffect ANIM_BG_ENTER_MON, $0, $0, $0
anim_wait 32
@@ -420,9 +420,9 @@
; c93d1
BattleAnim_SendOutMon: ; c93d1
- anim_jumpif $0, .Normal
- anim_jumpif $1, .Shiny
- anim_jumpif $2, .Unknown
+ anim_if_param_equal $0, .Normal
+ anim_if_param_equal $1, .Shiny
+ anim_if_param_equal $2, .Unknown
anim_1gfx ANIM_GFX_SMOKE
anim_call BattleAnim_FollowEnemyFeet_0
anim_bgeffect ANIM_BG_2B, $0, $1, $0
@@ -482,7 +482,7 @@
.Normal:
anim_1gfx ANIM_GFX_SMOKE
anim_sound 0, 0, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, 5, 4, 12, 0, $0
+ anim_obj ANIM_OBJ_BALL_POOF, 5, 4, 12, 0, $0
anim_wait 4
anim_bgeffect ANIM_BG_ENTER_MON, $0, $1, $0
anim_wait 32
@@ -543,13 +543,13 @@
BattleAnim_Sap: ; c94da
anim_1gfx ANIM_GFX_CHARGE
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, 16, 0, 6, 0, $2
+ anim_obj ANIM_OBJ_ABSORB, 16, 0, 6, 0, $2
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 8, 0, $3
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 8, 0, $3
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 4, 0, $4
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 4, 0, $4
anim_wait 16
anim_ret
; c94f8
@@ -711,7 +711,7 @@
BattleAnim_Doubleslap: ; c9605
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_Doubleslap_branch_c961b
+ anim_if_param_equal $1, BattleAnim_Doubleslap_branch_c961b
anim_sound 0, 1, SFX_DOUBLESLAP
anim_obj ANIM_OBJ_08, -14, 0, 6, 0, $0
anim_wait 6
@@ -731,7 +731,7 @@
BattleAnim_CometPunch: ; c962b
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_CometPunch_branch_c9641
+ anim_if_param_equal $1, BattleAnim_CometPunch_branch_c9641
anim_sound 0, 1, SFX_COMET_PUNCH
anim_obj ANIM_OBJ_06, -14, 0, 6, 0, $0
anim_wait 6
@@ -788,7 +788,7 @@
BattleAnim_DoubleKick: ; c96a7
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_DoubleKick_branch_c96bd
+ anim_if_param_equal $1, BattleAnim_DoubleKick_branch_c96bd
anim_sound 0, 1, SFX_DOUBLE_KICK
anim_obj ANIM_OBJ_07, -14, 0, 6, 0, $0
anim_wait 6
@@ -808,7 +808,7 @@
BattleAnim_JumpKick: ; c96cd
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_JumpKick_branch_c96f1
+ anim_if_param_equal $1, BattleAnim_JumpKick_branch_c96f1
anim_sound 0, 1, SFX_JUMP_KICK
anim_obj ANIM_OBJ_07, 14, 0, 9, 0, $0
anim_obj ANIM_OBJ_07, 12, 4, 7, 4, $0
@@ -832,7 +832,7 @@
BattleAnim_HiJumpKick: ; c96fc
anim_1gfx ANIM_GFX_HIT
anim_bgeffect ANIM_BG_1F, $40, $2, $0
- anim_jumpif $1, BattleAnim_HiJumpKick_branch_c971e
+ anim_if_param_equal $1, BattleAnim_HiJumpKick_branch_c971e
anim_wait 32
anim_sound 0, 1, SFX_JUMP_KICK
anim_obj ANIM_OBJ_07, 14, 0, 9, 0, $0
@@ -1041,13 +1041,13 @@
anim_1gfx ANIM_GFX_ICE
.loop
anim_sound 6, 2, SFX_SHINE
- anim_obj ANIM_OBJ_13, 8, 0, 11, 4, $4
+ anim_obj ANIM_OBJ_ICE_BEAM, 8, 0, 11, 4, $4
anim_wait 4
anim_loop 5, .loop
- anim_obj ANIM_OBJ_29, -15, 0, 9, 2, $10
+ anim_obj ANIM_OBJ_ICE_BUILDUP, -15, 0, 9, 2, $10
.loop2
anim_sound 6, 2, SFX_SHINE
- anim_obj ANIM_OBJ_13, 8, 0, 11, 4, $4
+ anim_obj ANIM_OBJ_ICE_BEAM, 8, 0, 11, 4, $4
anim_wait 4
anim_loop 15, .loop2
anim_wait 48
@@ -1062,18 +1062,18 @@
anim_1gfx ANIM_GFX_ICE
.loop
anim_sound 6, 2, SFX_SHINE
- anim_obj ANIM_OBJ_11, 8, 0, 11, 0, $63
+ anim_obj ANIM_OBJ_BLIZZARD, 8, 0, 11, 0, $63
anim_wait 2
anim_sound 6, 2, SFX_SHINE
- anim_obj ANIM_OBJ_11, 8, 0, 10, 0, $64
+ anim_obj ANIM_OBJ_BLIZZARD, 8, 0, 10, 0, $64
anim_wait 2
anim_sound 6, 2, SFX_SHINE
- anim_obj ANIM_OBJ_11, 8, 0, 12, 0, $63
+ anim_obj ANIM_OBJ_BLIZZARD, 8, 0, 12, 0, $63
anim_wait 2
anim_loop 3, .loop
anim_bgeffect ANIM_BG_WHITE_HUES, $0, $8, $0
anim_wait 32
- anim_obj ANIM_OBJ_29, -15, 0, 9, 2, $10
+ anim_obj ANIM_OBJ_ICE_BUILDUP, -15, 0, 9, 2, $10
anim_wait 128
anim_sound 0, 1, SFX_SHINE
anim_wait 8
@@ -1085,13 +1085,13 @@
BattleAnim_Bubble: ; c991e
anim_1gfx ANIM_GFX_BUBBLE
anim_sound 32, 2, SFX_WATER_GUN
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $c1
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $c1
anim_wait 6
anim_sound 32, 2, SFX_WATER_GUN
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $e1
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $e1
anim_wait 6
anim_sound 32, 2, SFX_WATER_GUN
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $d1
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $d1
anim_wait 128
anim_wait 32
anim_ret
@@ -1101,13 +1101,13 @@
anim_1gfx ANIM_GFX_BUBBLE
.loop
anim_sound 16, 2, SFX_BUBBLEBEAM
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $92
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $92
anim_wait 6
anim_sound 16, 2, SFX_BUBBLEBEAM
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $b3
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $b3
anim_wait 6
anim_sound 16, 2, SFX_BUBBLEBEAM
- anim_obj ANIM_OBJ_21, 8, 0, 11, 4, $f4
+ anim_obj ANIM_OBJ_BUBBLE, 8, 0, 11, 4, $f4
anim_wait 8
anim_loop 3, .loop
anim_wait 64
@@ -1213,13 +1213,13 @@
BattleAnim_LeechSeed: ; c9a5a
anim_1gfx ANIM_GFX_PLANT
anim_sound 16, 2, SFX_VINE_WHIP
- anim_obj ANIM_OBJ_4A, 6, 0, 10, 0, $20
+ anim_obj ANIM_OBJ_LEECH_SEED, 6, 0, 10, 0, $20
anim_wait 8
anim_sound 16, 2, SFX_VINE_WHIP
- anim_obj ANIM_OBJ_4A, 6, 0, 10, 0, $30
+ anim_obj ANIM_OBJ_LEECH_SEED, 6, 0, 10, 0, $30
anim_wait 8
anim_sound 16, 2, SFX_VINE_WHIP
- anim_obj ANIM_OBJ_4A, 6, 0, 10, 0, $28
+ anim_obj ANIM_OBJ_LEECH_SEED, 6, 0, 10, 0, $28
anim_wait 32
anim_sound 0, 1, SFX_CHARGE
anim_wait 128
@@ -1229,17 +1229,17 @@
BattleAnim_RazorLeaf: ; c9a7c
anim_1gfx ANIM_GFX_PLANT
anim_sound 0, 0, SFX_VINE_WHIP
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $28
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $5c
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $10
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $e8
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $9c
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $d0
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $28
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $5c
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $10
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $e8
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $9c
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $d0
anim_wait 6
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $1c
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $50
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $dc
- anim_obj ANIM_OBJ_14, 6, 0, 10, 0, $90
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $1c
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $50
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $dc
+ anim_obj ANIM_OBJ_RAZOR_LEAF, 6, 0, 10, 0, $90
anim_wait 80
anim_sound 16, 2, SFX_VINE_WHIP
anim_incobj 3
@@ -1275,7 +1275,8 @@
; c9af2
BattleAnim_Solarbeam: ; c9af2
- anim_jumpif $0, BattleAnim_Solarbeam_branch_c9b30
+ anim_if_param_equal $0, .FireSolarBeam
+ ; charge turn
anim_1gfx ANIM_GFX_CHARGE
anim_sound 0, 0, SFX_CHARGE
anim_obj ANIM_OBJ_3D, 6, 0, 10, 4, $0
@@ -1293,7 +1294,7 @@
anim_ret
; c9b30
-BattleAnim_Solarbeam_branch_c9b30: ; c9b30
+.FireSolarBeam
anim_1gfx ANIM_GFX_BEAM
anim_bgeffect ANIM_BG_06, $0, $2, $0
anim_call BattleAnim_Solarbeam_branch_cbb39
@@ -1362,7 +1363,7 @@
; c9bbd
BattleAnim_RazorWind: ; c9bbd
- anim_jumpif $1, BattleAnim_RazorWind_branch_c9fb5
+ anim_if_param_equal $1, BattleAnim_RazorWind_branch_c9fb5
anim_1gfx ANIM_GFX_WHIP
anim_bgeffect ANIM_BG_06, $0, $1, $0
.loop
@@ -1430,7 +1431,7 @@
BattleAnim_Selfdestruct: ; c9c53
anim_1gfx ANIM_GFX_EXPLOSION
anim_bgeffect ANIM_BG_FLASH_INVERTED, $0, $8, $24
- anim_jumpif $1, .loop
+ anim_if_param_equal $1, .loop
anim_call BattleAnim_Selfdestruct_branch_cbb8f
anim_wait 16
anim_ret
@@ -1449,7 +1450,7 @@
anim_1gfx ANIM_GFX_EXPLOSION
anim_bgeffect ANIM_BG_1F, $60, $4, $10
anim_bgeffect ANIM_BG_FLASH_INVERTED, $0, $8, $24
- anim_jumpif $1, .loop
+ anim_if_param_equal $1, .loop
anim_call BattleAnim_Explosion_branch_cbb8f
anim_wait 16
anim_ret
@@ -1604,7 +1605,7 @@
BattleAnim_FurySwipes: ; c9dbc
anim_1gfx ANIM_GFX_CUT
- anim_jumpif $1, BattleAnim_FurySwipes_branch_c9dd9
+ anim_if_param_equal $1, BattleAnim_FurySwipes_branch_c9dd9
anim_sound 0, 1, SFX_SCRATCH
anim_obj ANIM_OBJ_37, -14, 0, 6, 0, $0
anim_obj ANIM_OBJ_37, -15, 4, 5, 4, $0
@@ -1685,8 +1686,8 @@
; c9e6f
BattleAnim_Fly: ; c9e6f
- anim_jumpif $1, BattleAnim_Fly_branch_c9e89
- anim_jumpif $2, BattleAnim_Fly_branch_c9e82
+ anim_if_param_equal $1, BattleAnim_Fly_branch_c9e89
+ anim_if_param_equal $2, BattleAnim_Fly_branch_c9e82
anim_1gfx ANIM_GFX_HIT
anim_sound 0, 1, SFX_WING_ATTACK
anim_obj ANIM_OBJ_01, -15, 0, 7, 0, $0
@@ -1742,13 +1743,13 @@
anim_obj ANIM_OBJ_3D, 5, 4, 11, 0, $0
.loop
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, 16, 0, 6, 0, $2
+ anim_obj ANIM_OBJ_ABSORB, 16, 0, 6, 0, $2
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 8, 0, $3
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 8, 0, $3
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 4, 0, $4
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 4, 0, $4
anim_wait 6
anim_loop 5, .loop
anim_wait 32
@@ -1762,17 +1763,17 @@
anim_setvar $0
.loop
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, 16, 0, 6, 0, $2
+ anim_obj ANIM_OBJ_ABSORB, 16, 0, 6, 0, $2
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 8, 0, $3
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 8, 0, $3
anim_wait 6
anim_sound 6, 3, SFX_WATER_GUN
- anim_obj ANIM_OBJ_45, -15, 0, 4, 0, $4
+ anim_obj ANIM_OBJ_ABSORB, -15, 0, 4, 0, $4
anim_wait 6
anim_incvar
- anim_jumpvar $7, .done
- anim_jumpvar $2, .spawn
+ anim_if_var_equal $7, .done
+ anim_if_var_equal $2, .spawn
anim_jump .loop
; c9f46
@@ -1861,7 +1862,7 @@
; c9ffc
BattleAnim_Bide: ; c9ffc
- anim_jumpif $0, BattleAnim_Bide_branch_c9651
+ anim_if_param_equal $0, BattleAnim_Bide_branch_c9651
anim_1gfx ANIM_GFX_HIT
anim_call BattleAnim_FollowEnemyFeet_0
anim_sound 0, 0, SFX_ESCAPE_ROPE
@@ -1982,7 +1983,7 @@
anim_wait 16
anim_loop 3, .loop
anim_wait 16
- anim_jumpif $0, .done
+ anim_if_param_equal $0, .done
anim_bgeffect ANIM_BG_27, $0, $0, $0
anim_wait 64
.done
@@ -2142,8 +2143,8 @@
BattleAnim_Dig: ; ca24b
anim_2gfx ANIM_GFX_SAND, ANIM_GFX_HIT
- anim_jumpif $0, .hit
- anim_jumpif $2, .fail
+ anim_if_param_equal $0, .hit
+ anim_if_param_equal $2, .fail
anim_call BattleAnim_FollowPlayerHead_0
anim_bgeffect ANIM_BG_DIG, $0, $1, $1
anim_obj ANIM_OBJ_57, 9, 0, 13, 0, $0
@@ -2312,7 +2313,7 @@
anim_incobj 9
anim_sound 16, 2, SFX_WHIRLWIND
anim_wait 128
- anim_jumpif $0, .done
+ anim_if_param_equal $0, .done
anim_bgeffect ANIM_BG_27, $0, $0, $0
anim_wait 64
.done
@@ -2335,8 +2336,8 @@
anim_1gfx ANIM_GFX_HAZE
anim_sound 0, 1, SFX_SURF
.loop
- anim_obj ANIM_OBJ_5B, 6, 0, 7, 0, $0
- anim_obj ANIM_OBJ_5B, -16, 4, 2, 0, $0
+ anim_obj ANIM_OBJ_HAZE, 6, 0, 7, 0, $0
+ anim_obj ANIM_OBJ_HAZE, -16, 4, 2, 0, $0
anim_wait 12
anim_loop 5, .loop
anim_wait 96
@@ -2348,7 +2349,7 @@
anim_1gfx ANIM_GFX_HAZE
anim_sound 0, 0, SFX_SURF
.loop
- anim_obj ANIM_OBJ_5C, 6, 0, 7, 0, $0
+ anim_obj ANIM_OBJ_MIST, 6, 0, 7, 0, $0
anim_wait 8
anim_loop 10, .loop
anim_wait 96
@@ -2359,7 +2360,7 @@
anim_1gfx ANIM_GFX_HAZE
anim_sound 0, 1, SFX_BUBBLEBEAM
.loop
- anim_obj ANIM_OBJ_5D, -16, 4, 2, 0, $0
+ anim_obj ANIM_OBJ_SMOG, -16, 4, 2, 0, $0
anim_wait 8
anim_loop 10, .loop
anim_wait 96
@@ -2370,7 +2371,7 @@
anim_1gfx ANIM_GFX_HAZE
anim_sound 16, 2, SFX_BUBBLEBEAM
.loop
- anim_obj ANIM_OBJ_5E, 5, 4, 10, 0, $2
+ anim_obj ANIM_OBJ_POISON_GAS, 5, 4, 10, 0, $2
anim_wait 8
anim_loop 10, .loop
anim_wait 128
@@ -2379,7 +2380,7 @@
BattleAnim_HornAttack: ; ca439
anim_2gfx ANIM_GFX_HORN, ANIM_GFX_HIT
- anim_obj ANIM_OBJ_5F, 9, 0, 10, 0, $1
+ anim_obj ANIM_OBJ_HORN, 9, 0, 10, 0, $1
anim_wait 16
anim_sound 0, 1, SFX_HORN_ATTACK
anim_obj ANIM_OBJ_01, -15, 0, 7, 0, $0
@@ -2389,17 +2390,17 @@
BattleAnim_FuryAttack: ; ca44c
anim_2gfx ANIM_GFX_HORN, ANIM_GFX_HIT
- anim_obj ANIM_OBJ_5F, 9, 0, 9, 0, $2
+ anim_obj ANIM_OBJ_HORN, 9, 0, 9, 0, $2
anim_wait 8
anim_sound 0, 1, SFX_HORN_ATTACK
anim_obj ANIM_OBJ_04, 16, 0, 5, 0, $0
anim_wait 8
- anim_obj ANIM_OBJ_5F, 10, 0, 11, 0, $2
+ anim_obj ANIM_OBJ_HORN, 10, 0, 11, 0, $2
anim_wait 8
anim_sound 0, 1, SFX_HORN_ATTACK
anim_obj ANIM_OBJ_04, -15, 0, 7, 0, $0
anim_wait 8
- anim_obj ANIM_OBJ_5F, 9, 4, 10, 0, $2
+ anim_obj ANIM_OBJ_HORN, 9, 4, 10, 0, $2
anim_wait 8
anim_sound 0, 1, SFX_HORN_ATTACK
anim_obj ANIM_OBJ_04, -16, 4, 6, 0, $0
@@ -2410,7 +2411,7 @@
BattleAnim_HornDrill: ; ca47d
anim_2gfx ANIM_GFX_HORN, ANIM_GFX_HIT
anim_bgeffect ANIM_BG_FLASH_INVERTED, $0, $8, $40
- anim_obj ANIM_OBJ_5F, 9, 0, 10, 0, $3
+ anim_obj ANIM_OBJ_HORN, 9, 0, 10, 0, $3
anim_wait 8
.loop
anim_sound 0, 1, SFX_HORN_ATTACK
@@ -2608,7 +2609,7 @@
; ca63f
BattleAnim_SkullBash: ; ca63f
- anim_jumpif $1, BattleAnim_SkullBash_branch_c9fb5
+ anim_if_param_equal $1, BattleAnim_SkullBash_branch_c9fb5
anim_1gfx ANIM_GFX_HIT
anim_bgeffect ANIM_BG_1F, $14, $2, $0
anim_wait 32
@@ -2714,14 +2715,14 @@
BattleAnim_Substitute: ; ca73c
anim_sound 0, 0, SFX_SURF
- anim_jumpif $3, BattleAnim_Substitute_branch_ca77c
- anim_jumpif $2, BattleAnim_Substitute_branch_ca76e
- anim_jumpif $1, BattleAnim_Substitute_branch_ca760
+ anim_if_param_equal $3, BattleAnim_Substitute_branch_ca77c
+ anim_if_param_equal $2, BattleAnim_Substitute_branch_ca76e
+ anim_if_param_equal $1, BattleAnim_Substitute_branch_ca760
anim_1gfx ANIM_GFX_SMOKE
anim_bgeffect ANIM_BG_27, $0, $1, $0
anim_wait 48
anim_raisesub
- anim_obj ANIM_OBJ_1C, 6, 0, 12, 0, $0
+ anim_obj ANIM_OBJ_BALL_POOF, 6, 0, 12, 0, $0
anim_bgeffect ANIM_BG_ENTER_MON, $0, $1, $0
anim_wait 32
anim_ret
@@ -2769,7 +2770,7 @@
; ca7a1
BattleAnim_SkyAttack: ; ca7a1
- anim_jumpif $1, BattleAnim_SkyAttack_branch_c9fb5
+ anim_if_param_equal $1, BattleAnim_SkyAttack_branch_c9fb5
anim_1gfx ANIM_GFX_SKY_ATTACK
anim_bgeffect ANIM_BG_27, $0, $1, $0
anim_wait 32
@@ -2826,14 +2827,14 @@
BattleAnim_Withdraw: ; ca80c
anim_1gfx ANIM_GFX_REFLECT
anim_call BattleAnim_FollowPlayerHead_0
- anim_bgeffect ANIM_BG_21, $0, $1, $50
+ anim_bgeffect ANIM_BG_WITHDRAW, $0, $1, $50
anim_wait 48
anim_sound 0, 0, SFX_SHINE
- anim_obj ANIM_OBJ_70, 6, 0, 11, 0, $0
+ anim_obj ANIM_OBJ_WITHDRAW, 6, 0, 11, 0, $0
anim_wait 64
anim_incobj 2
anim_wait 1
- anim_incbgeffect ANIM_BG_21
+ anim_incbgeffect ANIM_BG_WITHDRAW
anim_call BattleAnim_ShowMon_0
anim_ret
; ca829
@@ -2965,7 +2966,7 @@
anim_wait 24
anim_incobj 1
anim_sound 0, 1, SFX_BALL_POOF
- anim_obj ANIM_OBJ_1C, 13, 4, 8, 6, $10
+ anim_obj ANIM_OBJ_BALL_POOF, 13, 4, 8, 6, $10
anim_wait 8
.loop
anim_sound 0, 1, SFX_MENU
@@ -3324,8 +3325,8 @@
BattleAnim_TripleKick: ; cac7b
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_TripleKick_branch_cac95
- anim_jumpif $2, BattleAnim_TripleKick_branch_caca5
+ anim_if_param_equal $1, BattleAnim_TripleKick_branch_cac95
+ anim_if_param_equal $2, BattleAnim_TripleKick_branch_caca5
anim_sound 0, 1, SFX_MEGA_KICK
anim_obj ANIM_OBJ_07, -14, 0, 6, 0, $0
anim_wait 6
@@ -3447,7 +3448,7 @@
; cad86
BattleAnim_Curse: ; cad86
- anim_jumpif $1, .NotGhost
+ anim_if_param_equal $1, .NotGhost
anim_2gfx ANIM_GFX_HIT, ANIM_GFX_OBJECTS
anim_obj ANIM_OBJ_A5, 8, 4, 9, 0, $0
anim_sound 0, 0, SFX_CURSE
@@ -3551,7 +3552,7 @@
anim_1gfx ANIM_GFX_MISC
anim_sound 0, 1, SFX_POWDER
.loop ; cae8b
- anim_obj ANIM_OBJ_81, -16, 4, 4, 0, $0
+ anim_obj ANIM_OBJ_COTTON_SPORE, -16, 4, 4, 0, $0
anim_wait 8
anim_loop 5, .loop
anim_wait 96
@@ -3750,9 +3751,9 @@
anim_sound 6, 2, SFX_SLUDGE_BOMB
anim_obj ANIM_OBJ_8C, 8, 0, 11, 4, $4
anim_wait 16
- anim_obj ANIM_OBJ_1C, -16, 4, 7, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -16, 4, 7, 0, $10
anim_wait 8
- anim_jumpif $0, .done
+ anim_if_param_equal $0, .done
.loop
anim_obj ANIM_OBJ_74, -16, 4, 7, 4, $20
anim_wait 8
@@ -3810,7 +3811,7 @@
anim_1gfx ANIM_GFX_ANGELS
anim_bgp $1b
anim_obp0 $0
- anim_jumpif $1, BattleAnim_DestinyBond_branch_cb104
+ anim_if_param_equal $1, BattleAnim_DestinyBond_branch_cb104
anim_sound 6, 2, SFX_WHIRLWIND
anim_obj ANIM_OBJ_9B, 5, 4, 15, 0, $2
anim_wait 128
@@ -4097,7 +4098,7 @@
anim_1gfx ANIM_GFX_CUT
.loop
anim_sound 0, 1, SFX_CUT
- anim_jumpand $1, .obj1
+ anim_if_param_and %00000001, .obj1
anim_obj ANIM_OBJ_3A, -13, 0, 5, 0, $0
anim_jump .okay
@@ -4223,7 +4224,7 @@
anim_obj ANIM_OBJ_53, 13, 0, 6, 0, $0
anim_wait 48
anim_incobj 2
- anim_jumpif $3, .heal
+ anim_if_param_equal $3, .heal
anim_incobj 1
anim_wait 1
anim_1gfx ANIM_GFX_EXPLOSION
@@ -4356,7 +4357,7 @@
anim_bgeffect ANIM_BG_1F, $40, $2, $0
anim_wait 48
anim_bgeffect ANIM_BG_FLASH_INVERTED, $0, $8, $3
- anim_obj ANIM_OBJ_5F, 9, 0, 10, 0, $1
+ anim_obj ANIM_OBJ_HORN, 9, 0, 10, 0, $1
anim_sound 0, 1, SFX_HORN_ATTACK
anim_wait 16
anim_obj ANIM_OBJ_00, -15, 0, 7, 0, $0
@@ -4399,7 +4400,7 @@
BattleAnim_Pursuit: ; cb61b
anim_1gfx ANIM_GFX_HIT
- anim_jumpif $1, BattleAnim_Pursuit_branch_cb62b
+ anim_if_param_equal $1, BattleAnim_Pursuit_branch_cb62b
anim_sound 0, 1, SFX_COMET_PUNCH
anim_obj ANIM_OBJ_01, -15, 0, 7, 0, $0
anim_wait 16
@@ -4534,7 +4535,7 @@
anim_wait 6
anim_loop 5, .loop
anim_wait 32
- anim_jumpif $0, .zero
+ anim_if_param_equal 0, .zero
anim_call BattleAnim_MorningSun_branch_cbc6a
anim_ret
; cb756
@@ -4553,12 +4554,12 @@
anim_wait 72
anim_incbgeffect ANIM_BG_18
anim_call BattleAnim_ShowMon_0
- anim_jumpif $1, BattleAnim_Synthesis_branch_cb77a
+ anim_if_param_equal $1, .one
anim_call BattleAnim_Synthesis_branch_cbc6a
anim_ret
; cb77a
-BattleAnim_Synthesis_branch_cb77a: ; cb77a
+.one
anim_call BattleAnim_Synthesis_branch_cbc80
anim_ret
; cb77e
@@ -4592,12 +4593,11 @@
anim_wait 1
anim_sound 0, 0, SFX_MOONLIGHT
anim_wait 63
- anim_jumpif $3, BattleAnim_Moonlight_branch_cb7d7
+ anim_if_param_equal $3, .three
anim_call BattleAnim_Moonlight_branch_cbc6a
anim_ret
-; cb7d7
-BattleAnim_Moonlight_branch_cb7d7: ; cb7d7
+.three
anim_call BattleAnim_Moonlight_branch_cbc80
anim_ret
; cb7db
@@ -4811,7 +4811,7 @@
anim_sound 6, 2, SFX_SLUDGE_BOMB
anim_obj ANIM_OBJ_B4, 8, 0, 11, 4, $2
anim_wait 32
- anim_obj ANIM_OBJ_1C, -16, 4, 7, 0, $10
+ anim_obj ANIM_OBJ_BALL_POOF, -16, 4, 7, 0, $10
anim_wait 24
anim_ret
; cb9db
@@ -4877,7 +4877,7 @@
; cba84
BattleAnim_BeatUp: ; cba84
- anim_jumpif $0, .current_mon
+ anim_if_param_equal $0, .current_mon
anim_sound 0, 0, SFX_BALL_POOF
anim_bgeffect ANIM_BG_RETURN_MON, $0, $1, $0
anim_wait 16
--- a/battle/bg_effects.asm
+++ b/battle/bg_effects.asm
@@ -111,7 +111,7 @@
dw BattleBGEffect_1e
dw BattleBGEffect_1f
dw BattleBGEffect_20
- dw BattleBGEffect_21
+ dw BattleBGEffect_Withdraw
dw BattleBGEffect_BounceDown
dw BattleBGEffect_Dig
dw BattleBGEffect_Tackle
@@ -963,7 +963,7 @@
ld hl, wSurfWaveBGEffect
ld bc, $0
.loop2
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
cp e
jr nc, .load_zero
push hl
@@ -1000,9 +1000,9 @@
ld a, $42
ld [hFFC6], a
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $5e
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
lb de, 2, 2
call Functionc8f2e
ret
@@ -1074,9 +1074,9 @@
ld a, $43
ld [hFFC6], a
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $5f
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
lb de, 6, 5
call Functionc8f2e
ld hl, BG_EFFECT_STRUCT_03
@@ -1167,9 +1167,9 @@
call BattleBGEffects_ClearLYOverrides
ld a, $43
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $0
@@ -1224,9 +1224,9 @@
inc a
ld d, a
ld h, LYOverridesBackup / $100
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld l, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
srl a
push af
@@ -1264,8 +1264,8 @@
ld e, [hl]
ld d, 2
call Functionc8f2e
- ld h, $d2
- ld a, [hFFC8]
+ ld h, LYOverridesBackup / $100
+ ld a, [hLYOverrideEnd]
ld l, a
ld [hl], $0
dec l
@@ -1273,9 +1273,9 @@
ret
.one
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
ld l, a
- ld h, $d2
+ ld h, LYOverridesBackup / $100
ld e, l
ld d, h
dec de
@@ -1283,11 +1283,11 @@
ld a, [de]
dec de
ld [hld], a
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
cp l
jr nz, .loop
ld [hl], $90
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
ld l, a
ld a, [hl]
cp $1
@@ -1309,7 +1309,7 @@
call BattleAnim_ResetLCDStatCustom
ret
-BattleBGEffect_21: ; c8761 (32:4761)
+BattleBGEffect_Withdraw: ; c8761 (32:4761)
call BattleBGEffects_AnonJumptable
.anon_dw
dw .zero
@@ -1322,9 +1322,9 @@
call BattleBGEffects_ClearLYOverrides
ld a, $42
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $1
@@ -1341,7 +1341,7 @@
ld a, [hl]
cp d
ret nc
- call Functionc901b
+ call BGEffect_DisplaceLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@@ -1372,9 +1372,9 @@
call BattleBGEffects_ClearLYOverrides
ld a, $42
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $2
@@ -1396,9 +1396,9 @@
ld [hl], $10
call BattleBGEffects_IncrementJumptable
.two
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld l, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
dec a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
@@ -1414,7 +1414,7 @@
dec [hl]
.skip
pop af
- call Functionc901b
+ call BGEffect_DisplaceLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
inc [hl]
@@ -1439,9 +1439,9 @@
call BattleBGEffects_ClearLYOverrides
ld a, $43
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1474,9 +1474,9 @@
call BattleBGEffects_ClearLYOverrides
ld a, $43
call BattleBGEffect_SetLCDStatCustoms2
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1546,12 +1546,12 @@
jr z, .rollout
.not_rollout
pop af
- jp Functionc900b
+ jp BGEffect_FillLYOverridesBackup
.rollout
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld d, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub d
ld d, a
ld h, LYOverridesBackup / $100
@@ -1558,7 +1558,7 @@
ld a, [hSCY]
or a
jr nz, .skip1
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
or a
jr z, .skip2
dec a
@@ -1567,7 +1567,7 @@
jr .skip2
.skip1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
dec a
ld l, a
ld [hl], $0
@@ -1574,7 +1574,7 @@
.skip2
ld a, [hSCY]
ld l, a
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
sub l
jr nc, .skip3
xor a
@@ -1606,9 +1606,9 @@
call BattleBGEffects_ClearLYOverrides
ld a, $43
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1650,9 +1650,9 @@
call BattleBGEffects_ClearLYOverrides
ld a, $43
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1664,7 +1664,7 @@
ld a, [hl]
ld d, $8
call BattleBGEffects_Sine
- call Functionc900b
+ call BGEffect_FillLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@@ -1689,9 +1689,9 @@
call BattleBGEffects_ClearLYOverrides
ld a, $43
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
xor a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
@@ -1714,7 +1714,7 @@
ld e, a
pop af
add e
- call Functionc900b
+ call BGEffect_FillLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld a, [hl]
@@ -1787,9 +1787,9 @@
call BattleBGEffects_ClearLYOverrides
ld a, $42
call BattleBGEffect_SetLCDStatCustoms2
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $1
@@ -1814,7 +1814,7 @@
ld d, a
pop af
add d
- call Functionc901b
+ call BGEffect_DisplaceLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
inc [hl]
@@ -1841,14 +1841,14 @@
call BattleBGEffects_SetLYOverrides
ld a, $47
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
- ld a, [hFFC7]
+ ld [hLYOverrideEnd], a
+ ld a, [hLYOverrideStart]
ld l, a
- ld h, $d2
+ ld h, LYOverridesBackup / $100
.loop
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
cp l
jr z, .done
xor a
@@ -1873,9 +1873,9 @@
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
inc a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
call BattleBGEffects_IncrementJumptable
ret
@@ -1883,7 +1883,7 @@
call .GetLYOverride
jr nc, .finish
call .SetLYOverridesBackup
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
dec a
ld l, a
ld [hl], e
@@ -1895,9 +1895,9 @@
.SetLYOverridesBackup:
ld e, a
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld l, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
srl a
ld h, LYOverridesBackup / $100
@@ -1989,9 +1989,9 @@
ld a, $47
ld [hFFC6], a
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $60
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ret
.one
@@ -2223,9 +2223,9 @@
call BattleBGEffects_ClearLYOverrides
ld a, $43
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $1
@@ -2249,7 +2249,7 @@
xor $ff
inc a
ld [hl], a
- call Functionc900b
+ call BGEffect_FillLYOverridesBackup
ret
.finish
@@ -2270,9 +2270,9 @@
ld a, $43
ld [hFFC6], a
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $37
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -2286,7 +2286,7 @@
jr nc, .two
ld d, $6
call BattleBGEffects_Sine
- call Functionc900b
+ call BGEffect_FillLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@@ -2435,9 +2435,9 @@
call BattleBGEffects_SetLYOverrides
ld a, $47
call BattleBGEffect_SetLCDStatCustoms1
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
inc a
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@@ -2463,7 +2463,7 @@
ld [hl], a
call BattleBGEffect_GetFirstDMGPal
jr c, .okay_2_dmg
- call Functionc900b
+ call BGEffect_FillLYOverridesBackup
ret
.okay_2_dmg
@@ -2680,9 +2680,9 @@
lb de, $2f, $5e
.okay
ld a, d
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, e
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ret
BattleBGEffect_SetLCDStatCustoms2: ; c8ef4 (32:4ef4)
@@ -2696,15 +2696,15 @@
lb de, $2d, $5e
.okay
ld a, d
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, e
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ret
BattleAnim_ResetLCDStatCustom: ; c8f0a (32:4f0a)
xor a
- ld [hFFC7], a
- ld [hFFC8], a
+ ld [hLYOverrideStart], a
+ ld [hLYOverrideEnd], a
call BattleBGEffects_ClearLYOverrides
xor a
ld [hFFC6], a
@@ -2718,8 +2718,8 @@
ld [rBGP], a
ld [wBGP], a
ld [wOBP1], a
- ld [hFFC7], a
- ld [hFFC8], a
+ ld [hLYOverrideStart], a
+ ld [hLYOverrideEnd], a
call BattleBGEffects_ClearLYOverrides
ret
@@ -2735,10 +2735,10 @@
ld [wBattleAnimTemp3], a
ld bc, LYOverridesBackup
.loop
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
cp c
jr nc, .next
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
cp c
jr c, .next
ld a, [wBattleAnimTemp2]
@@ -2812,7 +2812,7 @@
call BattleBGEffects_Sine
ld e, a
pop hl
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
cp c
jr c, .skip1
ld a, e
@@ -2819,7 +2819,7 @@
ld [bc], a
inc bc
.skip1
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
cp l
jr nc, .skip2
ld [hl], e
@@ -2837,7 +2837,7 @@
ret
.GetLYOverrideBackupAddrOffset:
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld e, a
ld a, [wBattleAnimTemp0]
add e
@@ -2847,13 +2847,13 @@
BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef)
push bc
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld l, a
inc a
ld e, a
- ld h, $d2
+ ld h, LYOverridesBackup / $100
ld d, h
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
and a
jr z, .done
@@ -2872,44 +2872,45 @@
pop bc
ret
-Functionc900b: ; c900b (32:500b)
+BGEffect_FillLYOverridesBackup: ; c900b (32:500b)
push af
- ld h, $d2
- ld a, [hFFC7]
+ ld h, LYOverridesBackup / $100
+ ld a, [hLYOverrideStart]
ld l, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
ld d, a
pop af
-.asm_c9016
+.loop
ld [hli], a
dec d
- jr nz, .asm_c9016
+ jr nz, .loop
ret
-Functionc901b: ; c901b (32:501b)
+BGEffect_DisplaceLYOverridesBackup: ; c901b (32:501b)
+ ; e = a; d = [hLYOverrideEnd] - [hLYOverrideStart] - a
push af
ld e, a
- ld a, [hFFC7]
+ ld a, [hLYOverrideStart]
ld l, a
- ld a, [hFFC8]
+ ld a, [hLYOverrideEnd]
sub l
sub e
ld d, a
- ld h, $d2
- ld a, [hFFC7]
+ ld h, LYOverridesBackup / $100
+ ld a, [hLYOverrideStart]
ld l, a
ld a, $90
-.asm_c902c
+.loop
ld [hli], a
dec e
- jr nz, .asm_c902c
+ jr nz, .loop
pop af
xor $ff
-.asm_c9033
+.loop2
ld [hli], a
dec d
- jr nz, .asm_c9033
+ jr nz, .loop2
ret
BGEffect_CheckBattleTurn: ; c9038 (32:5038)
--- a/battle/objects/data.asm
+++ b/battle/objects/data.asm
@@ -57,22 +57,22 @@
; ANIM_OBJ_BURNED
battleanimobj $01, $90, BATTLEANIMFRAMESET_11, BATTLEANIMFUNC_03, $04, $03
-; ANIM_OBJ_11
+; ANIM_OBJ_BLIZZARD
battleanimobj $01, $90, BATTLEANIMFRAMESET_12, BATTLEANIMFUNC_08, $06, $0a
; ANIM_OBJ_12
battleanimobj $01, $90, BATTLEANIMFRAMESET_13, BATTLEANIMFUNC_00, $06, $0a
-; ANIM_OBJ_13
+; ANIM_OBJ_ICE_BEAM
battleanimobj $01, $90, BATTLEANIMFRAMESET_14, BATTLEANIMFUNC_01, $06, $0a
-; ANIM_OBJ_14
- battleanimobj $21, $78, BATTLEANIMFRAMESET_16, BATTLEANIMFUNC_0B, $05, $06
+; ANIM_OBJ_RAZOR_LEAF
+ battleanimobj $21, $78, BATTLEANIMFRAMESET_16, BATTLEANIMFUNC_RAZOR_LEAF, $05, $06
; ANIM_OBJ_POKE_BALL
battleanimobj $00, $00, BATTLEANIMFRAMESET_09, BATTLEANIMFUNC_12, $04, $0b
-; ANIM_OBJ_16
+; ANIM_OBJ_POKE_BALL_BLOCKED
battleanimobj $00, $00, BATTLEANIMFRAMESET_09, BATTLEANIMFUNC_13, $04, $0b
; ANIM_OBJ_17
@@ -90,7 +90,7 @@
; ANIM_OBJ_1B
battleanimobj $01, $90, BATTLEANIMFRAMESET_08, BATTLEANIMFUNC_00, $02, $07
-; ANIM_OBJ_1C
+; ANIM_OBJ_BALL_POOF
battleanimobj $01, $a0, BATTLEANIMFRAMESET_08, BATTLEANIMFUNC_00, $02, $07
; ANIM_OBJ_1D
@@ -105,7 +105,7 @@
; ANIM_OBJ_20
battleanimobj $01, $b0, BATTLEANIMFRAMESET_84, BATTLEANIMFUNC_36, $06, $21
-; ANIM_OBJ_21
+; ANIM_OBJ_BUBBLE
battleanimobj $01, $90, BATTLEANIMFRAMESET_21, BATTLEANIMFUNC_0C, $06, $0d
; ANIM_OBJ_22
@@ -129,13 +129,13 @@
; ANIM_OBJ_28
battleanimobj $61, $98, BATTLEANIMFRAMESET_2D, BATTLEANIMFUNC_09, $03, $10
-; ANIM_OBJ_29
+; ANIM_OBJ_ICE_BUILDUP
battleanimobj $01, $b8, BATTLEANIMFRAMESET_2E, BATTLEANIMFUNC_00, $06, $0a
; ANIM_OBJ_FROZEN
battleanimobj $01, $b8, BATTLEANIMFRAMESET_2F, BATTLEANIMFUNC_00, $06, $0a
-; ANIM_OBJ_2B
+; ANIM_OBJ_MASTER_BALL_SPARKLE
battleanimobj $01, $b8, BATTLEANIMFRAMESET_30, BATTLEANIMFUNC_14, $07, $11
; ANIM_OBJ_2C
@@ -213,7 +213,7 @@
; ANIM_OBJ_44
battleanimobj $21, $80, BATTLEANIMFRAMESET_4B, BATTLEANIMFUNC_00, $03, $11
-; ANIM_OBJ_45
+; ANIM_OBJ_ABSORB
battleanimobj $01, $88, BATTLEANIMFRAMESET_4C, BATTLEANIMFUNC_1C, $05, $12
; ANIM_OBJ_46
@@ -228,8 +228,8 @@
; ANIM_OBJ_49
battleanimobj $21, $ff, BATTLEANIMFRAMESET_54, BATTLEANIMFUNC_1F, $05, $16
-; ANIM_OBJ_4A
- battleanimobj $21, $68, BATTLEANIMFRAMESET_56, BATTLEANIMFUNC_20, $05, $06
+; ANIM_OBJ_LEECH_SEED
+ battleanimobj $21, $68, BATTLEANIMFRAMESET_56, BATTLEANIMFUNC_LEECH_SEED, $05, $06
; ANIM_OBJ_4B
battleanimobj $21, $90, BATTLEANIMFRAMESET_59, BATTLEANIMFUNC_21, $02, $0e
@@ -279,20 +279,20 @@
; ANIM_OBJ_5A
battleanimobj $21, $90, BATTLEANIMFRAMESET_6A, BATTLEANIMFUNC_27, $02, $1b
-; ANIM_OBJ_5B
- battleanimobj $00, $00, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_29, $02, $1c
+; ANIM_OBJ_HAZE
+ battleanimobj $00, $00, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_SPRIAL_DESCENT, $02, $1c
-; ANIM_OBJ_5C
- battleanimobj $21, $48, BATTLEANIMFRAMESET_70, BATTLEANIMFUNC_29, $02, $1c
+; ANIM_OBJ_MIST
+ battleanimobj $21, $48, BATTLEANIMFRAMESET_70, BATTLEANIMFUNC_SPRIAL_DESCENT, $02, $1c
-; ANIM_OBJ_5D
- battleanimobj $21, $48, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_29, $02, $1c
+; ANIM_OBJ_SMOG
+ battleanimobj $21, $48, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_SPRIAL_DESCENT, $02, $1c
-; ANIM_OBJ_5E
- battleanimobj $21, $78, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_2A, $02, $1c
+; ANIM_OBJ_POISON_GAS
+ battleanimobj $21, $78, BATTLEANIMFRAMESET_6F, BATTLEANIMFUNC_POISON_GAS, $02, $1c
-; ANIM_OBJ_5F
- battleanimobj $61, $90, BATTLEANIMFRAMESET_71, BATTLEANIMFUNC_2B, $02, $1d
+; ANIM_OBJ_HORN
+ battleanimobj $61, $90, BATTLEANIMFRAMESET_71, BATTLEANIMFUNC_HORN, $02, $1d
; ANIM_OBJ_60
battleanimobj $61, $90, BATTLEANIMFRAMESET_72, BATTLEANIMFUNC_2C, $02, $1d
@@ -313,7 +313,7 @@
battleanimobj $01, $80, BATTLEANIMFRAMESET_30, BATTLEANIMFUNC_2F, $02, $11
; ANIM_OBJ_66
- battleanimobj $01, $78, BATTLEANIMFRAMESET_76, BATTLEANIMFUNC_2A, $04, $23
+ battleanimobj $01, $78, BATTLEANIMFRAMESET_76, BATTLEANIMFUNC_POISON_GAS, $04, $23
; ANIM_OBJ_67
battleanimobj $01, $80, BATTLEANIMFRAMESET_77, BATTLEANIMFUNC_30, $02, $1f
@@ -342,7 +342,7 @@
; ANIM_OBJ_LICK
battleanimobj $21, $98, BATTLEANIMFRAMESET_7C, BATTLEANIMFUNC_00, $02, $04
-; ANIM_OBJ_70
+; ANIM_OBJ_WITHDRAW
battleanimobj $21, $80, BATTLEANIMFRAMESET_7D, BATTLEANIMFUNC_00, $02, $18
; ANIM_OBJ_71
@@ -393,8 +393,8 @@
; ANIM_OBJ_80
battleanimobj $01, $a8, BATTLEANIMFRAMESET_0F, BATTLEANIMFUNC_3C, $04, $03
-; ANIM_OBJ_81
- battleanimobj $21, $68, BATTLEANIMFRAMESET_89, BATTLEANIMFUNC_29, $02, $1f
+; ANIM_OBJ_COTTON_SPORE
+ battleanimobj $21, $68, BATTLEANIMFRAMESET_89, BATTLEANIMFUNC_SPRIAL_DESCENT, $02, $1f
; ANIM_OBJ_82
battleanimobj $21, $b0, BATTLEANIMFRAMESET_8A, BATTLEANIMFUNC_00, $02, $1f
--- a/battle/objects/functions.asm
+++ b/battle/objects/functions.asm
@@ -13,18 +13,18 @@
; ccfce
.Jumptable:
- dw BattleAnimFunction_00 ; 00
+ dw BattleAnimFunction_Null ; 00
dw BattleAnimFunction_01 ; 01
dw BattleAnimFunction_02 ; 02
dw BattleAnimFunction_03 ; 03
dw BattleAnimFunction_04 ; 04
- dw BattleAnimFunction_05 ; 05
- dw BattleAnimFunction_06 ; 06
+ dw BattleAnimFunction_ThrowFromPlayerToEnemy ; 05
+ dw BattleAnimFunction_ThrowFromPlayerToEnemyAndDisappear ; 06
dw BattleAnimFunction_07 ; 07
dw BattleAnimFunction_08 ; 08
dw BattleAnimFunction_09 ; 09
dw BattleAnimFunction_0A ; 0a
- dw BattleAnimFunction_0B ; 0b
+ dw BattleAnimFunction_RazorLeaf ; 0b
dw BattleAnimFunction_0C ; 0c
dw BattleAnimFunction_0D ; 0d
dw BattleAnimFunction_0E ; 0e
@@ -31,8 +31,8 @@
dw BattleAnimFunction_0F ; 0f
dw BattleAnimFunction_10 ; 10
dw BattleAnimFunction_11 ; 11
- dw BattleAnimFunction_12 ; 12
- dw BattleAnimFunction_13 ; 13
+ dw BattleAnimFunction_PokeBall ; 12
+ dw BattleAnimFunction_PokeBallBlocked ; 13
dw BattleAnimFunction_14 ; 14
dw BattleAnimFunction_15 ; 15
dw BattleAnimFunction_16 ; 16
@@ -45,7 +45,7 @@
dw BattleAnimFunction_1D ; 1d
dw BattleAnimFunction_1E ; 1e
dw BattleAnimFunction_1F ; 1f
- dw BattleAnimFunction_20 ; 20
+ dw BattleAnimFunction_LeechSeed ; 20
dw BattleAnimFunction_21 ; 21
dw BattleAnimFunction_22 ; 22
dw BattleAnimFunction_23 ; 23
@@ -54,9 +54,9 @@
dw BattleAnimFunction_26 ; 26
dw BattleAnimFunction_27 ; 27
dw BattleAnimFunction_28 ; 28
- dw BattleAnimFunction_29 ; 29
- dw BattleAnimFunction_2A ; 2a
- dw BattleAnimFunction_2B ; 2b
+ dw BattleAnimFunction_SpiralDescent ; 29
+ dw BattleAnimFunction_PoisonGas ; 2a
+ dw BattleAnimFunction_Horn ; 2b
dw BattleAnimFunction_2C ; 2c
dw BattleAnimFunction_2D ; 2d
dw BattleAnimFunction_2E ; 2e
@@ -94,7 +94,7 @@
dw BattleAnimFunction_4E ; 4e
dw BattleAnimFunction_4F ; 4f
-BattleAnimFunction_00: ; cd06e (33:506e)
+BattleAnimFunction_Null: ; cd06e (33:506e)
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
@@ -104,34 +104,41 @@
.zero
ret
-BattleAnimFunction_06: ; cd079 (33:5079)
- call BattleAnimFunction_05
+BattleAnimFunction_ThrowFromPlayerToEnemyAndDisappear: ; cd079 (33:5079)
+ call BattleAnimFunction_ThrowFromPlayerToEnemy
ret c
call DeinitBattleAnimation
ret
-BattleAnimFunction_05: ; cd081 (33:5081)
+BattleAnimFunction_ThrowFromPlayerToEnemy: ; cd081 (33:5081)
+ ; If x coord at $88 or beyond, abort.
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $88
ret nc
+ ; Move right 2 pixels
add $2
ld [hl], a
+ ; Move down 1 pixel
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
dec [hl]
+ ; Decrease ??? and hold onto its previous value (argument of the sine function)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
dec [hl]
+ ; Get ???, which is the amplitude of the sine function
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld d, [hl]
call BattleAnim_Sine
+ ; Store the result in the Y offset
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
+ ; Carry flag denotes success
scf
ret
@@ -153,9 +160,10 @@
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
-rept 4
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
+ inc [hl]
ld d, $10
push af
push de
@@ -258,7 +266,7 @@
call DeinitBattleAnimation
ret
-BattleAnimFunction_12: ; cd15c (33:515c)
+BattleAnimFunction_PokeBall: ; cd15c (33:515c)
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
@@ -273,13 +281,13 @@
dw .nine
dw .ten
dw .eleven
-.zero
+.zero ; init
call GetBallAnimPal
call BattleAnim_IncAnonJumptableIndex
ret
.one
- call BattleAnimFunction_05
+ call BattleAnimFunction_ThrowFromPlayerToEnemy
ret c
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
@@ -288,7 +296,7 @@
add hl, bc
add [hl]
ld [hl], a
- ld a, $b
+ ld a, BATTLEANIMFRAMESET_0B
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
@@ -295,7 +303,7 @@
.three
call BattleAnim_IncAnonJumptableIndex
- ld a, $9
+ ld a, BATTLEANIMFRAMESET_09
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -325,13 +333,13 @@
sub $4
ld [hl], a
ret nz
- ld a, $c
+ ld a, BATTLEANIMFRAMESET_0C
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
.six
- ld a, $d
+ ld a, BATTLEANIMFRAMESET_0D
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_ANON_JT_INDEX
add hl, bc
@@ -343,7 +351,7 @@
.seven
call GetBallAnimPal
- ld a, $a
+ ld a, BATTLEANIMFRAMESET_0A
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_10
@@ -375,7 +383,7 @@
call DeinitBattleAnimation
ret
-BattleAnimFunction_13: ; cd212 (33:5212)
+BattleAnimFunction_PokeBallBlocked: ; cd212 (33:5212)
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
@@ -392,7 +400,7 @@
ld a, [hl]
cp $70
jr nc, .next
- call BattleAnimFunction_05
+ call BattleAnimFunction_ThrowFromPlayerToEnemy
ret
.next
@@ -493,7 +501,7 @@
.three
call BattleAnim_IncAnonJumptableIndex
- ld a, $f
+ ld a, BATTLEANIMFRAMESET_0F
call ReinitBattleAnimFrameset
.four
ret
@@ -727,7 +735,7 @@
ld [hl], a
cp $7
jr z, .seven
- ld a, $11
+ ld a, BATTLEANIMFRAMESET_11
call ReinitBattleAnimFrameset
ret
@@ -746,7 +754,7 @@
.set_up_eight
call BattleAnim_IncAnonJumptableIndex
- ld a, $10
+ ld a, BATTLEANIMFRAMESET_10
call ReinitBattleAnimFrameset
.eight
ld hl, BATTLEANIMSTRUCT_0F
@@ -801,7 +809,7 @@
.six
ret
-BattleAnimFunction_0B: ; cd478 (33:5478)
+BattleAnimFunction_RazorLeaf: ; cd478 (33:5478)
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
@@ -830,7 +838,7 @@
add hl, bc
ld [hli], a
ld [hl], a
- ld a, $17
+ ld a, BATTLEANIMFRAMESET_17
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -926,7 +934,7 @@
ret
.three
- ld a, $16
+ ld a, BATTLEANIMFRAMESET_16
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_01
add hl, bc
@@ -1077,7 +1085,7 @@
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $0
- ld a, $22
+ ld a, BATTLEANIMFRAMESET_22
call ReinitBattleAnimFrameset
.two
ld hl, BATTLEANIMSTRUCT_XCOORD
@@ -1145,9 +1153,9 @@
ld a, $42
ld [hFFC6], a
ld a, $58
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $5e
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
ret
.one
@@ -1161,7 +1169,7 @@
jr nc, .asm_cd69b
call BattleAnim_IncAnonJumptableIndex
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ret
.asm_cd69b
@@ -1180,7 +1188,7 @@
add [hl]
sub $10
ret c
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld a, [hl]
@@ -1202,8 +1210,8 @@
jr c, asm_cd6da
xor a
ld [hFFC6], a
- ld [hFFC7], a
- ld [hFFC8], a
+ ld [hLYOverrideStart], a
+ ld [hLYOverrideEnd], a
.four
call DeinitBattleAnimation
ret
@@ -1214,7 +1222,7 @@
ld [hl], a
sub $10
ret c
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ret
BattleAnimFunction_0E: ; cd6e3 (33:56e3)
@@ -1226,8 +1234,8 @@
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
- ld a, $24
- add [hl]
+ ld a, BATTLEANIMFRAMESET_24
+ add [hl] ; offset
call ReinitBattleAnimFrameset
Functioncd6f7: ; cd6f7 (33:56f7)
ld hl, BATTLEANIMSTRUCT_XCOORD
@@ -1282,7 +1290,7 @@
.asm_cd747
call BattleAnim_IncAnonJumptableIndex
- ld a, $28
+ ld a, BATTLEANIMFRAMESET_28
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
@@ -1306,7 +1314,7 @@
.asm_cd76e
call BattleAnim_IncAnonJumptableIndex
- ld a, $29
+ ld a, BATTLEANIMFRAMESET_29
call ReinitBattleAnimFrameset
Functioncd776: ; cd776 (33:5776)
ret
@@ -1419,7 +1427,7 @@
dw Functioncd820
Functioncd817: ; cd817 (33:5817)
call BattleAnim_IncAnonJumptableIndex
- ld a, $35
+ ld a, BATTLEANIMFRAMESET_35
call ReinitBattleAnimFrameset
Functioncd81f: ; cd81f (33:581f)
ret
@@ -1477,18 +1485,18 @@
add hl, bc
ld [hl], a
bit 7, a
- jr nz, .asm_cd87e
+ jr nz, .load_no_inc
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
inc a
- jr .asm_cd883
+ jr .reinit
-.asm_cd87e
+.load_no_inc
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
-.asm_cd883
+.reinit
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -1800,14 +1808,14 @@
Functioncda4c: ; cda4c (33:5a4c)
ret
-BattleAnimFunction_20: ; cda4d (33:5a4d)
+BattleAnimFunction_LeechSeed: ; cda4d (33:5a4d)
call BattleAnim_AnonJumptable
.anon_dw
- dw Functioncda58
- dw Functioncda62
- dw Functioncda7a
- dw Functioncda8c
-Functioncda58: ; cda58 (33:5a58)
+ dw .zero
+ dw .one
+ dw .two
+ dw .three
+.zero: ; cda58 (33:5a58)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
@@ -1814,36 +1822,36 @@
ld [hl], $40
ret
-Functioncda62: ; cda62 (33:5a62)
+.one: ; cda62 (33:5a62)
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
cp $20
- jr c, .asm_cda6f
+ jr c, .sprout
call Functioncda8d
ret
-.asm_cda6f
+.sprout
ld [hl], $40
- ld a, $57
+ ld a, BATTLEANIMFRAMESET_57
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
-Functioncda7a: ; cda7a (33:5a7a)
+.two: ; cda7a (33:5a7a)
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
and a
- jr z, .asm_cda84
+ jr z, .flutter
dec [hl]
ret
-.asm_cda84
+.flutter
call BattleAnim_IncAnonJumptableIndex
- ld a, $58
+ ld a, BATTLEANIMFRAMESET_58
call ReinitBattleAnimFrameset
-Functioncda8c: ; cda8c (33:5a8c)
+.three: ; cda8c (33:5a8c)
ret
Functioncda8d: ; cda8d (33:5a8d)
@@ -2124,7 +2132,7 @@
ret
Functioncdc1e: ; cdc1e (33:5c1e)
- ld a, $4e
+ ld a, BATTLEANIMFRAMESET_4E
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ret
@@ -2143,7 +2151,7 @@
ret
Functioncdc39: ; cdc39 (33:5c39)
- ld a, $50
+ ld a, BATTLEANIMFRAMESET_50
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
@@ -2152,7 +2160,7 @@
ret
Functioncdc48: ; cdc48 (33:5c48)
- ld a, $4f
+ ld a, BATTLEANIMFRAMESET_4F
call ReinitBattleAnimFrameset
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
@@ -2258,7 +2266,7 @@
ld [hl], $8
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
- ld a, $59
+ ld a, BATTLEANIMFRAMESET_59
add [hl]
call ReinitBattleAnimFrameset
ret
@@ -2330,7 +2338,7 @@
and $80
rlca
ld [hl], a
- add $5d
+ add BATTLEANIMFRAMESET_5D
call ReinitBattleAnimFrameset
ret
@@ -2456,7 +2464,7 @@
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
- add $63
+ add BATTLEANIMFRAMESET_63
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -2540,7 +2548,7 @@
add hl, bc
set 6, [hl]
.asm_cde83
- add $6a
+ add BATTLEANIMFRAMESET_6A
call ReinitBattleAnimFrameset
Functioncde88: ; cde88 (33:5e88)
ret
@@ -2578,7 +2586,7 @@
xor $ff
inc a
ld [hl], a
- ld a, $6e
+ ld a, BATTLEANIMFRAMESET_6E
call ReinitBattleAnimFrameset
ret
@@ -2606,7 +2614,7 @@
ld [hl], a
ret
-BattleAnimFunction_29: ; cdedd (33:5edd)
+BattleAnimFunction_SpiralDescent: ; cdedd (33:5edd)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld a, [hl]
@@ -2639,11 +2647,11 @@
add hl, bc
ld a, [hl]
cp $28
- jr nc, .asm_cdf17
+ jr nc, .delete
inc [hl]
ret
-.asm_cdf17
+.delete
call DeinitBattleAnimation
ret
@@ -2688,17 +2696,17 @@
call DeinitBattleAnimation
ret
-BattleAnimFunction_2A: ; cdf59 (33:5f59)
+BattleAnimFunction_PoisonGas: ; cdf59 (33:5f59)
call BattleAnim_AnonJumptable
.anon_dw
dw Functioncdf60
- dw BattleAnimFunction_29
+ dw BattleAnimFunction_SpiralDescent
Functioncdf60: ; cdf60 (33:5f60)
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $84
- jr nc, .asm_cdf88
+ jr nc, .next
inc [hl]
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -2719,7 +2727,7 @@
dec [hl]
ret
-.asm_cdf88
+.next
call BattleAnim_IncAnonJumptableIndex
ret
@@ -2865,14 +2873,14 @@
call DeinitBattleAnimation
ret
-BattleAnimFunction_2B: ; ce063 (33:6063)
+BattleAnimFunction_Horn: ; ce063 (33:6063)
call BattleAnim_AnonJumptable
.anon_dw
- dw Functionce06e
- dw Functionce083
- dw Functionce091
+ dw .zero
+ dw .one
+ dw .two
dw Functionce09e
-Functionce06e: ; ce06e (33:606e)
+.zero: ; ce06e (33:606e)
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld a, [hl]
@@ -2887,7 +2895,7 @@
ld [hl], a
ret
-Functionce083: ; ce083 (33:6083)
+.one: ; ce083 (33:6083)
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
@@ -2897,7 +2905,7 @@
call Functionce70a
ret
-Functionce091: ; ce091 (33:6091)
+.two: ; ce091 (33:6091)
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld a, [hl]
@@ -3395,7 +3403,7 @@
add hl, bc
ld a, [hl]
and $7f
- add $81
+ add BATTLEANIMFRAMESET_81
call ReinitBattleAnimFrameset
Functionce375: ; ce375 (33:6375)
ld hl, BATTLEANIMSTRUCT_0B
@@ -3437,7 +3445,7 @@
.asm_ce3a6
call BattleAnim_IncAnonJumptableIndex
- ld a, $20
+ ld a, BATTLEANIMFRAMESET_20
call ReinitBattleAnimFrameset
Functionce3ae: ; ce3ae (33:63ae)
ld hl, BATTLEANIMSTRUCT_YOFFSET
@@ -3611,7 +3619,7 @@
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
- ld a, $24
+ ld a, BATTLEANIMFRAMESET_24
add [hl]
call ReinitBattleAnimFrameset
Functionce4b0: ; ce4b0 (33:64b0)
@@ -3832,13 +3840,14 @@
add hl, bc
ld a, [hl]
cp $d0
- jr z, .asm_ce5ea
-rept 4
+ jr z, .disappear
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
+ dec [hl]
ret
-.asm_ce5ea
+.disappear
call DeinitBattleAnimation
ret
@@ -3865,9 +3874,10 @@
ld a, [hl]
cp $4
jr z, Functionce618
-rept 4
inc [hl]
-endr
+ inc [hl]
+ inc [hl]
+ inc [hl]
ret
Functionce618: ; ce618 (33:6618)
@@ -3883,9 +3893,10 @@
ld a, [hl]
cp $d8
ret z
-rept 4
dec [hl]
-endr
+ dec [hl]
+ dec [hl]
+ dec [hl]
ret
BattleAnimFunction_4A: ; ce62f (33:662f)
@@ -4085,6 +4096,7 @@
BattleAnim_Cosine: ; ce732 (33:6732)
add $10
BattleAnim_Sine: ; ce734 (33:6734)
+; a = d sin a
and $3f
cp $20
jr nc, .negative
--- a/constants/animation_constants.asm
+++ b/constants/animation_constants.asm
@@ -43,23 +43,23 @@
const ANIM_OBJ_0E
const ANIM_OBJ_0F
const ANIM_OBJ_BURNED
- const ANIM_OBJ_11
+ const ANIM_OBJ_BLIZZARD
const ANIM_OBJ_12
- const ANIM_OBJ_13
- const ANIM_OBJ_14
+ const ANIM_OBJ_ICE_BEAM
+ const ANIM_OBJ_RAZOR_LEAF
const ANIM_OBJ_POKE_BALL
- const ANIM_OBJ_16
+ const ANIM_OBJ_POKE_BALL_BLOCKED
const ANIM_OBJ_17
const ANIM_OBJ_18
const ANIM_OBJ_19
const ANIM_OBJ_1A
const ANIM_OBJ_1B
- const ANIM_OBJ_1C
+ const ANIM_OBJ_BALL_POOF
const ANIM_OBJ_1D
const ANIM_OBJ_1E
const ANIM_OBJ_1F
const ANIM_OBJ_20
- const ANIM_OBJ_21
+ const ANIM_OBJ_BUBBLE
const ANIM_OBJ_22
const ANIM_OBJ_23
const ANIM_OBJ_24
@@ -67,9 +67,9 @@
const ANIM_OBJ_26
const ANIM_OBJ_27
const ANIM_OBJ_28
- const ANIM_OBJ_29
+ const ANIM_OBJ_ICE_BUILDUP
const ANIM_OBJ_FROZEN
- const ANIM_OBJ_2B
+ const ANIM_OBJ_MASTER_BALL_SPARKLE
const ANIM_OBJ_2C
const ANIM_OBJ_2D
const ANIM_OBJ_2E
@@ -95,12 +95,12 @@
const ANIM_OBJ_42
const ANIM_OBJ_43
const ANIM_OBJ_44
- const ANIM_OBJ_45
+ const ANIM_OBJ_ABSORB
const ANIM_OBJ_46
const ANIM_OBJ_47
const ANIM_OBJ_48
const ANIM_OBJ_49
- const ANIM_OBJ_4A
+ const ANIM_OBJ_LEECH_SEED
const ANIM_OBJ_4B
const ANIM_OBJ_4C
const ANIM_OBJ_4D
@@ -117,11 +117,11 @@
const ANIM_OBJ_58
const ANIM_OBJ_PARALYZED
const ANIM_OBJ_5A
- const ANIM_OBJ_5B
- const ANIM_OBJ_5C
- const ANIM_OBJ_5D
- const ANIM_OBJ_5E
- const ANIM_OBJ_5F
+ const ANIM_OBJ_HAZE
+ const ANIM_OBJ_MIST
+ const ANIM_OBJ_SMOG
+ const ANIM_OBJ_POISON_GAS
+ const ANIM_OBJ_HORN
const ANIM_OBJ_60
const ANIM_OBJ_61
const ANIM_OBJ_62
@@ -138,7 +138,7 @@
const ANIM_OBJ_6D
const ANIM_OBJ_SKY_ATTACK_FEAROW
const ANIM_OBJ_LICK
- const ANIM_OBJ_70
+ const ANIM_OBJ_WITHDRAW
const ANIM_OBJ_71
const ANIM_OBJ_72
const ANIM_OBJ_73
@@ -155,7 +155,7 @@
const ANIM_OBJ_HEART
const ANIM_OBJ_7F
const ANIM_OBJ_80
- const ANIM_OBJ_81
+ const ANIM_OBJ_COTTON_SPORE
const ANIM_OBJ_82
const ANIM_OBJ_83
const ANIM_OBJ_84
@@ -227,7 +227,7 @@
const BATTLEANIMFUNC_08
const BATTLEANIMFUNC_09
const BATTLEANIMFUNC_0A
- const BATTLEANIMFUNC_0B
+ const BATTLEANIMFUNC_RAZOR_LEAF
const BATTLEANIMFUNC_0C
const BATTLEANIMFUNC_0D
const BATTLEANIMFUNC_0E
@@ -248,7 +248,7 @@
const BATTLEANIMFUNC_1D
const BATTLEANIMFUNC_1E
const BATTLEANIMFUNC_1F
- const BATTLEANIMFUNC_20
+ const BATTLEANIMFUNC_LEECH_SEED
const BATTLEANIMFUNC_21
const BATTLEANIMFUNC_22
const BATTLEANIMFUNC_23
@@ -257,9 +257,9 @@
const BATTLEANIMFUNC_26
const BATTLEANIMFUNC_27
const BATTLEANIMFUNC_28
- const BATTLEANIMFUNC_29
- const BATTLEANIMFUNC_2A
- const BATTLEANIMFUNC_2B
+ const BATTLEANIMFUNC_SPRIAL_DESCENT
+ const BATTLEANIMFUNC_POISON_GAS
+ const BATTLEANIMFUNC_HORN
const BATTLEANIMFUNC_2C
const BATTLEANIMFUNC_2D
const BATTLEANIMFUNC_2E
@@ -735,7 +735,7 @@
const ANIM_BG_1E
const ANIM_BG_1F
const ANIM_BG_20
- const ANIM_BG_21
+ const ANIM_BG_WITHDRAW
const ANIM_BG_BOUNCE_DOWN
const ANIM_BG_DIG
const ANIM_BG_TACKLE
--- a/engine/battle_start.asm
+++ b/engine/battle_start.asm
@@ -40,8 +40,8 @@
call DelayFrame
xor a
ld [hFFC6], a
- ld [hFFC7], a
- ld [hFFC8], a
+ ld [hLYOverrideStart], a
+ ld [hLYOverrideEnd], a
ld [hSCY], a
ld a, $1
@@ -305,9 +305,9 @@
ld a, $43
ld [hFFC6], a
xor a
- ld [hFFC7], a
+ ld [hLYOverrideStart], a
ld a, $90
- ld [hFFC8], a
+ ld [hLYOverrideEnd], a
xor a
ld [wcf64], a
ld [wcf65], a
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -138,6 +138,7 @@
; Unreferenced
call CheckCGB
ret z
+; CGB only
ld hl, .BGPal
ld de, UnknBGPals
ld bc, 1 palettes
@@ -534,9 +535,9 @@
GetPredefPal:
ld l, a
ld h, $0
-rept 3 ; multiply by 8
add hl, hl
-endr
+ add hl, hl
+ add hl, hl
ld bc, Palettes_9df6
add hl, bc
ret
@@ -924,9 +925,10 @@
jr nz, .loop
ret
-Function9853:
+InitSGBBorder:
call CheckCGB
ret nz
+; SGB/DMG only
di
ld a, [wcfbe]
push af
@@ -936,7 +938,7 @@
ld [rJOYP], a
ld [hSGB], a
call Function994a
- jr nc, .asm_988a
+ jr nc, .skip
ld a, $1
ld [hSGB], a
call Function98eb
@@ -949,15 +951,16 @@
ld hl, PalPacket_9d66
call PushSGBPals
-.asm_988a
+.skip
pop af
ld [wcfbe], a
ei
ret
-Function9890::
+InitCGBPals::
call CheckCGB
ret z
+; CGB only
ld a, $1
ld [rVBK], a
ld hl, VTiles0
@@ -1123,7 +1126,7 @@
Function99b4:
call DisableLCD
- ld a, $e4
+ ld a, %11100100
ld [rBGP], a
ld hl, Palettes_9df6
ld de, VTiles1
@@ -1198,6 +1201,7 @@
CopyData: ; 0x9a52
; copy bc bytes of data from hl to de
+.loop
ld a, [hli]
ld [de], a
inc de
@@ -1204,12 +1208,13 @@
dec bc
ld a, c
or b
- jr nz, CopyData
+ jr nz, .loop
ret
; 0x9a5b
ClearBytes: ; 0x9a5b
; clear bc bytes of data starting from de
+.loop
xor a
ld [de], a
inc de
@@ -1216,7 +1221,7 @@
dec bc
ld a, c
or b
- jr nz, ClearBytes
+ jr nz, .loop
ret
; 0x9a64
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -431,10 +431,12 @@
ld bc, NAME_LENGTH
call CopyBytes
call ReturnToMapFromSubmenu
- ld a, [wc2d7]
+
+ ; LET'S DO THIS
+ ld a, [wDisableTextAcceleration]
push af
- ld a, $1
- ld [wc2d7], a
+ ld a, 1
+ ld [wDisableTextAcceleration], a
ld a, [rIE]
push af
ld a, [rIF]
@@ -446,7 +448,9 @@
ld [rIE], a
pop af
ld [rIF], a
+
predef StartBattle
+
ld a, [rIF]
ld h, a
xor a
@@ -456,7 +460,7 @@
ld a, h
ld [rIF], a
pop af
- ld [wc2d7], a
+ ld [wDisableTextAcceleration], a
pop af
ld [Options], a
callba LoadPokemonData
--- a/engine/main_menu.asm
+++ b/engine/main_menu.asm
@@ -4,7 +4,7 @@
MainMenu: ; 49cdc
xor a
- ld [wc2d7], a
+ ld [wDisableTextAcceleration], a
call Function49ed0
ld b, SCGB_08
call GetSGBLayout
--- a/engine/map_setup.asm
+++ b/engine/map_setup.asm
@@ -289,7 +289,7 @@
DontScrollText: ; 154ca
xor a
- ld [wc2d7], a
+ ld [wDisableTextAcceleration], a
ret
; 154cf
--- a/engine/predef.asm
+++ b/engine/predef.asm
@@ -78,7 +78,7 @@
add_predef GetUnownLetter
add_predef LoadPoisonBGPals
add_predef Predef2F
- add_predef Function9853 ; $30
+ add_predef InitSGBBorder ; $30
add_predef Predef_LoadSGBLayout
add_predef _Area
add_predef CheckContestMon
--- a/event/magnet_train.asm
+++ b/event/magnet_train.asm
@@ -62,8 +62,8 @@
call ClearBGPalettes
xor a
ld [hFFC6], a
- ld [hFFC7], a
- ld [hFFC8], a
+ ld [hLYOverrideStart], a
+ ld [hLYOverrideEnd], a
ld [hSCX], a
ld [Requested2bppSource], a
ld [Requested2bppSource + 1], a
--- a/home.asm
+++ b/home.asm
@@ -342,7 +342,7 @@
call GetJoypad
; input override
- ld a, [wc2d7]
+ ld a, [wDisableTextAcceleration]
and a
jr nz, .wait
--- a/home/init.asm
+++ b/home/init.asm
@@ -139,7 +139,7 @@
ld a, -1
ld [hLinkPlayerNumber], a
- callba Function9890
+ callba InitCGBPals
ld a, VBGMap1 / $100
ld [hBGMapAddress + 1], a
@@ -154,9 +154,9 @@
ld a, [hCGB]
and a
- jr z, .asm_22b
+ jr z, .no_double_speed
call NormalSpeed
-.asm_22b
+.no_double_speed
xor a
ld [rIF], a
@@ -166,7 +166,7 @@
call DelayFrame
- predef Function9853
+ predef InitSGBBorder ; SGB init
call MapSetup_Sound_Off
xor a
--- a/home/mobile.asm
+++ b/home/mobile.asm
@@ -6,7 +6,7 @@
ld [$c986], a
ld a, h
ld [$c987], a
- jr nz, .asm_3e4f
+ jr nz, .okay
ld [$c982], a
ld a, l
@@ -17,7 +17,7 @@
ld a, b
ld [hl], a
-.asm_3e4f
+.okay
ld hl, $c822
set 6, [hl]
ld a, [hROMBank]
@@ -30,6 +30,7 @@
; 3e60
Function3e60:: ; 3e60
+; Return from Function110030
ld [$c986], a
ld a, l
ld [$c987], a
--- a/hram.asm
+++ b/hram.asm
@@ -78,8 +78,8 @@
hMoneyTemp EQU $ffc3
hFFC6 EQU $ffc6
-hFFC7 EQU $ffc7
-hFFC8 EQU $ffc8
+hLYOverrideStart EQU $ffc7
+hLYOverrideEnd EQU $ffc8
hMobileReceive EQU $ffc9
hFFCA EQU $ffca
hLinkPlayerNumber EQU $ffcb
--- a/lib/mobile/main.asm
+++ b/lib/mobile/main.asm
@@ -75,7 +75,7 @@
Function110030:: ; 110030 (44:4030)
; Use the byte at $c988 as a parameter
; for a dw.
-; If [$c988] in {12, 14, 16},
+; If [$c988] not in {12, 14, 16},
; clear [$c835].
push de
ld a, [$c988]
@@ -89,24 +89,29 @@
ld [$c835], a
ld a, [$c988]
.noreset
- ld d, $0
+ ; Get the pointer
+ ld d, 0
ld e, a
ld hl, .dw
add hl, de
+ ; Store the low byte in [$c988]
ld a, [hli]
ld [$c988], a
ld a, [hl]
+ ; restore de
pop de
- ld hl, Function3e60
+ ld hl, Function3e60 ; return here
push hl
+ ; If the destination function is not Function110236,
+ ; call Function1100b4.
ld h, a
ld a, [$c988]
ld l, a
push hl
- ld a, $36
+ ld a, Function110236 % $100
cp l
jr nz, .okay
- ld a, $42
+ ld a, Function110236 / $100
cp h
.okay
call nz, Function1100b4
--- a/macros/move_anim.asm
+++ b/macros/move_anim.asm
@@ -183,9 +183,9 @@
db anim_0xed_command
endm
- enum anim_jumpand_command ; ee
-anim_jumpand: macro
- db anim_jumpand_command
+ enum anim_if_param_and_command ; ee
+anim_if_param_and: macro
+ db anim_if_param_and_command
db \1 ; value
dw \2 ; address
endm
@@ -243,9 +243,9 @@
db anim_0xf7_command
endm
- enum anim_jumpif_command ; f8
-anim_jumpif: macro
- db anim_jumpif_command
+ enum anim_if_param_equal_command ; f8
+anim_if_param_equal: macro
+ db anim_if_param_equal_command
db \1 ; value
dw \2 ; address
endm
@@ -261,9 +261,9 @@
db anim_incvar_command
endm
- enum anim_jumpvar_command ; fb
-anim_jumpvar: macro
- db anim_jumpvar_command
+ enum anim_if_var_equal_command ; fb
+anim_if_var_equal: macro
+ db anim_if_var_equal_command
db \1 ; value
dw \2 ; address
endm
--- a/main.asm
+++ b/main.asm
@@ -3367,14 +3367,14 @@
ld [rSVBK], a
ret
-Function4e929: ; mobile function
+GetMobileOTTrainerClass: ; mobile function
ld h, b
ld l, c
- call Function4e930
+ call .GetMobileOTTrainerClass
ld c, a
ret
-Function4e930: ; 4e930
+.GetMobileOTTrainerClass: ; 4e930
ld a, [hli]
xor [hl]
ld c, a
--- a/misc/battle_tower_5c.asm
+++ b/misc/battle_tower_5c.asm
@@ -111,7 +111,7 @@
call CopyBytes
ld bc, PlayerID
ld de, PlayerGender
- callba Function4e929
+ callba GetMobileOTTrainerClass
ld de, wBT_OTTempPkmn1CaughtGender
ld a, c
ld [de], a
--- a/misc/fixed_words.asm
+++ b/misc/fixed_words.asm
@@ -941,7 +941,7 @@
call Function11cfb5
Function11c675: ; 11c675 (47:4675)
- ld hl, wcd25
+ ld hl, wMobileCommsJumptableIndex
ld de, hJoypadPressed ; $ffa3
ld a, [de]
and A_BUTTON
@@ -975,7 +975,7 @@
ld [wcd26], a
ld a, [hl]
ld b, a
- ld hl, wcd25
+ ld hl, wMobileCommsJumptableIndex
ld a, [wcd26]
add [hl]
jr c, .asm_11c6b9
@@ -986,7 +986,7 @@
ld hl, wcd26
sub [hl]
dec a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
.asm_11c6c4
call Function11c992
call Function11c7bc
@@ -1101,7 +1101,7 @@
Function11c770: ; 11c770 (47:4770)
xor a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld [wcd26], a
ld [wcd27], a
ld a, [wcd2b]
@@ -1390,7 +1390,7 @@
and a
jr z, .asm_11c927
ld hl, wcd26
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
add [hl]
.asm_11c911
ld e, a
@@ -1412,7 +1412,7 @@
.asm_11c927
ld hl, wcd26
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
add [hl]
ld c, a
ld b, $0
@@ -1438,7 +1438,7 @@
ld d, $0
add hl, de
add hl, de
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
ld e, a
add hl, de
add hl, de
@@ -2554,7 +2554,7 @@
.three ; 11d10f (47:510f)
ld a, SPRITE_ANIM_FRAMESET_27
call ReinitSpriteAnimFrame
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
sla a
ld hl, Unknown_11d29e
ld e, $8
--- a/misc/mobile_22.asm
+++ b/misc/mobile_22.asm
@@ -769,7 +769,7 @@
add hl, bc
ld b, h
ld c, l
- callba Function4e929
+ callba GetMobileOTTrainerClass
ld a, c
ld [TrainerClass], a
ld a, [rSVBK]
@@ -1214,7 +1214,7 @@
add hl, bc
ld b, h
ld c, l
- callba Function4e929
+ callba GetMobileOTTrainerClass
ld a, c
ld [TrainerClass], a
xor a
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -4,7 +4,7 @@
; bc: addr
ld a, [rSVBK]
push af
- ld a, $01
+ ld a, 1
ld [rSVBK], a
call Function100022
@@ -26,7 +26,7 @@
Function100022: ; 100022
push de
push bc
- call Function100063
+ call SetRAMStateForMobile
pop bc
pop de
ld a, d
@@ -47,7 +47,7 @@
; 100057
Function100057: ; 100057
- call Function1000a4
+ call DisableMobile
call ReturnToMapFromSubmenu
ld hl, VramState
res 1, [hl]
@@ -54,7 +54,7 @@
ret
; 100063
-Function100063: ; 100063
+SetRAMStateForMobile: ; 100063
xor a
ld hl, BGMapBuffer
ld bc, $65
@@ -71,11 +71,12 @@
ret
; 100082
-Function100082: ; 100082
+EnableMobile: ; 100082
xor a
ld hl, OverworldMap
ld bc, OverworldMapEnd - OverworldMap
call ByteFill
+
di
call DoubleSpeed
xor a
@@ -89,10 +90,11 @@
ld [hMobileReceive], a
ld [hMobile], a
ei
+
ret
; 0x1000a4
-Function1000a4: ; 1000a4
+DisableMobile: ; 1000a4
di
xor a
ld [hMobileReceive], a
@@ -110,12 +112,12 @@
Function1000ba: ; 1000ba
.loop
- ; call [wcd22]:([wcd23][wcd24] + [wcd25])
+ ; call [wcd22]:([wcd23][wcd24] + [wMobileCommsJumptableIndex])
ld hl, wcd23
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
ld e, a
ld d, 0
add hl, de
@@ -984,18 +986,18 @@
db "まつ@"
; 10060d
-Function10060d: ; 10060d
+Mobile_CommunicationStandby: ; 10060d
hlcoord 3, 10
- ld b, $01
- ld c, $0b
+ ld b, 1
+ ld c, 11
call Function3eea
- ld de, String_100621
+ ld de, .String
hlcoord 4, 11
call PlaceString
ret
; 100621
-String_100621: ; 100621
+.String: ; 100621
db "つうしんたいきちゅう!@"
; 10062d
@@ -2641,53 +2643,55 @@
ret
; 1010f2
-Function1010f2: ; 1010f2
+LoadSelectedPartiesForColosseum: ; 1010f2
xor a
ld hl, StringBuffer2
ld bc, 9
call ByteFill
- ld hl, wdc5c
+ ld hl, wPlayerMonSelection
ld de, PartyCount
- call Function101145
- ld hl, wdc5c
+ call .CopyThreeSpecies
+ ld hl, wPlayerMonSelection
ld de, PartyMon1Species
- call Function10117c
- ld hl, wdc5c
+ call .CopyPartyStruct
+ ld hl, wPlayerMonSelection
ld de, PartyMonOT
- call Function101181
- ld hl, wdc5c
+ call .CopyName
+ ld hl, wPlayerMonSelection
ld de, PartyMonNicknames
- call Function101181
- ld hl, wcd75
+ call .CopyName
+ ld hl, wOTMonSelection
ld de, OTPartyCount
- call Function101145
- ld hl, wcd75
+ call .CopyThreeSpecies
+ ld hl, wOTMonSelection
ld de, OTPartyMon1Species
- call Function10117c
- ld hl, wcd75
+ call .CopyPartyStruct
+ ld hl, wOTMonSelection
ld de, OTPartyMonOT
- call Function101181
- ld hl, wcd75
+ call .CopyName
+ ld hl, wOTMonSelection
ld de, OTPartyMonNicknames
- call Function101181
+ call .CopyName
ret
; 101145
-Function101145: ; 101145
+.CopyThreeSpecies: ; 101145
+; Load the 3 choices to the buffer
push de
ld bc, StringBuffer2 + 6
xor a
-.asm_10114a
+.party_loop
push af
- call Function101168
+ call .GetNthSpecies
ld [bc], a
inc bc
pop af
inc a
- cp $03
- jr nz, .asm_10114a
+ cp 3
+ jr nz, .party_loop
pop de
- ld a, $03
+; Copy the 3 choices to the party
+ ld a, 3
ld [de], a
inc de
ld hl, StringBuffer2 + 6
@@ -2698,7 +2702,9 @@
ret
; 101168
-Function101168: ; 101168
+.GetNthSpecies: ; 101168
+; Preserves hl and de
+; Get the index of the Nth selection
push hl
add l
ld l, a
@@ -2707,6 +2713,7 @@
ld h, a
ld a, [hl]
pop hl
+; Get the corresponding species
push de
inc de
add e
@@ -2719,34 +2726,38 @@
ret
; 10117c
-Function10117c: ; 10117c
- ld bc, $30
- jr asm_101184
+.CopyPartyStruct: ; 10117c
+ ld bc, PARTYMON_STRUCT_LENGTH
+ jr .ContinueCopy
-Function101181: ; 101181
- ld bc, 11
+.CopyName: ; 101181
+ ld bc, NAME_LENGTH
-asm_101184:
+.ContinueCopy:
+ ; Copy, via wc608...
ld a, wc608 % $100
ld [StringBuffer2], a
ld a, wc608 / $100
ld [StringBuffer2 + 1], a
+ ; ... bc bytes...
ld a, c
ld [StringBuffer2 + 2], a
ld a, b
ld [StringBuffer2 + 3], a
+ ; ... to de...
ld a, e
ld [StringBuffer2 + 4], a
ld a, d
ld [StringBuffer2 + 5], a
- ld a, $03
-.asm_1011a0
+ ; ... 3 times.
+ ld a, 3
+.big_copy_loop
push af
ld a, [hli]
push hl
push af
- call Function1011df
- call Function1011e8
+ call .GetDestinationAddress
+ call .GetCopySize
pop af
call AddNTimes
ld a, [StringBuffer2]
@@ -2761,14 +2772,14 @@
pop hl
pop af
dec a
- jr nz, .asm_1011a0
- call Function1011e8
+ jr nz, .big_copy_loop
+ call .GetCopySize
ld a, 3
ld hl, 0
call AddNTimes
ld b, h
ld c, l
- call Function1011df
+ call .GetDestinationAddress
ld d, h
ld e, l
ld hl, wc608
@@ -2776,7 +2787,7 @@
ret
; 1011df
-Function1011df: ; 1011df
+.GetDestinationAddress: ; 1011df
ld a, [StringBuffer2 + 4]
ld l, a
ld a, [StringBuffer2 + 5]
@@ -2784,7 +2795,7 @@
ret
; 1011e8
-Function1011e8: ; 1011e8
+.GetCopySize: ; 1011e8
ld a, [StringBuffer2 + 2]
ld c, a
ld a, [StringBuffer2 + 3]
@@ -2889,146 +2900,144 @@
Function10127e: ; 10127e
ld a, [wdc5f]
and a
- jr z, .asm_101290
- cp $01
+ jr z, .zero
+ cp 1
ld c, $27
- jr z, .asm_101292
- cp $02
+ jr z, .load
+ cp 2
ld c, $37
- jr z, .asm_101292
-
-.asm_101290
+ jr z, .load
+.zero
ld c, 0
-
-.asm_101292
+.load
ld a, c
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101297
Jumptable_101297: ; 101297
- dw Function101a97
- dw Function101ab4
- dw Function101475
- dw Function101b0f
- dw Function101438
- dw Function101b2b
- dw Function101b59
- dw Function101475
- dw Function101b70
- dw Function101438
- dw Function101b8f
- dw Function101d7b
- dw Function101d95
- dw Function101475
- dw Function101db2
- dw Function101e4f
- dw Function101475
- dw Function101e64
- dw Function101e4f
- dw Function101475
- dw Function101e64
- dw Function101d95
- dw Function101475
- dw Function101db2
- dw Function101dd0
- dw Function101de3
- dw Function101e39
- dw Function101e09
- dw Function101e4f
- dw Function101475
- dw Function101e64
- dw Function101d95
- dw Function101475
- dw Function101db2
- dw Function101e09
- dw Function101e31
- dw Function101bc8
- dw Function101438
- dw Function101be5
- dw Function101ac6
- dw Function101ab4
- dw Function101475
- dw Function101c11
- dw Function1014f4
- dw Function101cc8
- dw Function1014e2
- dw Function1014e2
- dw Function101d10
- dw Function101d2a
- dw Function101d2a
- dw Function101507
- dw Function10156d
- dw Function101557
- dw Function10158a
- dw Function101c42
- dw Function101aed
- dw Function101ab4
- dw Function101475
- dw Function101c2b
- dw Function1014f4
- dw Function101cdf
- dw Function1014e2
- dw Function1014e2
- dw Function101d1e
- dw Function101d2a
- dw Function101d2a
- dw Function101507
- dw Function10156d
- dw Function101544
- dw Function10158a
- dw Function101c42
- dw Function101c50
- dw Function1014ce
- dw Function101cf6
- dw Function101826
- dw Function1017e4
- dw Function1017f1
- dw Function1018a8
- dw Function1018d6
- dw Function1017e4
- dw Function1017f1
- dw Function1018e1
- dw Function1015df
- dw Function10167d
- dw Function10168a
- dw Function10162a
- dw Function1015be
- dw Function10167d
- dw Function10168a
- dw Function10161f
- dw Function10159d
- dw Function10167d
- dw Function10168a
- dw Function101600
- dw Function101d03
- dw Function101d6b
- dw Function10159d
- dw Function1014ce
- dw Function10168e
- dw Function101600
- dw Function101913
- dw Function10194b
- dw Function10196d
- dw Function1017e4
- dw Function1017f5
- dw Function1019ab
- dw Function101537
- dw Function101571
- dw Function101c92
- dw Function10152a
- dw Function101571
- dw Function101a4f
- dw Function101cbc
- dw Function101c62
- dw Function101537
- dw Function101571
- dw Function101c92
- dw Function10152a
- dw Function101571
- dw Function101ca0
- dw Function101475
- dw Function101cbc
+ dw Function101a97 ; 00
+ dw Function101ab4 ; 01
+ dw Function101475 ; 02
+ dw Function101b0f ; 03
+ dw Function101438 ; 04
+ dw Function101b2b ; 05
+ dw Function101b59 ; 06
+ dw Function101475 ; 07
+ dw Function101b70 ; 08
+ dw Function101438 ; 09
+ dw Function101b8f ; 0a
+ dw Function101d7b ; 0b
+ dw Function101d95 ; 0c
+ dw Function101475 ; 0d
+ dw Function101db2 ; 0e
+ dw Function101e4f ; 0f
+ dw Function101475 ; 10
+ dw Function101e64 ; 11
+ dw Function101e4f ; 12
+ dw Function101475 ; 13
+ dw Function101e64 ; 14
+ dw Function101d95 ; 15
+ dw Function101475 ; 16
+ dw Function101db2 ; 17
+ dw Function101dd0 ; 18
+ dw Function101de3 ; 19
+ dw Function101e39 ; 1a
+ dw Function101e09 ; 1b
+ dw Function101e4f ; 1c
+ dw Function101475 ; 1d
+ dw Function101e64 ; 1e
+ dw Function101d95 ; 1f
+ dw Function101475 ; 20
+ dw Function101db2 ; 21
+ dw Function101e09 ; 22
+ dw Function101e31 ; 23
+ dw Function101bc8 ; 24
+ dw Function101438 ; 25
+ dw Function101be5 ; 26
+ dw Function101ac6 ; 27
+ dw Function101ab4 ; 28
+ dw Function101475 ; 29
+ dw Function101c11 ; 2a
+ dw Function1014f4 ; 2b
+ dw Function101cc8 ; 2c
+ dw Function1014e2 ; 2d
+ dw Function1014e2 ; 2e
+ dw Function101d10 ; 2f
+ dw Function101d2a ; 30
+ dw Function101d2a ; 31
+ dw Function101507 ; 32
+ dw Function10156d ; 33
+ dw Function101557 ; 34
+ dw Function10158a ; 35
+ dw Function101c42 ; 36
+ dw Function101aed ; 37
+ dw Function101ab4 ; 38
+ dw Function101475 ; 39
+ dw Function101c2b ; 3a
+ dw Function1014f4 ; 3b
+ dw Function101cdf ; 3c
+ dw Function1014e2 ; 3d
+ dw Function1014e2 ; 3e
+ dw Function101d1e ; 3f
+ dw Function101d2a ; 40
+ dw Function101d2a ; 41
+ dw Function101507 ; 42
+ dw Function10156d ; 43
+ dw Function101544 ; 44
+ dw Function10158a ; 45
+ dw Function101c42 ; 46
+ dw Function101c50 ; 47
+ dw Function1014ce ; 48
+ dw Function101cf6 ; 49
+ dw Function101826 ; 4a
+ dw Function1017e4 ; 4b
+ dw Function1017f1 ; 4c
+ dw Function1018a8 ; 4d
+ dw Function1018d6 ; 4e
+ dw Function1017e4 ; 4f
+ dw Function1017f1 ; 50
+ dw Function1018e1 ; 51
+ dw Function1015df ; 52
+ dw Function10167d ; 53
+ dw Function10168a ; 54
+ dw Function10162a ; 55
+ dw Function1015be ; 56
+ dw Function10167d ; 57
+ dw Function10168a ; 58
+ dw Function10161f ; 59
+ dw Function10159d ; 5a
+ dw Function10167d ; 5b
+ dw Function10168a ; 5c
+ dw Function101600 ; 5d
+ dw Function101d03 ; 5e
+ dw Function101d6b ; 5f
+ dw Function10159d ; 60
+ dw Function1014ce ; 61
+ dw Function10168e ; 62
+ dw Function101600 ; 63
+ dw Function101913 ; 64
+ dw Function10194b ; 65
+ dw _SelectMonsForMobileBattle ; 66
+ dw Function1017e4 ; 67
+ dw Function1017f5 ; 68
+ dw _StartMobileBattle ; 69
+ dw Function101537 ; 6a
+ dw Function101571 ; 6b
+ dw Function101c92 ; 6c
+ dw Function10152a ; 6d
+ dw Function101571 ; 6e
+ dw Function101a4f ; 6f
+ dw Function101cbc ; 70
+ dw Function101c62 ; 71
+ dw Function101537 ; 72
+ dw Function101571 ; 73
+ dw Function101c92 ; 74
+ dw Function10152a ; 75
+ dw Function101571 ; 76
+ dw Function101ca0 ; 77
+ dw Function101475 ; 78
+ dw Function101cbc ; 79
; 10138b
Function10138b: ; 10138b
@@ -3182,9 +3191,9 @@
ret z
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101457
@@ -3221,9 +3230,9 @@
ret z
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101494
@@ -3269,9 +3278,9 @@
Function1014ce: ; 1014ce
callba Function100720
callba Function100641
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1014e2
@@ -3280,19 +3289,19 @@
set 6, [hl]
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1014f4
Function1014f4: ; 1014f4
- callba Function100082
+ callba EnableMobile
ld hl, wcd29
set 6, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101507
@@ -3302,9 +3311,9 @@
ld bc, $40
ld a, $02
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10151d
@@ -3311,9 +3320,9 @@
Function10151d: ; 10151d ; unreferenced
ld a, $34
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10152a
@@ -3320,9 +3329,9 @@
Function10152a: ; 10152a
ld a, $36
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101537
@@ -3329,9 +3338,9 @@
Function101537: ; 101537
ld a, $0a
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101544
@@ -3339,9 +3348,9 @@
callba Function100641
ld a, $12
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101557
@@ -3350,9 +3359,9 @@
ld hl, wcd53
ld a, $08
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10156d
@@ -3371,9 +3380,9 @@
ret
.asm_101582
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10158a
@@ -3396,9 +3405,9 @@
call Function10174c
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1015be
@@ -3411,9 +3420,9 @@
call Function10174c
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1015df
@@ -3426,9 +3435,9 @@
call Function10174c
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101600
@@ -3440,25 +3449,25 @@
call FarCopyWRAM
ld de, wc608
callba Function100ee6
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10161f
Function10161f: ; 10161f
call Function101649
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10162a
Function10162a: ; 10162a
call Function101663
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101635
@@ -3513,9 +3522,9 @@
Function10167d: ; 10167d
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10168a
@@ -3542,9 +3551,9 @@
ret z
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1016c3
@@ -3746,9 +3755,9 @@
Function1017e4: ; 1017e4
ld a, 0
ld [wcd27], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1017f1
@@ -3768,15 +3777,15 @@
callba Function100382
ld a, [wcd27]
bit 7, a
- jr nz, .asm_10181e
+ jr nz, .next
ld hl, wcd29
set 6, [hl]
ret
-.asm_10181e
- ld a, [wcd25]
+.next
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101826
@@ -3792,9 +3801,9 @@
ld hl, Unknown_10186f
ld de, wccb4
call Function1013f5
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101844
@@ -3811,9 +3820,9 @@
.asm_10185b
ld de, wccb4
call Function1013f5
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101869
@@ -3857,9 +3866,9 @@
ld a, $06
call Function101406
jr c, .asm_1018ca
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_1018ca
@@ -3875,17 +3884,17 @@
Function1018d6: ; 1018d6
call Function1018ec
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1018e1
Function1018e1: ; 1018e1
call Function1018fb
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1018ec
@@ -3938,17 +3947,17 @@
cp $02
jr z, .asm_101945
ld a, $71
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_10193f
ld a, $66
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101945
ld a, $65
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10194b
@@ -3961,18 +3970,18 @@
jr nz, .asm_101967
call Function1013c0
ld a, $71
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101967
ld a, $60
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 10196d
-Function10196d: ; 10196d
+_SelectMonsForMobileBattle: ; 10196d
callba BlankScreen
- callba Function10060d
+ callba Mobile_CommunicationStandby
ld hl, wcd29
set 5, [hl]
ld hl, wcd2a
@@ -3979,7 +3988,7 @@
set 6, [hl]
ld a, $06
ld [wccb4], a
- ld hl, wdc5c
+ ld hl, wPlayerMonSelection
ld de, wccb5
ld bc, 3
call CopyBytes
@@ -3990,14 +3999,14 @@
ld [wccb9], a
ld a, [hl]
ld [wccba], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1019ab
-Function1019ab: ; 1019ab
- call Function101a75
+_StartMobileBattle: ; 1019ab
+ call CopyOtherPlayersBattleMonSelection
callba Function100754
xor a
ld [wdc5f], a
@@ -4005,33 +4014,32 @@
callba BlankScreen
call SpeechTextBox
callba Function100846
- ld c, $78
+ ld c, 120
call DelayFrames
callba ClearTileMap
- call Function1019ee
- call Function101a21
+ call .CopyOTDetails
+ call StartMobileBattle
ld a, [wcd2b]
cp $fc
jr nz, .asm_1019e6
xor a
ld [wcd2b], a
-
.asm_1019e6
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1019ee
-Function1019ee: ; 1019ee
+.CopyOTDetails: ; 1019ee
ld a, [rSVBK]
push af
- ld a, $05
+ ld a, 5
ld [rSVBK], a
ld bc, w5_dc0d
ld de, w5_dc11
- callba Function4e929
+ callba GetMobileOTTrainerClass
pop af
ld [rSVBK], a
@@ -4044,29 +4052,29 @@
call CopyBytes
ld a, [wcd2f]
and a
- ld a, $02
- jr z, .asm_101a1e
- ld a, $01
-
-.asm_101a1e
+ ld a, 2
+ jr z, .got_link_player_number
+ ld a, 1
+.got_link_player_number
ld [hLinkPlayerNumber], a
ret
; 101a21
-Function101a21: ; 101a21
+StartMobileBattle: ; 101a21
+ ; force stereo and fast text speed
ld hl, Options
ld a, [hl]
push af
- and $20
- or $01
+ and (1 << STEREO)
+ or 1 ; 1 frame per character i.e. fast text
ld [hl], a
- ld a, $01
- ld [wc2d7], a
+ ld a, 1
+ ld [wDisableTextAcceleration], a
callba BattleIntro
callba DoBattle
callba ShowLinkBattleParticipantsAfterEnd
xor a
- ld [wc2d7], a
+ ld [wDisableTextAcceleration], a
ld a, $ff
ld [hLinkPlayerNumber], a
pop af
@@ -4075,29 +4083,29 @@
; 101a4f
Function101a4f: ; 101a4f
- ld a, $01
- ld [wc2d7], a
+ ld a, 1
+ ld [wDisableTextAcceleration], a
callba DetermineMobileBattleResult
xor a
- ld [wc2d7], a
+ ld [wDisableTextAcceleration], a
callba CleanUpBattleRAM
callba LoadPokemonData
call Function1013c0
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101a75
-Function101a75: ; 101a75
+CopyOtherPlayersBattleMonSelection: ; 101a75
ld hl, wcc61
- ld de, wcd75
+ ld de, wOTMonSelection
ld bc, 3
call CopyBytes
ld de, wcc64
callba Function100772
callba Function101050
- callba Function1010f2
+ callba LoadSelectedPartiesForColosseum
ret
; 101a97
@@ -4109,9 +4117,9 @@
call Function10142c
ld hl, wcd29
set 6, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101ab4
@@ -4120,9 +4128,9 @@
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101ac6
@@ -4138,9 +4146,9 @@
ld [wcd2f], a
ld de, wdc42
call Function102068
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101aed
@@ -4154,9 +4162,9 @@
set 6, [hl]
ld a, $01
ld [wcd2f], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101b0f
@@ -4167,9 +4175,9 @@
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4193,9 +4201,9 @@
ret
.asm_101b51
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101b59
@@ -4206,9 +4214,9 @@
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101b70
@@ -4220,9 +4228,9 @@
ld hl, wcd29
set 5, [hl]
call UpdateSprites
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4243,17 +4251,17 @@
jr z, .asm_101bbc
ld a, $01
ld [wcd2f], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101bbc
xor a
ld [wcd2f], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101bc8
@@ -4266,9 +4274,9 @@
call Function1013dd
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101be5
@@ -4286,7 +4294,7 @@
cp $01
jr nz, .asm_101c0b
ld a, $2a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101c0b
@@ -4303,9 +4311,9 @@
call Function102048
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101c2b
@@ -4316,9 +4324,9 @@
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101c42
@@ -4327,7 +4335,7 @@
set 1, [hl]
call Function100665
ld a, $47
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101c50
@@ -4336,9 +4344,9 @@
call Function101ee4
ld hl, wcd29
set 2, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101c62
@@ -4356,9 +4364,9 @@
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4366,9 +4374,9 @@
Function101c92: ; 101c92
callba Function100675
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101ca0
@@ -4379,9 +4387,9 @@
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4406,9 +4414,9 @@
ld [wc30d], a
ld hl, wcd29
set 4, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101cdf
@@ -4419,9 +4427,9 @@
ld [wc30d], a
ld hl, wcd29
set 4, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101cf6
@@ -4428,9 +4436,9 @@
Function101cf6: ; 101cf6
ld a, $0b
ld [wc314 + 1], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101d03
@@ -4437,9 +4445,9 @@
Function101d03: ; 101d03
ld a, $0e
ld [wc314 + 1], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101d10
@@ -4446,17 +4454,17 @@
Function101d10: ; 101d10
ld c, $01
call Function10142c
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
jr Function101d2a
Function101d1e: ; 101d1e
ld c, $03
call Function10142c
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
Function101d2a: ; 101d2a
call Function101418
@@ -4471,9 +4479,9 @@
ret z
ld a, 0
ld [wcd26], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101d4d
@@ -4506,7 +4514,7 @@
ld hl, wcd29
res 4, [hl]
ld a, $64
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101d7b
@@ -4517,7 +4525,7 @@
add hl, bc
ld c, [hl]
ld a, c
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101d8d
@@ -4532,9 +4540,9 @@
call Function101ee4
ld hl, wcd29
set 5, [hl]
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4546,9 +4554,9 @@
ld hl, wcd29
set 5, [hl]
jr c, .asm_101dca
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101dca
@@ -4562,12 +4570,12 @@
bit 1, [hl]
jr nz, .asm_101ddd
ld a, $19
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101ddd
ld a, $1b
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101de3
@@ -4575,17 +4583,17 @@
call Function101ecc
call Function101ead
jr c, .asm_101df3
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101df3
call Function101e98
jr c, .asm_101e00
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101e00
@@ -4598,9 +4606,9 @@
Function101e09: ; 101e09
call Function101ead
jr c, .asm_101e16
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101e16
@@ -4610,9 +4618,9 @@
call Function101ed3
pop af
jr c, .asm_101e2b
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101e2b
@@ -4623,7 +4631,7 @@
Function101e31: ; 101e31
ld a, $3a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
jp Function101c2b
; 101e39
@@ -4634,7 +4642,7 @@
pop af
jr c, .asm_101e49
ld a, $2a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101e49
@@ -4647,9 +4655,9 @@
ld e, $06
call Function101ee4
call Function1013d6
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ld a, 0
ld [wcd26], a
ret
@@ -4663,7 +4671,7 @@
pop af
jr c, .asm_101e77
ld a, $24
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_101e77
@@ -4676,17 +4684,17 @@
Function101e82: ; 101e82 ; unreferenced
call Function101ecc
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101e8d
Function101e8d: ; 101e8d ; unreferenced
call Function101ed3
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 101e98
@@ -8101,7 +8109,7 @@
ld a, $01
ld [wdc60], a
xor a
- ld hl, wdc5c
+ ld hl, wPlayerMonSelection
ld [hli], a
ld [hli], a
ld [hl], a
@@ -8112,7 +8120,7 @@
callba Function4a94e
jr c, .asm_103870
ld hl, wd002
- ld de, wdc5c
+ ld de, wPlayerMonSelection
ld bc, 3
call CopyBytes
xor a
--- a/misc/mobile_41.asm
+++ b/misc/mobile_41.asm
@@ -806,17 +806,17 @@
; 10635c
Function10635c: ; 10635c
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
bit 7, a
ret nz
- ld a, [wcd25]
- ld hl, Jumptable_10636a
+ ld a, [wMobileCommsJumptableIndex]
+ ld hl, .Jumptable
rst JumpTable
ret
; 10636a
-Jumptable_10636a: ; 10636a
- dw Function10637c
+.Jumptable: ; 10636a
+ dw .init
dw Function106392
dw Function1063cc
dw Function1063d8
@@ -827,15 +827,15 @@
dw Function106453
; 10637c
-Function10637c: ; 10637c
+.init: ; 10637c
ld de, wcd30
ld hl, $41
ld bc, $41
ld a, $40
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 106392
@@ -857,7 +857,7 @@
ld a, $b
ld [wcf64], a
ld a, $7
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_1063b4
@@ -864,15 +864,15 @@
ld a, $7
ld [wcf64], a
ld a, $7
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_1063bf
ld a, $1
ld [wcf64], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1063cc
@@ -879,17 +879,17 @@
Function1063cc: ; 1063cc
ld a, $78
ld [wcd42], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
Function1063d8: ; 1063d8
ld hl, wcd42
dec [hl]
ret nz
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1063e5
@@ -897,9 +897,9 @@
ld a, [wcf64]
cp $3
ret nz
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 1063f3
@@ -907,9 +907,9 @@
ld de, wcd31
ld a, $32
call Function3e32
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 106403
@@ -930,9 +930,9 @@
inc a
ld c, a
call MobileFn_106314
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_106426
@@ -940,17 +940,17 @@
ld a, c
and a
jr z, .asm_106435
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
.asm_106435
ld c, $0
call MobileFn_106314
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
ret
; 106442
@@ -960,14 +960,14 @@
xor a
ld [hMobile], a
ld [hMobileReceive], a
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
inc a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
Function106453: ; 106453
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
set 7, a
- ld [wcd25], a
+ ld [wMobileCommsJumptableIndex], a
nop
ld a, $4
ld [wcf64], a
--- a/misc/mobile_5b.asm
+++ b/misc/mobile_5b.asm
@@ -1,48 +1,56 @@
Function16c000: ; 16c000
+; unreferenced
+ ; Only for CGB
ld a, [hCGB]
and a
ret z
+ ; Only do this once per boot cycle
ld a, [hFFEA]
and a
ret z
+ ; Set some flag, preserving the old state
ld a, [wcfbe]
push af
set 7, a
ld [wcfbe], a
- call Function16c108
- callba Function100063
- callba Function100082
- call Function16c031
- callba Function1000a4
+ ; Do stuff
+ call MobileSystemSplashScreen_InitGFX ; Load GFX
+ callba SetRAMStateForMobile
+ callba EnableMobile
+ call .RunJumptable
+ callba DisableMobile
+ ; Prevent this routine from running again
+ ; until the next time the syatem is turned on
xor a
ld [hFFEA], a
+ ; Restore the flag state
pop af
ld [wcfbe], a
ret
; 16c031
-Function16c031: ; 16c031
+.RunJumptable: ; 16c031
xor a
ld [wJumptableIndex], a
ld [wcf64], a
ld [wd002], a
ld [wd003], a
-.asm_16c03e
+.loop
call DelayFrame
callba Function10635c
ld a, [wd002]
- ld hl, Jumptable_16c05c
+ ld hl, .Jumptable
rst JumpTable
call Function16cb2e
call Function16cbae
ld a, [wd002]
cp $ff
- jr nz, .asm_16c03e
+ jr nz, .loop
ret
; 16c05c
-Jumptable_16c05c: ; 16c05c
- dw Function16c074
+.Jumptable: ; 16c05c
+ dw .init
dw Function16c0ba
dw Function16c089
dw Function16c09e
@@ -53,10 +61,10 @@
dw Function16c0ca
dw Function16c0dc
dw Function16c0ec
- dw Function16c081
+ dw .quit
; 16c074
-Function16c074: ; 16c074
+.init ; 16c074
ld a, [wcf64]
and a
ret z
@@ -66,7 +74,7 @@
ret
; 16c081
-Function16c081: ; 16c081
+.quit ; 16c081
push af
ld a, $ff
ld [wd002], a
@@ -160,15 +168,15 @@
ret
; 16c108
-Function16c108: ; 16c108
+MobileSystemSplashScreen_InitGFX: ; 16c108
call DisableLCD
ld hl, VTiles2
- ld de, GFX_16c173
- lb bc, BANK(GFX_16c173), $68
+ ld de, .Tiles
+ lb bc, BANK(.Tiles), $68
call Get2bpp
- call Function16c130
- call Function16c145
- call Function16c15c
+ call .LoadPals
+ call .LoadTileMap
+ call .LoadAttrMap
hlbgcoord 0, 0
call Function16cc73
call Function16cc02
@@ -178,9 +186,9 @@
ret
; 16c130
-Function16c130: ; 16c130
+.LoadPals: ; 16c130
ld de, UnknBGPals
- ld hl, Unknown_16c903
+ ld hl, UnknownMobilePalettes_16c903
ld bc, 8
ld a, $5
call FarCopyWRAM
@@ -188,12 +196,12 @@
ret
; 16c145
-Function16c145: ; 16c145
+.LoadTileMap: ; 16c145
hlcoord 0, 0
ld bc, 20
xor a
call ByteFill
- ld hl, Tilemap_16c633
+ ld hl, .TileMap
decoord 0, 1
ld bc, $0154
call CopyBytes
@@ -200,12 +208,12 @@
ret
; 16c15c
-Function16c15c: ; 16c15c
+.LoadAttrMap: ; 16c15c
hlcoord 0, 0, AttrMap
ld bc, SCREEN_WIDTH
xor a
call ByteFill
- ld hl, Tilemap_16c79b
+ ld hl, .AttrMap
decoord 0, 1, AttrMap
ld bc, 17 * SCREEN_WIDTH
call CopyBytes
@@ -212,16 +220,16 @@
ret
; 16c173
-GFX_16c173:
+.Tiles:
INCBIN "gfx/unknown/16c173.2bpp"
-Tilemap_16c633:
+.TileMap:
INCBIN "gfx/unknown/16c633.tilemap"
-Tilemap_16c79b:
+.AttrMap:
INCBIN "gfx/unknown/16c79b.tilemap"
-Unknown_16c903:
+UnknownMobilePalettes_16c903: ; 16c903
RGB 31, 31, 31
RGB 04, 10, 20
RGB 16, 19, 25
@@ -287,7 +295,7 @@
ld e, $0
ld a, $0
.asm_16c969
- ld hl, Unknown_16c903
+ ld hl, UnknownMobilePalettes_16c903
call Function16cab6
call Function16cabb
ld d, a
@@ -310,7 +318,7 @@
call Function16cadc
.asm_16c991
- ld hl, Unknown_16c903
+ ld hl, UnknownMobilePalettes_16c903
call Function16cab6
call Function16cad8
ld d, a
@@ -333,7 +341,7 @@
call Function16cb08
.asm_16c9b9
- ld hl, Unknown_16c903
+ ld hl, UnknownMobilePalettes_16c903
call Function16cab6
call Function16cac4
ld d, a
--- a/misc/mobile_5f.asm
+++ b/misc/mobile_5f.asm
@@ -3224,7 +3224,7 @@
ld b, $0
add hl, bc
pop bc
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
.asm_17e48b
push af
push hl
@@ -3339,7 +3339,7 @@
ld c, a
ld b, $0
add hl, bc
- ld a, [wcd25]
+ ld a, [wMobileCommsJumptableIndex]
ld c, a
ld a, [wcd27]
call SimpleMultiply
--- a/wram.asm
+++ b/wram.asm
@@ -160,7 +160,7 @@
wc2d4:: ds 1
wc2d5:: ds 1
wLastDexEntry:: ds 1
-wc2d7:: ds 1
+wDisableTextAcceleration:: ds 1
wPreviousLandmark:: ds 1
wCurrentLandmark:: ds 1
wLandmarkSignTimer:: ds 2
@@ -1112,7 +1112,7 @@
wcd23:: ds 1
wcd24:: ds 1
-wcd25:: ds 1
+wMobileCommsJumptableIndex:: ds 1 ; cd25
wcd26:: ds 1
wcd27:: ds 1
wcd28:: ds 1
@@ -1200,8 +1200,8 @@
wcd72:: ds 1
wcd73:: ds 1
wcd74:: ds 1
-wcd75:: ds 2
-wcd77:: ds 1
+wOTMonSelection:: ds 2 ; ds 3
+wcd77:: ds 1
wcd78:: ds 1
wcd79:: ds 1
wcd7a:: ds 2
@@ -2693,7 +2693,7 @@
wKenjiBreakTimer:: ds 2 ; Kenji
wYanmaMapGroup:: ds 1 ; dc5a
wYanmaMapNumber:: ds 1
-wdc5c:: ds 3
+wPlayerMonSelection:: ds 3
wdc5f:: ds 1
wdc60:: ds 19
@@ -2923,7 +2923,7 @@
ds -$22
wBTChoiceOfLvlGroup::
-w3_d800:: ; ds BG_MAP__WIDTH * SCREEN_HEIGHT ($240)
+w3_d800:: ; ds BG_MAP_WIDTH * SCREEN_HEIGHT ($240)
ds $69
w3_d869:: ds $17
w3_d880:: ds 1
@@ -2964,7 +2964,7 @@
wMagnetTrainHoldPosition:: ds 1
wMagnetTrainFinalPosition:: ds 1
wMagnetTrainPlayerSpriteInitX:: ds 1
-ds 106
+ ds 106
LYOverridesBackup:: ; d200
ds SCREEN_HEIGHT_PX