From b9a74ff777ea9418a94616c3b5a26b932a66981c Mon Sep 17 00:00:00 2001 From: Rangi Date: Thu, 22 Oct 2020 10:54:53 -0400 Subject: [PATCH] Identify more sprite graphics and map object labels, and have consistent anonymous jumptable labels --- engine/battle_anims/bg_effects.asm | 108 ++++---- engine/games/card_flip.asm | 6 +- engine/games/dummy_game.asm | 8 +- engine/gfx/sprite_anims.asm | 294 +++++++++++----------- engine/overworld/cmd_queue.asm | 18 +- engine/overworld/map_objects.asm | 392 +++++++++++++++-------------- 6 files changed, 419 insertions(+), 407 deletions(-) diff --git a/engine/battle_anims/bg_effects.asm b/engine/battle_anims/bg_effects.asm index 2f82ad095..14f7a6fae 100644 --- a/engine/battle_anims/bg_effects.asm +++ b/engine/battle_anims/bg_effects.asm @@ -163,7 +163,7 @@ BattleBGEffects_AnonJumptable: 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 @@ BattleBGEffect_HideMon: 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 @@ BattleBGEffect_BattlerObj_1Row: .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 @@ BattleBGEffect_BattlerObj_1Row: ret .not_flying_digging - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex push bc call BGEffect_CheckBattleTurn jr nz, .player_side @@ -446,7 +446,7 @@ BattleBGEffect_BattlerObj_1Row: ret .one - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex push bc call BGEffect_CheckBattleTurn jr nz, .player_side_2 @@ -475,9 +475,9 @@ BattleBGEffect_BattlerObj_2Row: .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 @@ BattleBGEffect_BattlerObj_2Row: ret .not_flying_digging - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex push bc call BGEffect_CheckBattleTurn jr nz, .player_side @@ -513,7 +513,7 @@ BattleBGEffect_BattlerObj_2Row: ret .one - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex push bc call BGEffect_CheckBattleTurn jr nz, .player_side_2 @@ -547,12 +547,12 @@ BattleBGEffect_RemoveMon: .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 @@ BattleBGEffect_RemoveMon: 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 @@ BattleBGEffect_RunPicResizeScript: 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 @@ BattleBGEffect_RunPicResizeScript: jr z, .skip call .PlaceGraphic .skip - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex ld a, $1 ldh [hBGMapMode], a ret @@ -911,7 +911,7 @@ BattleBGEffect_Surf: dw .two .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex lb de, 2, 2 call InitSurfWaves @@ -977,7 +977,7 @@ BattleBGEffect_Whirlpool: dw .two .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex call BattleBGEffects_ClearLYOverrides ld a, LOW(rSCY) ldh [hLCDCPointer], a @@ -1052,7 +1052,7 @@ BattleBGEffect_Psychic: dw .two .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex call BattleBGEffects_ClearLYOverrides ld a, LOW(rSCX) ldh [hLCDCPointer], a @@ -1089,7 +1089,7 @@ BattleBGEffect_Teleport: dw .two .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex call BattleBGEffects_ClearLYOverrides ld a, LOW(rSCX) call BattleBGEffect_SetLCDStatCustoms1 @@ -1113,7 +1113,7 @@ BattleBGEffect_NightShade: dw .two .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex call BattleBGEffects_ClearLYOverrides ld a, LOW(rSCY) call BattleBGEffect_SetLCDStatCustoms1 @@ -1143,7 +1143,7 @@ BattleBGEffect_DoubleTeam: dw .five .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex call BattleBGEffects_ClearLYOverrides ld a, LOW(rSCX) call BattleBGEffect_SetLCDStatCustoms1 @@ -1176,7 +1176,7 @@ BattleBGEffect_DoubleTeam: ret .next - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex ret .two @@ -1234,7 +1234,7 @@ BattleBGEffect_AcidArmor: dw .two .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex call BattleBGEffects_ClearLYOverrides ld a, LOW(rSCY) call BattleBGEffect_SetLCDStatCustoms1 @@ -1296,7 +1296,7 @@ BattleBGEffect_Withdraw: dw .two .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex call BattleBGEffects_ClearLYOverrides ld a, LOW(rSCY) call BattleBGEffect_SetLCDStatCustoms1 @@ -1345,7 +1345,7 @@ BattleBGEffect_Dig: dw .three .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex call BattleBGEffects_ClearLYOverrides ld a, LOW(rSCY) call BattleBGEffect_SetLCDStatCustoms1 @@ -1371,7 +1371,7 @@ BattleBGEffect_Dig: .next ld [hl], $10 - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex .two ldh a, [hLYOverrideStart] ld l, a @@ -1414,7 +1414,7 @@ BattleBGEffect_Tackle: ; 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 @@ BattleBGEffect_BodySlam: ; 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 @@ Tackle_MoveForward: 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 @@ Tackle_ReturnMove: 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 @@ BattleBGEffect_BetaPursuit: ; unused 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 @@ BattleBGEffect_WobbleMon: dw .two .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex call BattleBGEffects_ClearLYOverrides ld a, LOW(rSCX) call BattleBGEffect_SetLCDStatCustoms1 @@ -1672,7 +1672,7 @@ BattleBGEffect_Flail: dw .two .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex call BattleBGEffects_ClearLYOverrides ld a, LOW(rSCX) call BattleBGEffect_SetLCDStatCustoms1 @@ -1726,7 +1726,7 @@ BattleBGEffect_WaveDeformMon: dw .two .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex call BattleBGEffects_ClearLYOverrides ld a, LOW(rSCX) call BattleBGEffect_SetLCDStatCustoms1 @@ -1768,7 +1768,7 @@ BattleBGEffect_BounceDown: dw .two .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex call BattleBGEffects_ClearLYOverrides ld a, LOW(rSCY) call BattleBGEffect_SetLCDStatCustoms2 @@ -1821,7 +1821,7 @@ BattleBGEffect_BetaSendOutMon1: ; unused dw .five .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex ld a, $e4 call BattleBGEffects_SetLYOverrides ld a, $47 @@ -1861,7 +1861,7 @@ BattleBGEffect_BetaSendOutMon1: ; unused ldh a, [hLYOverrideStart] inc a ldh [hLYOverrideStart], a - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex ret .three @@ -1875,7 +1875,7 @@ BattleBGEffect_BetaSendOutMon1: ; unused ret .finish - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex ret .SetLYOverridesBackup: @@ -1925,7 +1925,7 @@ BattleBGEffect_BetaSendOutMon2: ; unused dw .one .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex call BattleBGEffects_ClearLYOverrides ld a, LOW(rSCX) call BattleBGEffect_SetLCDStatCustoms1 @@ -1965,7 +1965,7 @@ BattleBGEffect_FadeMonsToBlackRepeating: dw .two .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex ld a, $e4 call BattleBGEffects_SetLYOverrides ld a, LOW(rBGP) @@ -2049,7 +2049,7 @@ BattleBGEffect_FadeMonsToBlackRepeating: 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 @@ BattleBGEffect_VibrateMon: dw .one .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex call BattleBGEffects_ClearLYOverrides ld a, LOW(rSCX) call BattleBGEffect_SetLCDStatCustoms1 @@ -2247,7 +2247,7 @@ BattleBGEffect_WobblePlayer: dw .two .zero - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex call BattleBGEffects_ClearLYOverrides ld a, LOW(rSCX) ldh [hLCDCPointer], a @@ -2412,7 +2412,7 @@ BGEffect_RapidCyclePals: dw .two_dmg .zero_dmg - call BattleBGEffects_IncrementJumptable + call BattleBGEffects_IncAnonJumptableIndex ld a, $e4 call BattleBGEffects_SetLYOverrides ld a, $47 @@ -2478,10 +2478,10 @@ BGEffect_RapidCyclePals: .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] diff --git a/engine/games/card_flip.asm b/engine/games/card_flip.asm index 93929fbde..1244ca081 100644 --- a/engine/games/card_flip.asm +++ b/engine/games/card_flip.asm @@ -3,11 +3,11 @@ CARDFLIP_LIGHT_ON EQU "♀" ; $f5 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: diff --git a/engine/games/dummy_game.asm b/engine/games/dummy_game.asm index 940204555..e4bb2d060 100644 --- a/engine/games/dummy_game.asm +++ b/engine/games/dummy_game.asm @@ -14,10 +14,10 @@ _DummyGame: 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 @@ _DummyGame: ret .ResetBoard: - call ret_e00ed + call UnusedCursor_InterpretJoypad_AnimateCursor jr nc, .proceed ld hl, wJumptableIndex set 7, [hl] @@ -232,7 +232,7 @@ endr ld hl, wJumptableIndex inc [hl] .AskPlayAgain: - call ret_e00ed + call UnusedCursor_InterpretJoypad_AnimateCursor jr nc, .restart ld hl, wJumptableIndex set 7, [hl] diff --git a/engine/gfx/sprite_anims.asm b/engine/gfx/sprite_anims.asm index 64a84100d..23c1cde4b 100644 --- a/engine/gfx/sprite_anims.asm +++ b/engine/gfx/sprite_anims.asm @@ -13,52 +13,52 @@ DoAnimFrame: .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 @@ DoAnimFrame: ld [hl], 0 ret -.PartyMonSwitch +AnimSeq_PartyMonSwitch: ld hl, SPRITEANIMSTRUCT_XCOORD add hl, bc ld [hl], 8 * 3 @@ -111,7 +111,7 @@ DoAnimFrame: ld [hl], a ret -.PartyMonSelected +AnimSeq_PartyMonSelected: ld a, [wMenuCursorY] ld hl, SPRITEANIMSTRUCT_INDEX @@ -130,16 +130,15 @@ DoAnimFrame: 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 - -.four_zero - call .IncrementJumptableIndex +.zero + call AnimSeqs_IncAnonJumptableIndex ld hl, SPRITEANIMSTRUCT_INDEX add hl, bc @@ -156,16 +155,16 @@ DoAnimFrame: 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,72 +186,73 @@ DoAnimFrame: ld a, [hl] add 3 ld [hl], a - call .Sprites_Sine + call AnimSeqs_Sine ld hl, SPRITEANIMSTRUCT_YOFFSET add hl, bc ld [hl], a ret -.asm_8d356 +.delete call DeinitializeSprite ret -.GSIntroHoOhLugia +AnimSeq_GSIntroHoOhLugia: ld hl, SPRITEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] inc a ld [hl], a ld d, 2 - call .Sprites_Sine + call AnimSeqs_Sine ld hl, SPRITEANIMSTRUCT_YOFFSET add hl, bc 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 ld [hl], a pop de pop af - call .Sprites_Cosine + call AnimSeqs_Cosine ld hl, SPRITEANIMSTRUCT_XOFFSET add hl, bc @@ -268,18 +268,18 @@ DoAnimFrame: 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,14 +290,14 @@ DoAnimFrame: ld a, [hl] push af push de - call .Sprites_Sine + call AnimSeqs_Sine ld hl, SPRITEANIMSTRUCT_YOFFSET add hl, bc ld [hl], a pop de pop af - call .Sprites_Cosine + call AnimSeqs_Cosine ld hl, SPRITEANIMSTRUCT_XOFFSET add hl, bc @@ -347,15 +347,15 @@ DoAnimFrame: 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 @@ DoAnimFrame: call _ReinitSpriteAnimFrame ret -.SlotsChanseyEgg: +AnimSeq_SlotsChanseyEgg: ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc ld a, [hl] @@ -392,87 +392,86 @@ DoAnimFrame: .move_vertical ld a, e ld d, 32 - call .Sprites_Sine + call AnimSeqs_Sine ld hl, SPRITEANIMSTRUCT_YOFFSET add hl, bc 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 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 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 @@ DoAnimFrame: 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 @@ DoAnimFrame: 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,18 +553,18 @@ DoAnimFrame: call DeinitializeSprite ret -.TrademonInTube +AnimSeq_TrademonInTube: callfar TradeAnim_AnimateTrademonInTube ret -.RevealNewMon: +AnimSeq_RevealNewMon: ld hl, SPRITEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] 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 @@ DoAnimFrame: push af push de - call .Sprites_Sine + call AnimSeqs_Sine ld hl, SPRITEANIMSTRUCT_YOFFSET add hl, bc @@ -584,7 +583,7 @@ DoAnimFrame: pop de pop af - call .Sprites_Cosine + call AnimSeqs_Cosine ld hl, SPRITEANIMSTRUCT_XOFFSET add hl, bc @@ -595,11 +594,11 @@ DoAnimFrame: call DeinitializeSprite ret -.RadioTuningKnob: +AnimSeq_RadioTuningKnob: callfar AnimateTuningKnob ret -.CutLeaves +AnimSeq_CutLeaves: ld hl, SPRITEANIMSTRUCT_VAR2 add hl, bc ld e, [hl] @@ -624,21 +623,21 @@ DoAnimFrame: inc [hl] push af push de - call .Sprites_Sine + call AnimSeqs_Sine ld hl, SPRITEANIMSTRUCT_YOFFSET add hl, bc ld [hl], a pop de pop af - call .Sprites_Cosine + call AnimSeqs_Cosine ld hl, SPRITEANIMSTRUCT_XOFFSET add hl, bc ld [hl], a ret -.FlyFrom: +AnimSeq_FlyFrom: ld hl, SPRITEANIMSTRUCT_YCOORD add hl, bc ld a, [hl] @@ -663,21 +662,21 @@ DoAnimFrame: ld d, a cp $40 jr nc, .skip - add $8 + add 8 ld [hl], a .skip 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 ld [hl], a ret -.FlyLeaf: +AnimSeq_FlyLeaf: ld hl, SPRITEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -695,7 +694,7 @@ DoAnimFrame: 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 @@ DoAnimFrame: call DeinitializeSprite ret -.FlyTo: +AnimSeq_FlyTo: ld hl, SPRITEANIMSTRUCT_YCOORD add hl, bc ld a, [hl] @@ -723,35 +722,36 @@ DoAnimFrame: 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 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 @@ DoAnimFrame: xor $ff inc a ld d, 32 - call .Sprites_Sine + call AnimSeqs_Sine ld hl, SPRITEANIMSTRUCT_YOFFSET add hl, bc @@ -773,26 +773,26 @@ DoAnimFrame: 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,21 +804,21 @@ DoAnimFrame: ld a, [hl] push af push de - call .Sprites_Sine + call AnimSeqs_Sine ld hl, SPRITEANIMSTRUCT_YOFFSET add hl, bc ld [hl], a pop de pop af - call .Sprites_Cosine + call AnimSeqs_Cosine ld hl, SPRITEANIMSTRUCT_XOFFSET add hl, bc ld [hl], a ret -.IntroUnownF +AnimSeq_IntroUnownF: ld a, [wcf64] cp $40 ret nz @@ -826,23 +826,23 @@ DoAnimFrame: 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 @@ DoAnimFrame: 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 diff --git a/engine/overworld/cmd_queue.asm b/engine/overworld/cmd_queue.asm index 3e1b09db5..aab339e6c 100644 --- a/engine/overworld/cmd_queue.asm +++ b/engine/overworld/cmd_queue.asm @@ -134,7 +134,7 @@ HandleQueuedCommand: dba CmdQueue_Type3 dba CmdQueue_Type4 -CmdQueueAnonymousJumptable: +CmdQueues_AnonJumptable: ld hl, CMDQUEUE_05 add hl, bc ld a, [hl] @@ -142,13 +142,13 @@ CmdQueueAnonymousJumptable: 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 @@ CmdQueue_Type1: ret CmdQueue_Type4: - call CmdQueueAnonymousJumptable + call CmdQueues_AnonJumptable ; anonymous dw dw .zero dw .one @@ -172,7 +172,7 @@ CmdQueue_Type4: 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 @@ CmdQueue_Type4: ret CmdQueue_Type3: - call CmdQueueAnonymousJumptable + call CmdQueues_AnonJumptable ; anonymous dw dw .zero dw .one @@ -215,11 +215,11 @@ CmdQueue_Type3: .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 @@ CmdQueue_Type3: .two call .IsPlayerFacingDown jr z, .PlayerNotFacingDown - call CmdQueueAnonJT_Decrement + call CmdQueues_DecAnonJumptableIndex ld hl, CMDQUEUE_03 add hl, bc diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index 5929899bc..c22945cc6 100644 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -433,25 +433,25 @@ RestoreDefaultMovement: 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 @@ MovementAnonymousJumptable: 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 @@ Field1cAnonymousJumptable: 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 @@ ObjectMovementReset: ret MapObjectMovementPattern: - call ClearObjectStructField1c + call Field1c_ZeroAnonJumptableIndex call GetSpriteMovementFunction ld a, [hl] ld hl, .Pointers @@ -521,58 +521,58 @@ MapObjectMovementPattern: .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 @@ MapObjectMovementPattern: ld [hl], a jp RandomStepDuration_Slow -.RandomSpin2: +MovementFunction_RandomSpinFast: ld hl, OBJECT_FACING add hl, bc ld a, [hl] @@ -597,7 +597,7 @@ MapObjectMovementPattern: ld [hl], a jp RandomStepDuration_Fast -.Standing: +MovementFunction_Standing: call Function462a call EndSpriteMovement ld hl, OBJECT_ACTION @@ -608,48 +608,49 @@ MapObjectMovementPattern: 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 @@ MapObjectMovementPattern: 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 @@ MapObjectMovementPattern: ld [hl], OBJECT_ACTION_STAND ret -.MovementBigStanding: +MovementFunction_BigStanding: call EndSpriteMovement ld hl, OBJECT_DIRECTION_WALKING add hl, bc @@ -768,7 +769,7 @@ MapObjectMovementPattern: ld [hl], STEP_TYPE_04 ret -.MovementBouncing: +MovementFunction_Bouncing: call EndSpriteMovement ld hl, OBJECT_DIRECTION_WALKING add hl, bc @@ -781,22 +782,24 @@ MapObjectMovementPattern: 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 @@ MapObjectMovementPattern: 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 @@ MapObjectMovementPattern: 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 @@ MapObjectMovementPattern: 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 @@ MapObjectMovementPattern: 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 @@ MapObjectMovementPattern: 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 @@ MapObjectMovementPattern: 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,16 +948,16 @@ MapObjectMovementPattern: ld [hl], STEP_TYPE_TRACKING_OBJECT ret -.data_4a81 +.dust_coords: ; x, y db 0, -4 db 0, 8 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 @@ MapObjectMovementPattern: 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 @@ MapObjectMovementPattern: ld [hl], d ret -.MovementScreenShake: +MovementFunction_ScreenShake: call EndSpriteMovement ld hl, OBJECT_ACTION add hl, bc @@ -988,7 +997,7 @@ MapObjectMovementPattern: 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 @@ MapObjectMovementPattern: ld [hl], STEP_TYPE_15 ret -._MovementScreenShake: +.GetDurationAndField1e: ld d, a and %00111111 ld e, a @@ -1017,10 +1026,10 @@ MapObjectMovementPattern: 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 @@ MapObjectMovementPattern: 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 @@ SetRandomStepDuration: 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 @@ WaitStep_InPlace: ret NPCJump: - call Field1cAnonymousJumptable -; anonymous dw + call Field1c_AnonJumptable +.anon_dw dw .Jump dw .Land @@ -1125,7 +1136,7 @@ NPCJump: ld hl, OBJECT_FLAGS2 add hl, bc res OVERHEAD_F, [hl] - call IncrementObjectStructField1c + call Field1c_IncAnonJumptableIndex ret .Land: @@ -1142,8 +1153,8 @@ NPCJump: ret PlayerJump: - call Field1cAnonymousJumptable -; anonymous dw + call Field1c_AnonJumptable +.anon_dw dw .initjump dw .stepjump dw .initland @@ -1152,7 +1163,7 @@ PlayerJump: .initjump ld hl, wPlayerStepFlags set PLAYERSTEP_START_F, [hl] - call IncrementObjectStructField1c + call Field1c_IncAnonJumptableIndex .stepjump call UpdateJumpPosition call UpdatePlayerStep @@ -1167,14 +1178,14 @@ PlayerJump: ld hl, wPlayerStepFlags set PLAYERSTEP_STOP_F, [hl] set PLAYERSTEP_MIDAIR_F, [hl] - call IncrementObjectStructField1c + call Field1c_IncAnonJumptableIndex ret .initland call GetNextTile ld hl, wPlayerStepFlags set PLAYERSTEP_START_F, [hl] - call IncrementObjectStructField1c + call Field1c_IncAnonJumptableIndex .stepland call UpdateJumpPosition call UpdatePlayerStep @@ -1191,8 +1202,8 @@ PlayerJump: ret TeleportFrom: - call Field1cAnonymousJumptable -; anonymous dw + call Field1c_AnonJumptable +.anon_dw dw .InitSpin dw .DoSpin dw .InitSpinRise @@ -1205,7 +1216,7 @@ TeleportFrom: 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 @@ TeleportFrom: add hl, bc dec [hl] ret nz - call IncrementObjectStructField1c + call Field1c_IncAnonJumptableIndex ret .InitSpinRise: @@ -1230,7 +1241,7 @@ TeleportFrom: 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 @@ TeleportFrom: ret TeleportTo: - call Field1cAnonymousJumptable -; anonymous dw + call Field1c_AnonJumptable +.anon_dw dw .InitWait dw .DoWait dw .InitDescent @@ -1276,7 +1287,7 @@ TeleportTo: ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], 16 - call IncrementObjectStructField1c + call Field1c_IncAnonJumptableIndex ret .DoWait: @@ -1284,7 +1295,7 @@ TeleportTo: 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 @@ TeleportTo: ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], 16 - call IncrementObjectStructField1c + call Field1c_IncAnonJumptableIndex ret .DoDescent: @@ -1317,12 +1328,12 @@ TeleportTo: 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 @@ TeleportTo: ret Skyfall: - call Field1cAnonymousJumptable -; anonymous dw + call Field1c_AnonJumptable +.anon_dw dw .Init dw .Step dw .Fall @@ -1360,7 +1371,7 @@ Skyfall: 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 @@ Skyfall: 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 @@ Skyfall: 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 @@ Skyfall: ret GotBiteStep: - call Field1cAnonymousJumptable -; anonymous dw + call Field1c_AnonJumptable +.anon_dw dw .Init dw .Run @@ -1421,7 +1432,7 @@ GotBiteStep: 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 @@ StepTypeBump: ret StepType05: - call Field1cAnonymousJumptable -; anonymous dw + call Field1c_AnonJumptable +.anon_dw dw .Reset dw StepType04 @@ -1517,7 +1528,7 @@ StepType05: 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,15 +1563,15 @@ StepType07: PlayerStep: ; AnimateStep? - call Field1cAnonymousJumptable -; anonymous dw + call Field1c_AnonJumptable +.anon_dw dw .init dw .step .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 @@ PlayerStep: ret PlayerOrNPCTurnStep: - call Field1cAnonymousJumptable -; anonymous dw + call Field1c_AnonJumptable +.anon_dw dw .init1 dw .step1 dw .init2 @@ -1597,13 +1608,13 @@ PlayerOrNPCTurnStep: 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 @@ PlayerOrNPCTurnStep: 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 @@ StepTypeTrackingObject: StepType14: StepType15: - call Field1cAnonymousJumptable -; anonymous dw + call Field1c_AnonJumptable +.anon_dw dw .Init dw .Run @@ -1701,7 +1712,7 @@ StepType15: ld hl, OBJECT_1D add hl, bc ld [hl], a - call IncrementObjectStructField1c + call Field1c_IncAnonJumptableIndex .Run: ld hl, OBJECT_1D add hl, bc @@ -1739,17 +1750,17 @@ StepType15: ret StepType16: - call Field1cAnonymousJumptable ; ???? + call Field1c_AnonJumptable ; ???? StepType17: - call Field1cAnonymousJumptable -; anonymous dw + call Field1c_AnonJumptable +.anon_dw dw .null dw .null dw .null .null SkyfallTop: - call Field1cAnonymousJumptable + call Field1c_AnonJumptable ; anonymous dw dw .Init dw .Run @@ -1761,7 +1772,7 @@ SkyfallTop: 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 @@ Stubbed_Function4fb2: .y db 0, -1, -2, -3, -4, -3, -2, -1 + UpdateJumpPosition: call GetStepVector ld a, h