ref: b9a74ff777ea9418a94616c3b5a26b932a66981c
parent: ae4fe08084f3c3c5775bc286bcc630f2c20af083
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Thu Oct 22 06:54:53 EDT 2020
Identify more sprite graphics and map object labels, and have consistent anonymous jumptable labels
--- a/engine/battle_anims/bg_effects.asm
+++ b/engine/battle_anims/bg_effects.asm
@@ -163,7 +163,7 @@
ld l, a
jp hl
-BattleBGEffects_IncrementJumptable:
+BattleBGEffects_IncAnonJumptableIndex:
ld hl, BG_EFFECT_STRUCT_JT_INDEX
add hl, bc
inc [hl]
@@ -342,13 +342,13 @@
call BattleBGEffects_AnonJumptable
.anon_dw
dw .zero
- dw BattleBGEffects_IncrementJumptable
- dw BattleBGEffects_IncrementJumptable
- dw BattleBGEffects_IncrementJumptable
+ dw BattleBGEffects_IncAnonJumptableIndex
+ dw BattleBGEffects_IncAnonJumptableIndex
+ dw BattleBGEffects_IncAnonJumptableIndex
dw .four
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
push bc
call BGEffect_CheckBattleTurn
jr nz, .player_side
@@ -408,9 +408,9 @@
.anon_dw
dw .zero
dw .one
- dw BattleBGEffects_IncrementJumptable
- dw BattleBGEffects_IncrementJumptable
- dw BattleBGEffects_IncrementJumptable
+ dw BattleBGEffects_IncAnonJumptableIndex
+ dw BattleBGEffects_IncAnonJumptableIndex
+ dw BattleBGEffects_IncAnonJumptableIndex
dw .five
.zero
@@ -422,7 +422,7 @@
ret
.not_flying_digging
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
push bc
call BGEffect_CheckBattleTurn
jr nz, .player_side
@@ -446,7 +446,7 @@
ret
.one
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
push bc
call BGEffect_CheckBattleTurn
jr nz, .player_side_2
@@ -475,9 +475,9 @@
.anon_dw
dw .zero
dw .one
- dw BattleBGEffects_IncrementJumptable
- dw BattleBGEffects_IncrementJumptable
- dw BattleBGEffects_IncrementJumptable
+ dw BattleBGEffects_IncAnonJumptableIndex
+ dw BattleBGEffects_IncAnonJumptableIndex
+ dw BattleBGEffects_IncAnonJumptableIndex
dw .five
.zero
@@ -489,7 +489,7 @@
ret
.not_flying_digging
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
push bc
call BGEffect_CheckBattleTurn
jr nz, .player_side
@@ -513,7 +513,7 @@
ret
.one
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
push bc
call BGEffect_CheckBattleTurn
jr nz, .player_side_2
@@ -547,12 +547,12 @@
.anon_dw
dw .zero
dw .one
- dw BattleBGEffects_IncrementJumptable
- dw BattleBGEffects_IncrementJumptable
+ dw BattleBGEffects_IncAnonJumptableIndex
+ dw BattleBGEffects_IncAnonJumptableIndex
dw .four
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BGEffect_CheckBattleTurn
ld [hl], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
@@ -619,7 +619,7 @@
ldh [hBGMapThird], a
ld a, $1
ldh [hBGMapMode], a
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
dec [hl]
@@ -708,8 +708,8 @@
call BattleBGEffects_AnonJumptable
.anon_dw
dw .zero
- dw BattleBGEffects_IncrementJumptable
- dw BattleBGEffects_IncrementJumptable
+ dw BattleBGEffects_IncAnonJumptableIndex
+ dw BattleBGEffects_IncAnonJumptableIndex
dw .restart
dw .end
@@ -735,7 +735,7 @@
jr z, .skip
call .PlaceGraphic
.skip
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
ld a, $1
ldh [hBGMapMode], a
ret
@@ -911,7 +911,7 @@
dw .two
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
lb de, 2, 2
call InitSurfWaves
@@ -977,7 +977,7 @@
dw .two
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCY)
ldh [hLCDCPointer], a
@@ -1052,7 +1052,7 @@
dw .two
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCX)
ldh [hLCDCPointer], a
@@ -1089,7 +1089,7 @@
dw .two
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
@@ -1113,7 +1113,7 @@
dw .two
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCY)
call BattleBGEffect_SetLCDStatCustoms1
@@ -1143,7 +1143,7 @@
dw .five
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
@@ -1176,7 +1176,7 @@
ret
.next
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
ret
.two
@@ -1234,7 +1234,7 @@
dw .two
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCY)
call BattleBGEffect_SetLCDStatCustoms1
@@ -1296,7 +1296,7 @@
dw .two
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCY)
call BattleBGEffect_SetLCDStatCustoms1
@@ -1345,7 +1345,7 @@
dw .three
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCY)
call BattleBGEffect_SetLCDStatCustoms1
@@ -1371,7 +1371,7 @@
.next
ld [hl], $10
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
.two
ldh a, [hLYOverrideStart]
ld l, a
@@ -1414,7 +1414,7 @@
; Prepares mon to move forward (player moves right, enemy moves left)
; BG_EFFECT_STRUCT_03 will keep track of distance moved, so it's reset to 0 here
; BG_EFFECT_STRUCT_BATTLE_TURN is set to 2 or -2 depending on target
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
@@ -1451,7 +1451,7 @@
; Prepares mon to move forward (player moves right, enemy moves left)
; BG_EFFECT_STRUCT_03 will keep track of distance moved, so it's reset to 0 here
; BG_EFFECT_STRUCT_BATTLE_TURN is set to 2 or -2 depending on target
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms2
@@ -1488,7 +1488,7 @@
cp 8
jr nz, .finish
.reached_limit
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
.finish
call Rollout_FillLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
@@ -1509,7 +1509,7 @@
ld a, [hl]
and a
jr nz, .move_back
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
.move_back
call Rollout_FillLYOverridesBackup
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
@@ -1590,7 +1590,7 @@
VitalThrow_MoveBackwards:
; Prepares mon to move back back (player moves left, enemy moves right)
; BG_EFFECT_STRUCT_03: keeps track of distance moved, so it's reset to 0 here
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
@@ -1634,7 +1634,7 @@
dw .two
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
@@ -1672,7 +1672,7 @@
dw .two
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
@@ -1726,7 +1726,7 @@
dw .two
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
@@ -1768,7 +1768,7 @@
dw .two
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCY)
call BattleBGEffect_SetLCDStatCustoms2
@@ -1821,7 +1821,7 @@
dw .five
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
ld a, $e4
call BattleBGEffects_SetLYOverrides
ld a, $47
@@ -1861,7 +1861,7 @@
ldh a, [hLYOverrideStart]
inc a
ldh [hLYOverrideStart], a
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
ret
.three
@@ -1875,7 +1875,7 @@
ret
.finish
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
ret
.SetLYOverridesBackup:
@@ -1925,7 +1925,7 @@
dw .one
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
@@ -1965,7 +1965,7 @@
dw .two
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
ld a, $e4
call BattleBGEffects_SetLYOverrides
ld a, LOW(rBGP)
@@ -2049,7 +2049,7 @@
dw .cgb_two
.cgb_zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -2201,7 +2201,7 @@
dw .one
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
@@ -2247,7 +2247,7 @@
dw .two
.zero
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
call BattleBGEffects_ClearLYOverrides
ld a, LOW(rSCX)
ldh [hLCDCPointer], a
@@ -2412,7 +2412,7 @@
dw .two_dmg
.zero_dmg
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
ld a, $e4
call BattleBGEffects_SetLYOverrides
ld a, $47
@@ -2478,10 +2478,10 @@
.zero_cgb
call BGEffect_CheckBattleTurn
jr nz, .player_turn_cgb
- call BattleBGEffects_IncrementJumptable
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
+ call BattleBGEffects_IncAnonJumptableIndex
.player_turn_cgb
- call BattleBGEffects_IncrementJumptable
+ call BattleBGEffects_IncAnonJumptableIndex
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
--- a/engine/games/card_flip.asm
+++ b/engine/games/card_flip.asm
@@ -3,11 +3,11 @@
CARDFLIP_DECK_SIZE EQU 4 * 6
-; two labels below called from inside ./dummy_game.asm
-Unknown_e00ed:
+DummyGameGFX:
; Graphics for an unused Game Corner
; game were meant to be here.
-ret_e00ed:
+
+UnusedCursor_InterpretJoypad_AnimateCursor:
ret
_CardFlip:
--- a/engine/games/dummy_game.asm
+++ b/engine/games/dummy_game.asm
@@ -14,10 +14,10 @@
ld hl, DummyGameLZ
ld de, vTiles2 tile $00
call Decompress
- ld hl, Unknown_e00ed
+ ld hl, DummyGameGFX
ld de, vTiles0 tile $00
ld bc, 4 tiles
- ld a, BANK(Unknown_e00ed)
+ ld a, BANK(DummyGameGFX)
call FarCopyBytes
ld a, $8
ld hl, wc300
@@ -77,7 +77,7 @@
ret
.ResetBoard:
- call ret_e00ed
+ call UnusedCursor_InterpretJoypad_AnimateCursor
jr nc, .proceed
ld hl, wJumptableIndex
set 7, [hl]
@@ -232,7 +232,7 @@
ld hl, wJumptableIndex
inc [hl]
.AskPlayAgain:
- call ret_e00ed
+ call UnusedCursor_InterpretJoypad_AnimateCursor
jr nc, .restart
ld hl, wJumptableIndex
set 7, [hl]
--- a/engine/gfx/sprite_anims.asm
+++ b/engine/gfx/sprite_anims.asm
@@ -13,52 +13,52 @@
.Jumptable:
; entries correspond to SPRITE_ANIM_SEQ_* constants
- dw .Null
- dw .PartyMon
- dw .PartyMonSwitch
- dw .PartyMonSelected
- dw .GSTitleTrail
- dw .NamingScreenCursor
- dw .GameFreakLogo
- dw .GSGameFreakLogoStar
- dw .GSGameFreakLogoSparkle
- dw .SlotsGolem
- dw .SlotsChansey
- dw .SlotsChanseyEgg
- dw .MailCursor
- dw .UnusedCursor
- dw .DummyGameCursor
- dw .PokegearArrow
- dw .TradePokeBall
- dw .TradeTubeBulge
- dw .TrademonInTube
- dw .RevealNewMon
- dw .RadioTuningKnob
- dw .CutLeaves
- dw .FlyFrom
- dw .FlyLeaf
- dw .FlyTo
- dw .GSIntroHoOhLugia
- dw .EZChatCursor
- dw .MobileTradeSentPulse
- dw .MobileTradeOTPulse
- dw .IntroSuicune
- dw .IntroPichuWooper
- dw .Celebi
- dw .IntroUnown
- dw .IntroUnownF
- dw .IntroSuicuneAway
+ dw AnimSeq_Null
+ dw AnimSeq_PartyMon
+ dw AnimSeq_PartyMonSwitch
+ dw AnimSeq_PartyMonSelected
+ dw AnimSeq_GSTitleTrail
+ dw AnimSeq_NamingScreenCursor
+ dw AnimSeq_GameFreakLogo
+ dw AnimSeq_GSGameFreakLogoStar
+ dw AnimSeq_GSGameFreakLogoSparkle
+ dw AnimSeq_SlotsGolem
+ dw AnimSeq_SlotsChansey
+ dw AnimSeq_SlotsChanseyEgg
+ dw AnimSeq_MailCursor
+ dw AnimSeq_UnusedCursor
+ dw AnimSeq_DummyGameCursor
+ dw AnimSeq_PokegearArrow
+ dw AnimSeq_TradePokeBall
+ dw AnimSeq_TradeTubeBulge
+ dw AnimSeq_TrademonInTube
+ dw AnimSeq_RevealNewMon
+ dw AnimSeq_RadioTuningKnob
+ dw AnimSeq_CutLeaves
+ dw AnimSeq_FlyFrom
+ dw AnimSeq_FlyLeaf
+ dw AnimSeq_FlyTo
+ dw AnimSeq_GSIntroHoOhLugia
+ dw AnimSeq_EZChatCursor
+ dw AnimSeq_MobileTradeSentPulse
+ dw AnimSeq_MobileTradeOTPulse
+ dw AnimSeq_IntroSuicune
+ dw AnimSeq_IntroPichuWooper
+ dw AnimSeq_Celebi
+ dw AnimSeq_IntroUnown
+ dw AnimSeq_IntroUnownF
+ dw AnimSeq_IntroSuicuneAway
-.Null:
+AnimSeq_Null:
ret
-.PartyMon
+AnimSeq_PartyMon:
ld a, [wMenuCursorY]
ld hl, SPRITEANIMSTRUCT_INDEX
add hl, bc
cp [hl]
- jr z, .PartyMonSwitch
+ jr z, AnimSeq_PartyMonSwitch
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
@@ -69,7 +69,7 @@
ld [hl], 0
ret
-.PartyMonSwitch
+AnimSeq_PartyMonSwitch:
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], 8 * 3
@@ -111,7 +111,7 @@
ld [hl], a
ret
-.PartyMonSelected
+AnimSeq_PartyMonSelected:
ld a, [wMenuCursorY]
ld hl, SPRITEANIMSTRUCT_INDEX
@@ -130,17 +130,16 @@
ld [hl], 8 * 3
ret
-.GSTitleTrail
- call .AnonymousJumptable
+AnimSeq_GSTitleTrail:
+ call AnimSeqs_AnonJumptable
jp hl
+.anon_dw
+ dw .zero
+ dw .one
-; Anonymous dw (see .AnonymousJumptable)
- dw .four_zero
- dw .four_one
+.zero
+ call AnimSeqs_IncAnonJumptableIndex
-.four_zero
- call .IncrementJumptableIndex
-
ld hl, SPRITEANIMSTRUCT_INDEX
add hl, bc
ld a, [hl]
@@ -156,16 +155,16 @@
add hl, bc
ld [hl], a
-.four_one
+.one
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
cp $a4
- jr nc, .asm_8d356
+ jr nc, .delete
ld hl, SPRITEANIMSTRUCT_VAR2
add hl, bc
- add $4
+ add 4
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
@@ -187,7 +186,7 @@
ld a, [hl]
add 3
ld [hl], a
- call .Sprites_Sine
+ call AnimSeqs_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
@@ -194,11 +193,11 @@
ld [hl], a
ret
-.asm_8d356
+.delete
call DeinitializeSprite
ret
-.GSIntroHoOhLugia
+AnimSeq_GSIntroHoOhLugia:
ld hl, SPRITEANIMSTRUCT_VAR1
add hl, bc
ld a, [hl]
@@ -205,7 +204,7 @@
inc a
ld [hl], a
ld d, 2
- call .Sprites_Sine
+ call AnimSeqs_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
@@ -212,40 +211,41 @@
ld [hl], a
ret
-.NamingScreenCursor
+AnimSeq_NamingScreenCursor:
callfar NamingScreen_AnimateCursor
ret
-.MailCursor
+AnimSeq_MailCursor:
callfar ComposeMail_AnimateCursor
ret
-.GameFreakLogo
+AnimSeq_GameFreakLogo:
callfar GameFreakLogoSpriteAnim
ret
-.GSGameFreakLogoStar
+AnimSeq_GSGameFreakLogoStar:
ld hl, SPRITEANIMSTRUCT_VAR1
add hl, bc
ld a, [hl]
and a
- jr z, .asm_8d3ba
+ jr z, .delete
+
dec [hl]
dec [hl]
ld d, a
and $1f
- jr nz, .asm_8d395
-
+ jr nz, .stay
ld hl, SPRITEANIMSTRUCT_VAR2
add hl, bc
dec [hl]
-.asm_8d395
+
+.stay
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
push af
push de
- call .Sprites_Sine
+ call AnimSeqs_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
@@ -252,7 +252,7 @@
ld [hl], a
pop de
pop af
- call .Sprites_Cosine
+ call AnimSeqs_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
@@ -268,18 +268,18 @@
ld [hl], a
ret
-.asm_8d3ba
+.delete
ld a, 1
ld [wIntroSceneFrameCounter], a
call DeinitializeSprite
ret
-.GSGameFreakLogoSparkle
+AnimSeq_GSGameFreakLogoSparkle:
ld hl, SPRITEANIMSTRUCT_VAR1
add hl, bc
ld a, [hli]
or [hl]
- jr z, .asm_8d41e
+ jr z, .delete
ld hl, SPRITEANIMSTRUCT_VAR4
add hl, bc
@@ -290,7 +290,7 @@
ld a, [hl]
push af
push de
- call .Sprites_Sine
+ call AnimSeqs_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
@@ -297,7 +297,7 @@
ld [hl], a
pop de
pop af
- call .Sprites_Cosine
+ call AnimSeqs_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
@@ -347,15 +347,15 @@
ld [hl], a
ret
-.asm_8d41e
+.delete
call DeinitializeSprite
ret
-.SlotsGolem:
+AnimSeq_SlotsGolem:
callfar Slots_AnimateGolem
ret
-.SlotsChansey:
+AnimSeq_SlotsChansey:
callfar Slots_AnimateChansey
ld hl, wcf64
ld a, [hl]
@@ -366,7 +366,7 @@
call _ReinitSpriteAnimFrame
ret
-.SlotsChanseyEgg:
+AnimSeq_SlotsChanseyEgg:
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
@@ -392,7 +392,7 @@
.move_vertical
ld a, e
ld d, 32
- call .Sprites_Sine
+ call AnimSeqs_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
@@ -399,37 +399,36 @@
ld [hl], a
ret
-.UnusedCursor
- callfar ret_e00ed
+AnimSeq_UnusedCursor:
+ callfar UnusedCursor_InterpretJoypad_AnimateCursor
ret
-.PokegearArrow
+AnimSeq_PokegearArrow:
callfar AnimatePokegearModeIndicatorArrow
ret
-.DummyGameCursor
+AnimSeq_DummyGameCursor:
callfar DummyGame_InterpretJoypad_AnimateCursor
ret
-.TradePokeBall
- call .AnonymousJumptable
+AnimSeq_TradePokeBall:
+ call AnimSeqs_AnonJumptable
jp hl
+.anon_dw
+ dw .zero
+ dw .one
+ dw .two
+ dw .three
+ dw .four
+ dw .delete
-; Anonymous dw (see .AnonymousJumptable)
- dw .TradePokeBall_zero
- dw .TradePokeBall_one
- dw .TradePokeBall_two
- dw .TradePokeBall_three
- dw .TradePokeBall_four
- dw .TradePokeBall_five
-
-.TradePokeBall_zero
+.zero
ld a, SPRITE_ANIM_FRAMESET_TRADE_POKE_BALL_WOBBLE
call _ReinitSpriteAnimFrame
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
- ld [hl], $2
+ ld [hl], 2 ; .two
ld hl, SPRITEANIMSTRUCT_VAR1
add hl, bc
@@ -436,31 +435,31 @@
ld [hl], $20
ret
-.TradePokeBall_two
+.two
ld hl, SPRITEANIMSTRUCT_VAR1
add hl, bc
ld a, [hl]
and a
- jr z, .asm_8d4af
+ jr z, .next
dec [hl]
ret
-.asm_8d4af
- call .IncrementJumptableIndex
+.next
+ call AnimSeqs_IncAnonJumptableIndex
ld hl, SPRITEANIMSTRUCT_VAR1
add hl, bc
ld [hl], $40
-.TradePokeBall_three
+.three
ld hl, SPRITEANIMSTRUCT_VAR1
add hl, bc
ld a, [hl]
cp 48
- jr c, .asm_8d4cd
+ jr c, .done
dec [hl]
ld d, 40
- call .Sprites_Sine
+ call AnimSeqs_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
@@ -467,12 +466,12 @@
ld [hl], a
ret
-.asm_8d4cd
+.done
ld de, SFX_GOT_SAFARI_BALLS
call PlaySFX
- jr .TradePokeBall_five
+ jr .delete
-.TradePokeBall_one
+.one
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld [hl], $4
@@ -486,12 +485,12 @@
ld [hl], $24
ret
-.TradePokeBall_four
+.four
ld hl, SPRITEANIMSTRUCT_VAR2
add hl, bc
ld a, [hl]
and a
- jr z, .asm_8d51c
+ jr z, .done2
ld d, a
ld hl, SPRITEANIMSTRUCT_VAR1
@@ -523,20 +522,20 @@
call PlaySFX
ret
-.asm_8d51c
+.done2
xor a
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
- call .IncrementJumptableIndex
+ call AnimSeqs_IncAnonJumptableIndex
ret
-.TradePokeBall_five
+.delete
call DeinitializeSprite
ret
-.TradeTubeBulge
+AnimSeq_TradeTubeBulge:
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
@@ -554,11 +553,11 @@
call DeinitializeSprite
ret
-.TrademonInTube
+AnimSeq_TrademonInTube:
callfar TradeAnim_AnimateTrademonInTube
ret
-.RevealNewMon:
+AnimSeq_RevealNewMon:
ld hl, SPRITEANIMSTRUCT_VAR1
add hl, bc
ld a, [hl]
@@ -565,7 +564,7 @@
cp $80
jr nc, .finish_EggShell
ld d, a
- add $8
+ add 8
ld [hl], a
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
@@ -576,7 +575,7 @@
push af
push de
- call .Sprites_Sine
+ call AnimSeqs_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
@@ -584,7 +583,7 @@
pop de
pop af
- call .Sprites_Cosine
+ call AnimSeqs_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
@@ -595,11 +594,11 @@
call DeinitializeSprite
ret
-.RadioTuningKnob:
+AnimSeq_RadioTuningKnob:
callfar AnimateTuningKnob
ret
-.CutLeaves
+AnimSeq_CutLeaves:
ld hl, SPRITEANIMSTRUCT_VAR2
add hl, bc
ld e, [hl]
@@ -624,7 +623,7 @@
inc [hl]
push af
push de
- call .Sprites_Sine
+ call AnimSeqs_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
@@ -631,7 +630,7 @@
ld [hl], a
pop de
pop af
- call .Sprites_Cosine
+ call AnimSeqs_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
@@ -638,7 +637,7 @@
ld [hl], a
ret
-.FlyFrom:
+AnimSeq_FlyFrom:
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
@@ -663,7 +662,7 @@
ld d, a
cp $40
jr nc, .skip
- add $8
+ add 8
ld [hl], a
.skip
ld hl, SPRITEANIMSTRUCT_VAR3
@@ -670,7 +669,7 @@
add hl, bc
ld a, [hl]
inc [hl]
- call .Sprites_Cosine
+ call AnimSeqs_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
@@ -677,7 +676,7 @@
ld [hl], a
ret
-.FlyLeaf:
+AnimSeq_FlyLeaf:
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
@@ -695,7 +694,7 @@
add hl, bc
ld a, [hl]
inc [hl]
- call .Sprites_Cosine
+ call AnimSeqs_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
@@ -706,7 +705,7 @@
call DeinitializeSprite
ret
-.FlyTo:
+AnimSeq_FlyTo:
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
@@ -723,15 +722,15 @@
ld a, [hl]
ld d, a
and a
- jr z, .asm_8d621
+ jr z, .stay
sub $2
ld [hl], a
-.asm_8d621
+.stay
ld hl, SPRITEANIMSTRUCT_VAR3
add hl, bc
ld a, [hl]
inc [hl]
- call .Sprites_Cosine
+ call AnimSeqs_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
@@ -738,20 +737,21 @@
ld [hl], a
ret
-.MobileTradeSentPulse
+AnimSeq_MobileTradeSentPulse:
farcall Function108bc7
ret
-.MobileTradeOTPulse
+AnimSeq_MobileTradeOTPulse:
farcall Function108be0
ret
-.IntroSuicune
+AnimSeq_IntroSuicune:
ld a, [wIntroSceneTimer]
and a
- jr nz, .asm_8d645
+ jr nz, .continue
ret
-.asm_8d645
+
+.continue
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], $0
@@ -764,7 +764,7 @@
xor $ff
inc a
ld d, 32
- call .Sprites_Sine
+ call AnimSeqs_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
@@ -773,26 +773,26 @@
call _ReinitSpriteAnimFrame
ret
-.IntroPichuWooper
+AnimSeq_IntroPichuWooper:
ld hl, SPRITEANIMSTRUCT_VAR1
add hl, bc
ld a, [hl]
cp 20
- jr nc, .asm_8d67f
+ jr nc, .done
add 2
ld [hl], a
xor $ff
inc a
ld d, 32
- call .Sprites_Sine
+ call AnimSeqs_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
-.asm_8d67f
+.done
ret
-.IntroUnown
+AnimSeq_IntroUnown:
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld d, [hl]
@@ -804,7 +804,7 @@
ld a, [hl]
push af
push de
- call .Sprites_Sine
+ call AnimSeqs_Sine
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
@@ -811,7 +811,7 @@
ld [hl], a
pop de
pop af
- call .Sprites_Cosine
+ call AnimSeqs_Cosine
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
@@ -818,7 +818,7 @@
ld [hl], a
ret
-.IntroUnownF
+AnimSeq_IntroUnownF:
ld a, [wcf64]
cp $40
ret nz
@@ -826,23 +826,23 @@
call _ReinitSpriteAnimFrame
ret
-.IntroSuicuneAway
+AnimSeq_IntroSuicuneAway:
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
- add $10
+ add 16
ld [hl], a
ret
-.EZChatCursor
+AnimSeq_EZChatCursor:
farcall AnimateEZChatCursor
ret
-.Celebi
+AnimSeq_Celebi:
farcall UpdateCelebiPosition
ret
-.AnonymousJumptable:
+AnimSeqs_AnonJumptable:
ld hl, sp+0
ld e, [hl]
inc hl
@@ -860,16 +860,16 @@
ld l, a
ret
-.IncrementJumptableIndex:
+AnimSeqs_IncAnonJumptableIndex:
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ret
-.Sprites_Sine:
+AnimSeqs_Sine:
call Sprites_Sine
ret
-.Sprites_Cosine:
+AnimSeqs_Cosine:
call Sprites_Cosine
ret
--- a/engine/overworld/cmd_queue.asm
+++ b/engine/overworld/cmd_queue.asm
@@ -134,7 +134,7 @@
dba CmdQueue_Type3
dba CmdQueue_Type4
-CmdQueueAnonymousJumptable:
+CmdQueues_AnonJumptable:
ld hl, CMDQUEUE_05
add hl, bc
ld a, [hl]
@@ -142,13 +142,13 @@
rst JumpTable
ret
-CmdQueueAnonJT_Increment:
+CmdQueues_IncAnonJumptableIndex:
ld hl, CMDQUEUE_05
add hl, bc
inc [hl]
ret
-CmdQueueAnonJT_Decrement:
+CmdQueues_DecAnonJumptableIndex:
ld hl, CMDQUEUE_05
add hl, bc
dec [hl]
@@ -162,7 +162,7 @@
ret
CmdQueue_Type4:
- call CmdQueueAnonymousJumptable
+ call CmdQueues_AnonJumptable
; anonymous dw
dw .zero
dw .one
@@ -172,7 +172,7 @@
ld hl, CMDQUEUE_04
add hl, bc
ld [hl], a
- call CmdQueueAnonJT_Increment
+ call CmdQueues_IncAnonJumptableIndex
.one
ld hl, CMDQUEUE_ADDR
add hl, bc
@@ -206,7 +206,7 @@
ret
CmdQueue_Type3:
- call CmdQueueAnonymousJumptable
+ call CmdQueues_AnonJumptable
; anonymous dw
dw .zero
dw .one
@@ -215,11 +215,11 @@
.zero
call .IsPlayerFacingDown
jr z, .PlayerNotFacingDown
- call CmdQueueAnonJT_Increment
+ call CmdQueues_IncAnonJumptableIndex
.one
call .IsPlayerFacingDown
jr z, .PlayerNotFacingDown
- call CmdQueueAnonJT_Increment
+ call CmdQueues_IncAnonJumptableIndex
ld hl, CMDQUEUE_02
add hl, bc
@@ -230,7 +230,7 @@
.two
call .IsPlayerFacingDown
jr z, .PlayerNotFacingDown
- call CmdQueueAnonJT_Decrement
+ call CmdQueues_DecAnonJumptableIndex
ld hl, CMDQUEUE_03
add hl, bc
--- a/engine/overworld/map_objects.asm
+++ b/engine/overworld/map_objects.asm
@@ -433,25 +433,25 @@
ld a, SPRITEMOVEDATA_STANDING_DOWN
ret
-ClearObjectMovementByteIndex:
+ObjectMovementByte_ZeroAnonJumptableIndex: ; unreferenced
ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
ld [hl], 0
ret
-IncrementObjectMovementByteIndex:
+ObjectMovementByte_IncAnonJumptableIndex:
ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
inc [hl]
ret
-DecrementObjectMovementByteIndex:
+ObjectMovementByte_DecAnonJumptableIndex:
ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
dec [hl]
ret
-MovementAnonymousJumptable:
+ObjectMovementByte_AnonJumptable:
ld hl, OBJECT_MOVEMENT_BYTE_INDEX
add hl, bc
ld a, [hl]
@@ -459,19 +459,19 @@
rst JumpTable
ret
-ClearObjectStructField1c:
+Field1c_ZeroAnonJumptableIndex:
ld hl, OBJECT_1C
add hl, bc
ld [hl], 0
ret
-IncrementObjectStructField1c:
+Field1c_IncAnonJumptableIndex:
ld hl, OBJECT_1C
add hl, bc
inc [hl]
ret
-Field1cAnonymousJumptable:
+Field1c_AnonJumptable:
ld hl, OBJECT_1C
add hl, bc
ld a, [hl]
@@ -479,13 +479,13 @@
rst JumpTable
ret
-GetValueObjectStructField1c:
+Field1c_GetAnonJumptableIndex: ; unreferenced
ld hl, OBJECT_1C
add hl, bc
ld a, [hl]
ret
-SetValueObjectStructField1c:
+Field1c_SetAnonJumptableIndex: ; unreferenced
ld hl, OBJECT_1C
add hl, bc
ld [hl], a
@@ -512,7 +512,7 @@
ret
MapObjectMovementPattern:
- call ClearObjectStructField1c
+ call Field1c_ZeroAnonJumptableIndex
call GetSpriteMovementFunction
ld a, [hl]
ld hl, .Pointers
@@ -521,58 +521,58 @@
.Pointers:
; entries correspond to SPRITEMOVEFN_* constants
- dw .Null_00 ; 00
- dw .RandomWalkY ; 01
- dw .RandomWalkX ; 02
- dw .RandomWalkXY ; 03
- dw .RandomSpin1 ; 04
- dw .RandomSpin2 ; 05
- dw .Standing ; 06
- dw .ObeyDPad ; 07
- dw .Movement08 ; 08
- dw .Movement09 ; 09
- dw .Movement0a ; 0a
- dw .Movement0b ; 0b
- dw .Movement0c ; 0c
- dw .Movement0d ; 0d
- dw .Movement0e ; 0e
- dw .Follow ; 0f
- dw .Script ; 10
- dw .Strength ; 11
- dw .FollowNotExact ; 12
- dw .MovementShadow ; 13
- dw .MovementEmote ; 14
- dw .MovementBigStanding ; 15
- dw .MovementBouncing ; 16
- dw .MovementScreenShake ; 17
- dw .MovementSpinClockwise ; 18
- dw .MovementSpinCounterclockwise ; 19
- dw .MovementBoulderDust ; 1a
- dw .MovementShakingGrass ; 1b
+ dw MovementFunction_Null ; 00
+ dw MovementFunction_RandomWalkY ; 01
+ dw MovementFunction_RandomWalkX ; 02
+ dw MovementFunction_RandomWalkXY ; 03
+ dw MovementFunction_RandomSpinSlow ; 04
+ dw MovementFunction_RandomSpinFast ; 05
+ dw MovementFunction_Standing ; 06
+ dw MovementFunction_ObeyDPad ; 07
+ dw MovementFunction_08 ; 08
+ dw MovementFunction_09 ; 09
+ dw MovementFunction_0a ; 0a
+ dw MovementFunction_0b ; 0b
+ dw MovementFunction_0c ; 0c
+ dw MovementFunction_0d ; 0d
+ dw MovementFunction_0e ; 0e
+ dw MovementFunction_Follow ; 0f
+ dw MovementFunction_Script ; 10
+ dw MovementFunction_Strength ; 11
+ dw MovementFunction_FollowNotExact ; 12
+ dw MovementFunction_Shadow ; 13
+ dw MovementFunction_Emote ; 14
+ dw MovementFunction_BigStanding ; 15
+ dw MovementFunction_Bouncing ; 16
+ dw MovementFunction_ScreenShake ; 17
+ dw MovementFunction_SpinClockwise ; 18
+ dw MovementFunction_SpinCounterclockwise ; 19
+ dw MovementFunction_BoulderDust ; 1a
+ dw MovementFunction_ShakingGrass ; 1b
-.Null_00:
+MovementFunction_Null:
ret
-.RandomWalkY:
+MovementFunction_RandomWalkY:
call Random
ldh a, [hRandomAdd]
and %00000001
- jp .RandomWalkContinue
+ jp _RandomWalkContinue
-.RandomWalkX:
+MovementFunction_RandomWalkX:
call Random
ldh a, [hRandomAdd]
and %00000001
or %00000010
- jp .RandomWalkContinue
+ jp _RandomWalkContinue
-.RandomWalkXY:
+MovementFunction_RandomWalkXY:
call Random
ldh a, [hRandomAdd]
and %00000011
- jp .RandomWalkContinue
+ jp _RandomWalkContinue
-.RandomSpin1:
+MovementFunction_RandomSpinSlow:
call Random
ldh a, [hRandomAdd]
and %00001100
@@ -581,7 +581,7 @@
ld [hl], a
jp RandomStepDuration_Slow
-.RandomSpin2:
+MovementFunction_RandomSpinFast:
ld hl, OBJECT_FACING
add hl, bc
ld a, [hl]
@@ -597,7 +597,7 @@
ld [hl], a
jp RandomStepDuration_Fast
-.Standing:
+MovementFunction_Standing:
call Function462a
call EndSpriteMovement
ld hl, OBJECT_ACTION
@@ -608,48 +608,49 @@
ld [hl], STEP_TYPE_05
ret
-.ObeyDPad:
+MovementFunction_ObeyDPad:
ld hl, ApplyPlayerMovementByte
jp HandleMovementData
-.Movement08:
+MovementFunction_08:
ld hl, Function5015
jp HandleMovementData
-.Movement09:
+MovementFunction_09:
ld hl, Function5026
jp HandleMovementData
-.Movement0a:
+MovementFunction_0a:
jp _GetMovementObject
-.Movement0b:
+MovementFunction_0b:
jp _GetMovementObject
-.Movement0c:
+MovementFunction_0c:
jp _GetMovementObject
-.Movement0d:
+MovementFunction_0d:
ld hl, ApplyPlayerMovementByte
jp HandleMovementData
-.Movement0e:
+MovementFunction_0e:
jp _GetMovementObject
-.Follow:
+MovementFunction_Follow:
ld hl, GetFollowerNextMovementByte
jp HandleMovementData
-.Script:
+MovementFunction_Script:
ld hl, GetMovementByte
jp HandleMovementData
-.Strength:
- call MovementAnonymousJumptable
- dw .Strength_Start
- dw .Strength_Stop
+MovementFunction_Strength:
+ call ObjectMovementByte_AnonJumptable
+.anon_dw
+ dw .start
+ dw .stop
-.Strength_Start:
+.start:
ld hl, OBJECT_NEXT_TILE
add hl, bc
ld a, [hl]
@@ -686,14 +687,14 @@
ret
.on_pit
- call IncrementObjectMovementByteIndex
-.Strength_Stop:
+ call ObjectMovementByte_IncAnonJumptableIndex
+.stop:
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
ld [hl], STANDING
ret
-.FollowNotExact:
+MovementFunction_FollowNotExact:
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld d, [hl]
@@ -755,7 +756,7 @@
ld [hl], OBJECT_ACTION_STAND
ret
-.MovementBigStanding:
+MovementFunction_BigStanding:
call EndSpriteMovement
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
@@ -768,7 +769,7 @@
ld [hl], STEP_TYPE_04
ret
-.MovementBouncing:
+MovementFunction_Bouncing:
call EndSpriteMovement
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
@@ -781,22 +782,24 @@
ld [hl], STEP_TYPE_04
ret
-.MovementSpinCounterclockwise:
- call MovementAnonymousJumptable
- dw .MovementSpinInit
- dw .MovementSpinRepeat
- dw .MovementSpinTurnLeft
+MovementFunction_SpinCounterclockwise:
+ call ObjectMovementByte_AnonJumptable
+.anon_dw
+ dw _MovementSpinInit
+ dw _MovementSpinRepeat
+ dw _MovementSpinTurnLeft
-.MovementSpinClockwise:
- call MovementAnonymousJumptable
- dw .MovementSpinInit
- dw .MovementSpinRepeat
- dw .MovementSpinTurnRight
+MovementFunction_SpinClockwise:
+ call ObjectMovementByte_AnonJumptable
+.anon_dw
+ dw _MovementSpinInit
+ dw _MovementSpinRepeat
+ dw _MovementSpinTurnRight
-.MovementSpinInit:
+_MovementSpinInit:
call EndSpriteMovement
- call IncrementObjectMovementByteIndex
-.MovementSpinRepeat:
+ call ObjectMovementByte_IncAnonJumptableIndex
+_MovementSpinRepeat:
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], OBJECT_ACTION_STAND
@@ -810,26 +813,32 @@
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_03
- call IncrementObjectMovementByteIndex
+ call ObjectMovementByte_IncAnonJumptableIndex
ret
-.MovementSpinTurnLeft:
- ld de, .DirectionData_Counterclockwise
- call .MovementSpinNextFacing
- jr .MovementSpinCounterclockwise
+_MovementSpinTurnLeft:
+ ld de, .facings_counterclockwise
+ call _MovementSpinNextFacing
+ jr MovementFunction_SpinCounterclockwise
-.DirectionData_Counterclockwise:
- db OW_RIGHT, OW_LEFT, OW_DOWN, OW_UP
+.facings_counterclockwise:
+ db OW_RIGHT
+ db OW_LEFT
+ db OW_DOWN
+ db OW_UP
-.MovementSpinTurnRight:
- ld de, .DirectionData_Clockwise
- call .MovementSpinNextFacing
- jr .MovementSpinClockwise
+_MovementSpinTurnRight:
+ ld de, .facings_clockwise
+ call _MovementSpinNextFacing
+ jr MovementFunction_SpinClockwise
-.DirectionData_Clockwise:
- db OW_LEFT, OW_RIGHT, OW_UP, OW_DOWN
+.facings_clockwise:
+ db OW_LEFT
+ db OW_RIGHT
+ db OW_UP
+ db OW_DOWN
-.MovementSpinNextFacing:
+_MovementSpinNextFacing:
ld hl, OBJECT_FACING
add hl, bc
ld a, [hl]
@@ -843,11 +852,11 @@
ld a, [hl]
pop hl
ld [hl], a
- call DecrementObjectMovementByteIndex
+ call ObjectMovementByte_DecAnonJumptableIndex
ret
-.MovementShadow:
- call ._MovementShadow_Grass_Emote_BoulderDust
+MovementFunction_Shadow:
+ call InitMovementField1dField1e
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], OBJECT_ACTION_SHADOW
@@ -866,11 +875,11 @@
maskbits NUM_DIRECTIONS
ld d, 1 * 8 + 6
cp DOWN
- jr z, .ok_13
+ jr z, .ok
cp UP
- jr z, .ok_13
+ jr z, .ok
ld d, 1 * 8 + 4
-.ok_13
+.ok
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], d
@@ -882,9 +891,9 @@
ld [hl], STEP_TYPE_TRACKING_OBJECT
ret
-.MovementEmote:
+MovementFunction_Emote:
call EndSpriteMovement
- call ._MovementShadow_Grass_Emote_BoulderDust
+ call InitMovementField1dField1e
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], OBJECT_ACTION_EMOTE
@@ -902,9 +911,9 @@
ld [hl], STEP_TYPE_TRACKING_OBJECT
ret
-.MovementBoulderDust:
+MovementFunction_BoulderDust:
call EndSpriteMovement
- call ._MovementShadow_Grass_Emote_BoulderDust
+ call InitMovementField1dField1e
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], OBJECT_ACTION_BOULDER_DUST
@@ -922,7 +931,7 @@
and %00000011
ld e, a
ld d, 0
- ld hl, .data_4a81
+ ld hl, .dust_coords
add hl, de
add hl, de
ld d, [hl]
@@ -939,7 +948,7 @@
ld [hl], STEP_TYPE_TRACKING_OBJECT
ret
-.data_4a81
+.dust_coords:
; x, y
db 0, -4
db 0, 8
@@ -946,9 +955,9 @@
db 6, 2
db -6, 2
-.MovementShakingGrass:
+MovementFunction_ShakingGrass:
call EndSpriteMovement
- call ._MovementShadow_Grass_Emote_BoulderDust
+ call InitMovementField1dField1e
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], OBJECT_ACTION_GRASS_SHAKE
@@ -964,7 +973,7 @@
ld [hl], STEP_TYPE_TRACKING_OBJECT
ret
-._MovementShadow_Grass_Emote_BoulderDust:
+InitMovementField1dField1e:
ld hl, OBJECT_RANGE
add hl, bc
ld a, [hl]
@@ -980,7 +989,7 @@
ld [hl], d
ret
-.MovementScreenShake:
+MovementFunction_ScreenShake:
call EndSpriteMovement
ld hl, OBJECT_ACTION
add hl, bc
@@ -988,7 +997,7 @@
ld hl, OBJECT_RANGE
add hl, bc
ld a, [hl]
- call ._MovementScreenShake
+ call .GetDurationAndField1e
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], e
@@ -1000,7 +1009,7 @@
ld [hl], STEP_TYPE_15
ret
-._MovementScreenShake:
+.GetDurationAndField1e:
ld d, a
and %00111111
ld e, a
@@ -1017,10 +1026,10 @@
add a
jr .loop
-.RandomWalkContinue:
+_RandomWalkContinue:
call InitStep
call CanObjectMoveInDirection ; check whether the object can move in that direction
- jr c, .NewDuration
+ jr c, .new_duration
call UpdateTallGrassFlags
ld hl, OBJECT_ACTION
add hl, bc
@@ -1028,21 +1037,23 @@
ld hl, wCenteredObject
ldh a, [hMapObjectIndexBuffer]
cp [hl]
- jr z, .load_6
+ jr z, .centered
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_07
ret
-.load_6
+.centered
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_PLAYER_WALK
ret
-.NewDuration:
+.new_duration:
call EndSpriteMovement
call Function462a
+ ; fallthrough
+
RandomStepDuration_Slow:
call Random
ldh a, [hRandomAdd]
@@ -1070,32 +1081,32 @@
StepTypesJumptable:
; entries correspond to STEP_TYPE_* constants
- dw ObjectMovementReset ; 00
+ dw ObjectMovementReset ; 00
dw MapObjectMovementPattern ; 01
- dw NPCStep ; 02
- dw StepType03 ; 03
- dw StepType04 ; 04
- dw StepType05 ; 05
- dw PlayerStep ; 06
- dw StepType07 ; 07
- dw NPCJump ; 08
- dw PlayerJump ; 09
- dw PlayerOrNPCTurnStep ; 0a
- dw StepTypeBump ; 0b
- dw TeleportFrom ; 0c
- dw TeleportTo ; 0d
- dw Skyfall ; 0e
- dw StepType0f ; 0f
- dw GotBiteStep ; 10
- dw RockSmashStep ; 11
- dw ReturnDigStep ; 12
- dw StepTypeTrackingObject ; 13
- dw StepType14 ; 14
- dw StepType15 ; 15
- dw StepType16 ; 16
- dw StepType17 ; 17
- dw StepType18 ; 18
- dw SkyfallTop ; 19
+ dw NPCStep ; 02
+ dw StepType03 ; 03
+ dw StepType04 ; 04
+ dw StepType05 ; 05
+ dw PlayerStep ; 06
+ dw StepType07 ; 07
+ dw NPCJump ; 08
+ dw PlayerJump ; 09
+ dw PlayerOrNPCTurnStep ; 0a
+ dw StepTypeBump ; 0b
+ dw TeleportFrom ; 0c
+ dw TeleportTo ; 0d
+ dw Skyfall ; 0e
+ dw StepType0f ; 0f
+ dw GotBiteStep ; 10
+ dw RockSmashStep ; 11
+ dw ReturnDigStep ; 12
+ dw StepTypeTrackingObject ; 13
+ dw StepType14 ; 14
+ dw StepType15 ; 15
+ dw StepType16 ; 16
+ dw StepType17 ; 17
+ dw StepType18 ; 18
+ dw SkyfallTop ; 19
WaitStep_InPlace:
ld hl, OBJECT_STEP_DURATION
@@ -1108,8 +1119,8 @@
ret
NPCJump:
- call Field1cAnonymousJumptable
-; anonymous dw
+ call Field1c_AnonJumptable
+.anon_dw
dw .Jump
dw .Land
@@ -1125,7 +1136,7 @@
ld hl, OBJECT_FLAGS2
add hl, bc
res OVERHEAD_F, [hl]
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
ret
.Land:
@@ -1142,8 +1153,8 @@
ret
PlayerJump:
- call Field1cAnonymousJumptable
-; anonymous dw
+ call Field1c_AnonJumptable
+.anon_dw
dw .initjump
dw .stepjump
dw .initland
@@ -1152,7 +1163,7 @@
.initjump
ld hl, wPlayerStepFlags
set PLAYERSTEP_START_F, [hl]
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.stepjump
call UpdateJumpPosition
call UpdatePlayerStep
@@ -1167,7 +1178,7 @@
ld hl, wPlayerStepFlags
set PLAYERSTEP_STOP_F, [hl]
set PLAYERSTEP_MIDAIR_F, [hl]
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
ret
.initland
@@ -1174,7 +1185,7 @@
call GetNextTile
ld hl, wPlayerStepFlags
set PLAYERSTEP_START_F, [hl]
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.stepland
call UpdateJumpPosition
call UpdatePlayerStep
@@ -1191,8 +1202,8 @@
ret
TeleportFrom:
- call Field1cAnonymousJumptable
-; anonymous dw
+ call Field1c_AnonJumptable
+.anon_dw
dw .InitSpin
dw .DoSpin
dw .InitSpinRise
@@ -1205,7 +1216,7 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.DoSpin:
ld hl, OBJECT_ACTION
add hl, bc
@@ -1214,7 +1225,7 @@
add hl, bc
dec [hl]
ret nz
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
ret
.InitSpinRise:
@@ -1230,7 +1241,7 @@
ld hl, OBJECT_FLAGS2
add hl, bc
res OVERHEAD_F, [hl]
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.DoSpinRise:
ld hl, OBJECT_ACTION
add hl, bc
@@ -1259,8 +1270,8 @@
ret
TeleportTo:
- call Field1cAnonymousJumptable
-; anonymous dw
+ call Field1c_AnonJumptable
+.anon_dw
dw .InitWait
dw .DoWait
dw .InitDescent
@@ -1276,7 +1287,7 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
ret
.DoWait:
@@ -1284,7 +1295,7 @@
add hl, bc
dec [hl]
ret nz
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.InitDescent:
ld hl, OBJECT_STEP_FRAME
add hl, bc
@@ -1295,7 +1306,7 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
ret
.DoDescent:
@@ -1317,12 +1328,12 @@
add hl, bc
dec [hl]
ret nz
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.InitFinalSpin:
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
ret
.DoFinalSpin:
@@ -1346,8 +1357,8 @@
ret
Skyfall:
- call Field1cAnonymousJumptable
-; anonymous dw
+ call Field1c_AnonJumptable
+.anon_dw
dw .Init
dw .Step
dw .Fall
@@ -1360,7 +1371,7 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.Step:
ld hl, OBJECT_STEP_DURATION
add hl, bc
@@ -1378,7 +1389,7 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.Fall:
ld hl, OBJECT_1F
add hl, bc
@@ -1395,7 +1406,7 @@
add hl, bc
dec [hl]
ret nz
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.Finish:
ld hl, OBJECT_STEP_FRAME
add hl, bc
@@ -1409,8 +1420,8 @@
ret
GotBiteStep:
- call Field1cAnonymousJumptable
-; anonymous dw
+ call Field1c_AnonJumptable
+.anon_dw
dw .Init
dw .Run
@@ -1421,7 +1432,7 @@
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], 0
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.Run:
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
@@ -1506,8 +1517,8 @@
ret
StepType05:
- call Field1cAnonymousJumptable
-; anonymous dw
+ call Field1c_AnonJumptable
+.anon_dw
dw .Reset
dw StepType04
@@ -1517,7 +1528,7 @@
ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
StepType04:
call Stubbed_Function4fb2
ld hl, OBJECT_DIRECTION_WALKING
@@ -1552,8 +1563,8 @@
PlayerStep:
; AnimateStep?
- call Field1cAnonymousJumptable
-; anonymous dw
+ call Field1c_AnonJumptable
+.anon_dw
dw .init
dw .step
@@ -1560,7 +1571,7 @@
.init
ld hl, wPlayerStepFlags
set PLAYERSTEP_START_F, [hl]
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.step
call UpdatePlayerStep
ld hl, OBJECT_STEP_DURATION
@@ -1579,8 +1590,8 @@
ret
PlayerOrNPCTurnStep:
- call Field1cAnonymousJumptable
-; anonymous dw
+ call Field1c_AnonJumptable
+.anon_dw
dw .init1
dw .step1
dw .init2
@@ -1597,13 +1608,13 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 2
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.step1
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.init2
ld hl, OBJECT_1D ; new facing
add hl, bc
@@ -1614,7 +1625,7 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 2
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.step2
ld hl, OBJECT_STEP_DURATION
add hl, bc
@@ -1691,8 +1702,8 @@
StepType14:
StepType15:
- call Field1cAnonymousJumptable
-; anonymous dw
+ call Field1c_AnonJumptable
+.anon_dw
dw .Init
dw .Run
@@ -1701,7 +1712,7 @@
ld hl, OBJECT_1D
add hl, bc
ld [hl], a
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.Run:
ld hl, OBJECT_1D
add hl, bc
@@ -1739,10 +1750,10 @@
ret
StepType16:
- call Field1cAnonymousJumptable ; ????
+ call Field1c_AnonJumptable ; ????
StepType17:
- call Field1cAnonymousJumptable
-; anonymous dw
+ call Field1c_AnonJumptable
+.anon_dw
dw .null
dw .null
dw .null
@@ -1749,7 +1760,7 @@
.null
SkyfallTop:
- call Field1cAnonymousJumptable
+ call Field1c_AnonJumptable
; anonymous dw
dw .Init
dw .Run
@@ -1761,7 +1772,7 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
- call IncrementObjectStructField1c
+ call Field1c_IncAnonJumptableIndex
.Run:
ld hl, OBJECT_STEP_DURATION
@@ -1800,6 +1811,7 @@
.y
db 0, -1, -2, -3, -4, -3, -2, -1
+
UpdateJumpPosition:
call GetStepVector
ld a, h