Add Deku Link spin ability WIP, refactor all_masks bank and free space management

This commit is contained in:
scawful
2024-02-22 09:40:13 -05:00
parent 57ed62106b
commit 94f044cf95
8 changed files with 385 additions and 215 deletions

View File

@@ -1,20 +1,62 @@
; $02B2 - Mask Form
; =========================================================
; Oracle of Secrets - Mask Library
; =========================================================
; 00 = Human
; 01 = Deku
; 02 = Zora
; 03 = Wolf
; 04 = Bunny Hood
; 05 = Minish Form
;
; $0AAB - Diving Flag
!CurrentMask = $02B2
; Indexed by the bank number
!LinkGraphics = $BC
!ZoraDiving = $0AAB
; =========================================================
org $09912C
AddTransformationCloud:
org $07B073
Link_CheckNewY_ButtonPress:
org $07B0AB
LinkItem_EvaluateMagicCost:
org $078028
Player_DoSfx2:
; =========================================================
incsrc "Masks/mask_routines.asm"
incsrc "Masks/bunny_hood.asm"
print "End of Masks/bunny_hood.asm ", pc
; Start of free space in bank 07
org $07F89D : pushpc
incsrc "Masks/minish_form.asm"
incsrc "Masks/deku_mask.asm"
incsrc "Masks/zora_mask.asm"
incsrc "Masks/wolf_mask.asm"
incsrc "Masks/gbc_form.asm"
org $378000
incbin gfx/bunny_link.4bpp
incsrc "Masks/bunny_hood.asm"
print "End of Masks/bunny_hood.asm ", pc
org $398000
incbin gfx/minish_link.4bpp
print "End of Minish Form GFX ", pc
incsrc "Masks/minish_form.asm"
org $358000
incbin gfx/deku_link.bin
incsrc "Masks/deku_mask.asm"
org $368000
incbin gfx/zora_link.4bpp
incsrc "Masks/zora_mask.asm"
org $388000
incbin gfx/wolf_link.4bpp
incsrc "Masks/wolf_mask.asm"
org $3B8000
incbin gfx/gbc_link.4bpp
incsrc "Masks/gbc_form.asm"

View File

@@ -19,11 +19,6 @@
;
; =============================================================================
org $378000
incbin gfx/bunny_link.4bpp
; =============================================================================
UpdateBunnyPalette:
{
REP #$30 ; change 16bit mode

View File

@@ -2,35 +2,20 @@
; Deku Mask
; =========================================================
org $358000
incbin gfx/deku_link.bin
; =========================================================
org $07B0AB
LinkItem_EvaluateMagicCost:
org $07A64B ; formerly Quake
LinkItem_DekuMask:
{
JSR Link_CheckNewY_ButtonPress : BCC .continue
LDX.b #$01
JSR LinkItem_EvaluateMagicCost : BCC .return
LDA.b #$0A : STA $5D
LDX.b #$01 : JSR LinkItem_EvaluateMagicCost : BCC .return
JSL PrepareQuakeSpell
RTS
.continue
; Check for R button held
%CheckNewR_ButtonPress() : BEQ .return
LDA $6C : BNE .return ; in a doorway
LDA $0FFC : BNE .return ; can't open menu
%PlayerTransform()
LDA $02B2 : CMP #$01 : BEQ .unequip ; is the deku mask on?
JSL Palette_ArmorAndGloves ; set the palette
@@ -55,99 +40,7 @@ LinkItem_DekuMask:
RTS
}
; =========================================================
org $07E370
LinkHop_FindArbitraryLandingSpot:
org $07A6D6
LinkState_UsingQuake:
{
}
warnpc $07A779
org $348000
; org $07A013
; JSL LinkItem_SlingshotPrepare
; Hooked @ [$07A013]
; $A200
LinkItem_SlingshotPrepare:
{
LDA #$01 : TSB $50
LDA $7EF340
BNE .alpha
JMP .beta ; $A270
.alpha
CMP #$01
BNE .void ; unused afaik (RTS?)
JMP .beta
; $A214
.void
; $A270
.beta
LDA $7F1060
CMP #$10
BEQ $20A27B
JMP .theta
; $A300
.theta
LDA $7F502E
CMP #$01
BNE .gamma
RTL
; $A309
.gamma
LDA #$01 ; Load the accumulator with hex value 01
STA $7F502E ; Store the accumulator value at memory address 7F502E
PHB ; Push data bank register on stack
REP #$30 ; Clear 16-bit accumulator and index registers
LDX #$A500 ; Load X register with source address
LDY #$9800 ; Load Y register with destination address
LDA #$00BF ; Load the accumulator with the number of bytes to be moved
MVN $20, $7E ; Block move negative - moves 00BF bytes from $A500 to $9800
SEP #$30 ; Set 8-bit accumulator and index registers
PLB ; Pull data bank register from stack
.loop
LDA $4212 : AND #$80 : BNE .loop ; Wait for VBlank start (beginning of vertical blanking period)
.loop2
LDA $4212 : AND #$80 : BEQ .loop2 ; Wait for VBlank end
REP #$30 ; Clear 16-bit accumulator and index registers
LDA #$A700 : STA $4302 ; Set DMA source address to $A700
LDA #$42A0 : STA $2116 ; Set VRAM (Video RAM) address to $42A0
SEP #$30 ; Set 8-bit accumulator and index registers
LDA #$80 : STA $2115 ; Set VRAM write increment to 2 bytes, and access mode to word access at the specified address
LDA #$18 : STA $4301 ; Set DMA destination address to $2118 (VRAM data write)
LDA #$20 : STA $4304 ; Set DMA transfer size to 32 bytes
LDA #$80 : STA $4305 ; Set DMA transfer size (high byte)
LDA #$01 : STA $4300 ; Set DMA mode to 1 (2 registers write once)
STA $420B ; Start DMA on channel 0
REP #$30 ; Clear 16-bit accumulator and index registers
LDA #$43A0 : STA $2116 ; Set VRAM address to $43A0
LDA #$A800 : STA $4302 ; Set DMA source address to $A800
SEP #$30 ; Set 8-bit accumulator and index registers
LDA #$80 : STA $2115 ; Set VRAM write increment to 2 bytes, and access mode to word access at the specified address
LDA #$18 : STA $4301 ; Set DMA destination address to $2118 (VRAM data write)
LDA #$20 : STA $4304 ; Set DMA transfer size to 32 bytes
LDA #$80 : STA $4305 ; Set DMA transfer size (high byte)
LDA #$01 : STA $4300 ; Set DMA mode to 1 (2 registers write once)
STA $420B ; Start DMA on channel 0
RTL
}
warnpc $07A6BE
; =========================================================
@@ -155,11 +48,11 @@ org $07811A
JSR Link_HandleDekuTransformation
pullpc ; Bank 07 Free Space from minish_form
Link_HandleDekuTransformation: ; Link_HandleBunnyTransformation
Link_HandleDekuTransformation:
{
; Check if using Quake Medallion
LDA $5D : CMP.b #$0A : BEQ .continue
JSR $82DA
; JSR $82DA ; Link_HandleBunnyTransformation
.continue
STZ $03F5
@@ -173,3 +66,124 @@ Link_HandleDekuTransformation: ; Link_HandleBunnyTransformation
print "End of Masks/deku_mask.asm ", pc
pushpc
org $07E370
LinkHop_FindArbitraryLandingSpot:
org $078926
Link_HandleChangeInZVelocity:
org $078932
Link_HandleChangeInZVelocity_preset:
org $099589
AncillaAdd_QuakeSpell:
org $078028
PlaySFX_Set2:
org $07802F
PlaySFX_Set3:
org $07A6BE
LinkState_UsingQuake:
{
.anim_step
db #$00, #$01, #$02, #$03
db #$00, #$01, #$02, #$03
db #$10, #$10, #$00, #$00 ; 16
.anim_timer
db 5, 5, 5, 5
db 5, 5, 5, 5
db 5, 5, 5, 19
; INC.w $0FC1 ; Keep sprites frozen
STZ.b $27 : STZ.b $28 ; Reset recoil X and Y
; SPIN STEP CHECK
LDA.w $031D : CMP.b #$0A : BNE .not_ascending
LDA.w $0362 : STA.b $29
LDA.w $0363 : STA.w $02C7
LDA.w $0364 : STA.b $24
LDA.b #$02 : STA.b $00 : STA.b $4D
JSR Link_HandleChangeInZVelocity_preset
JSL LinkHop_FindArbitraryLandingSpot
; Link recoil Z value, hop Z value
LDA.b $29 : STA.w $0362
LDA.w $02C7 : STA.w $0363
; Z Position of Link
LDA.b $24 : STA.w $0364 : BMI .still_ascending
; End of ASCEND -----------------------------------------
; Link recoil Z
LDY.b #$00 : LDA.b $29 : BPL .done_ascending
LDY.b #$00 ; Thrust Sword Down OAM Frame Set
.done_ascending
STY.w $031C : BRA .exit
; -------------------------------------------------------
.not_ascending
DEC.b $3D : BPL .special
.still_ascending
INC.w $031D
; $031D - Spin Step
LDX.w $031D : CPX.b #$04 : BNE .skip_swish_sfx
PHX : LDA.b #$23 : JSR PlaySFX_Set3 : PLX
.skip_swish_sfx
CPX.b #$0A : BNE .skip_ping_sfx
; PHX : LDA.b #$2C : JSR PlaySFX_Set2 : PLX
.skip_ping_sfx
CPX.b #$0B : BNE .skip_boom_sfx
; LDA.b #$0C : JSR PlaySFX_Set2
.skip_boom_sfx
CPX.b #$0C : BNE .dont_reset_step
LDA.b #$0B : STA.w $031D
TAX
.dont_reset_step
LDA.w .anim_timer,X : STA.b $3D
LDA.w .anim_step,X : STA.w $031C
LDA.w $0324 : BNE .special ; Prevent repeat spellcast check
CPX.b #$0B : BNE .special ; Animation step check
; -----------------------------------------------------
; Prevent repeat spellcast set
LDA.b #$01 : STA.w $0324
LDA.b #$12 : STA $24
LDA.b #$FF : STA $5C
LDA.b #$01 : STA $70
; ; Quake Spell, End Quake State happens during Ancilla
; LDY.b #$00 : LDA.b #$1C ; ANCILLA 1C
; JSL AncillaAdd_QuakeSpell
; STZ.b $4D : STZ.w $0046
; -----------------------------------------------------
.exit
RTS
.special
DEC $5C
; JSR $F514 ; CacheCameraPropertiesIfOutdoors
JSL DekuLink_HoverBasedOnInput
; JSR $E8F0
RTS
}
warnpc $07A779

View File

@@ -1,7 +1,7 @@
org $3B8000
incbin gfx/gbc_link.4bpp
; ========================================
; GBC Link
; ========================================
print pc
UpdateGbcPalette:
{
REP #$30 ; change 16bit mode
@@ -29,19 +29,19 @@ UpdateGbcPalette:
GameboyLinkPalette:
{
dw #$0000, #$7FFF, #$237E, #$B711, #$369E, #$14A5, #$01FF, #$1078, #$46FF
dw #$22A2, #$3B68, #$0A4A, #$12EF, #$2A5C, #$1571, #$7A18
dw #$0000, #$7FFF, #$237E, #$B711, #$369E, #$14A5, #$01FF, #$1078
dw #$46FF, #$22A2, #$3B68, #$0A4A, #$12EF, #$2A5C, #$1571, #$7A18
}
GameboyLinkBlueMail:
{
dw #$0000, #$7FFF, #$237E, #$B711, #$369E, #$14A5, #$01FF, #$1078, #$46FF
dw #$4D25, #$3B68, #$0A4A, #$12EF, #$2A5C, #$1571, #$7A18
dw #$0000, #$7FFF, #$237E, #$B711, #$369E, #$14A5, #$01FF, #$1078
dw #$46FF, #$4D25, #$3B68, #$0A4A, #$12EF, #$2A5C, #$1571, #$7A18
}
LinkState_GameboyInDungeonEntrance:
{
; if link is in the dark world, change his sprite to the gbc one
LDA $0FFF : CMP #$00 : BEQ .return
LDA $BC : CMP #$06 : BEQ .return

View File

@@ -1,20 +1,6 @@
; =============================================================================
; Oracle of Secrets - Mask Library
; =============================================================================
!CurrentMask = $02B2
!LinkGraphics = $BC
; =============================================================================
org $09912C
AddTransformationCloud:
org $07B073
Link_CheckNewY_ButtonPress:
org $078028
Player_DoSfx2:
; =========================================================
; Macros
macro PlayerTransform()
LDY.b #$04 : LDA.b #$23
@@ -32,8 +18,8 @@ macro CheckNewR_ButtonPress()
LDA.b $F6 : BIT.b #$10
endmacro
org $02A560
JSL ForceResetWorldMap : NOP
; org $02A560
; JSL ForceResetWorldMap
; GameOver_DelayBeforeIris
org $09F347
@@ -43,9 +29,9 @@ org $09F347
org $09F7B5
JSL ForceResetMask_SaveAndQuit
; =============================================================================
; =========================================================
; Change Link's sprite by setting $BC to the bank containing a spritesheet.
; =============================================================================
; =========================================================
org $008827
JSL StartupMasks
@@ -54,9 +40,9 @@ org $008827
org $008A01
LDA $BC
; =============================================================================
; =========================================================
; Change Link's palette based on $02B2 (mask value)
; =============================================================================
; =========================================================
org $1BEDF9
JSL Palette_ArmorAndGloves ; 4bytes
@@ -67,9 +53,9 @@ org $1BEE1B
JSL Palette_ArmorAndGloves_part_two
RTL
; =============================================================================
; =========================================================
; EXPANDED SPACE
; =============================================================================
; =========================================================
org $3A8000
StartupMasks:
@@ -122,7 +108,7 @@ ForceResetMask_SaveAndQuit:
RTL
}
; =============================================================================
; =========================================================
Palette_ArmorAndGloves:
{
@@ -209,9 +195,9 @@ Palette_ArmorAndGloves:
RTL
}
; =============================================================================
; =========================================================
; Overworld Palette Persist
; =============================================================================
; =========================================================
Overworld_CgramAuxToMain_Override:
{
@@ -246,7 +232,7 @@ Overworld_CgramAuxToMain_Override:
}
pushpc
; =============================================================================
; =========================================================
org $02C769
Overworld_CgramAuxToMain:
@@ -255,14 +241,15 @@ Overworld_CgramAuxToMain:
RTS
}
; =============================================================================
; =========================================================
; Change which mask forms have access to the sword.
; =============================================================================
; =========================================================
; Link_CheckForSwordSwing
org $079CD9
JSL LinkItem_CheckForSwordSwing_Masks
; =============================================================================
; =========================================================
pullpc
LinkItem_CheckForSwordSwing_Masks:
@@ -275,11 +262,159 @@ LinkItem_CheckForSwordSwing_Masks:
RTL
.return
LDA $3B : AND.b #$10
LDA $3B : AND.b #$10 ; Restore Link_CheckForSwordSwing
RTL
}
; Modifies the value of the Y register before it indexes the table
; LinkOAM_AnimationStepDataOffsets
; This is used to change the animation during 0x0A (Using Quake Medallion)
DekuLink_SpinOrRecoil:
{
TAY
LDA $70 : BEQ .spin
TYA
LDY.b #$05 ; Recoil
JML $0DA435 ;JML $0DA40B
.spin
TYA
LDY.b #$1B ; Spin and die
JML $0DA40B
}
pushpc
; Spin and die, LinkOAM_AnimationStepDataOffsets
org $0DA3FD
JML DekuLink_SpinOrRecoil
pullpc
; Based on LinkItem_Quake.allow_quake
PrepareQuakeSpell:
{
; Ancilla setup stuff, not necessary
; #_07A680: LDA.w $0C4A
; #_07A683: ORA.w $0C4B
; #_07A686: ORA.w $0C4C
; This would set link to strafe mode
; Probably not necessary
; #_07A696: LDA.b #$01
; #_07A698: TSB.b $50
; TODO: Set a check for the Deku Flower sprite before activating this ability.
LDA.b #$0A : STA $5D
#_07A69A: LDA #$00
#_07A69D: STA.b $3D
#_07A69F: LDA #$00
#_07A6A2: STA.w $031C
#_07A6A5: STZ.w $031D
#_07A6A8: STZ.w $0324
#_07A6AB: STZ.b $46
; Set the spin and jump animation values.
#_07A6AD: LDA.b #$28
#_07A6AF: STA.w $0362
#_07A6B2: STA.w $0363
#_07A6B5: STZ.w $0364
STZ $70
RTL
}
DekuLink_HoverBasedOnInput:
{
JSL $07E6A6
LDA $5C : AND #$1F : BNE .continue_me
DEC $24
.continue_me
LDA $5C : BEQ .auto_cancel
LDA $F0 : AND #$08 : BEQ .not_up
LDA $20 : CLC : ADC #-1 : STA $20
LDA #$01 : STA $031C
LDA #$05 : STA $3D
STZ $2F
.not_up
LDA $F0 : AND #$04 : BEQ .not_down
LDA $20 : CLC : ADC #1 : STA $20
LDA #$02 : STA $031C
LDA #$05 : STA $3D
LDA #$02 : STA $2F
.not_down
LDA $F0 : AND #$02 : BEQ .not_left
LDA $22 : CLC : ADC #-1 : STA $22
LDA #$03 : STA $031C
LDA #$05 : STA $3D
LDA #$04 : STA $2F
.not_left
LDA $F0 : AND #$01 : BEQ .not_right
LDA $22 : CLC : ADC #1 : STA $22
LDA #$04 : STA $031C
LDA #$05 : STA $3D
LDA #$06 : STA $2F
.not_right
LDA $70 : BEQ .no_bomb_drop
LDA $F0 : AND #%01000000 : BEQ .no_bomb_drop
#_07A14F: LDY.b #$01
#_07A151: LDA.b #$07 ; ANCILLA 07
#_07A153: JSL $09811F ; AncillaAdd_Bomb
.no_bomb_drop
LDA $F0 : AND #%10000000 : BEQ .no_cancel
.auto_cancel
STZ $5D
#_08B6A5: LDA.b #$01
#_08B6A7: STA.w $0AAA
#_08B6AA: STZ.w $0324
#_08B6AD: STZ.w $031C
#_08B6B0: STZ.w $031D
#_08B6B3: STZ.b $50
#_08B6B5: STZ.b $3D
#_08B6B7: STZ.w $0FC1
#_08B6BA: STZ.w $011A
#_08B6BD: STZ.w $011B
#_08B6C0: STZ.w $011C
#_08B6C3: STZ.w $011D
.no_turtle_rock_trigger
#_08B6E4: LDY.b #$00
#_08B6E6: LDA.b $3C
#_08B6E8: BEQ .no_sword_charge
#_08B6EA: LDA.b $F0
#_08B6EC: AND.b #$80
#_08B6EE: TAY
.no_sword_charge
#_08B6EF: STY.b $3A
#_08B6F1: STZ.b $5E
#_08B6F3: STZ.w $0325
.no_cancel
RTL
}
print "End of mask_routines.asm ", pc
; =============================================================================

View File

@@ -4,24 +4,17 @@
; Reacts to Tile ID 64 to transform into Minish Link
; =========================================================
org $398000
incbin gfx/minish_link.4bpp
print "End of Minish Form GFX ", pc
; =========================================================
org $07DA2A
TileDetection_OverworldAttributeJumpTable:
; org $07DAEB ; Tile ID 61
org $07DAF2
dw LinkState_CheckForMinishForm ; Tile ID 64
dw LinkState_CheckMinishTile ; Tile ID 65
; =========================================================
; Start of free space in bank 07
org $07F89D
pullpc
LinkState_CheckForMinishForm:
{
SEP #$30

View File

@@ -6,11 +6,6 @@
;
; =============================================================================
org $388000
incbin gfx/wolf_link.4bpp
; =============================================================================
UpdateWolfPalette:
{
REP #$30 ; change 16bit mode

View File

@@ -9,16 +9,6 @@
; How To Use:
; Press R to transform into Zora Link. Press R again to transform back.
; Press Y in deep water to dive. Press Y again to resurface.
;
; RAM Used:
; $02B2 - Current Form
; $0AAB - Diving Flag
;
; =============================================================================
org $368000
incbin gfx/zora_link.4bpp
; =============================================================================
UpdateZoraPalette:
@@ -39,10 +29,16 @@ UpdateZoraPalette:
; TODO: Change from "bunny palette" to blue zora palette colors
zora_palette:
dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$19FD, #$14B6
dw #$55BB, #$362A, #$3F4E, #$162B, #$22D0, #$2E5A, #$1970, #$7616
dw #$6565, #$7271, #$2AB7, #$477E, #$1997, #$14B5, #$459B, #$69F2
dw #$7AB8, #$2609, #$19D8, #$3D95, #$567C, #$1890, #$52F6, #$2357, #$0000
dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$4E48, #$3582
dw #$55BB, #$6EF7, #$7BDE, #$55C7, #$6ECD, #$2E5A, #$1970, #$7616
; dw #$6565, #$7271, #$2AB7, #$477E, #$1997, #$14B5, #$459B, #$69F2
; dw #$7AB8, #$2609, #$19D8, #$3D95, #$567C, #$1890, #$52F6, #$2357, #$0000
; zora_palette:
; dw #$7BDE, #$7FFF, #$2F7D, #$19B5, #$3A9C, #$14A5, #$19FD, #$14B6
; dw #$55BB, #$362A, #$3F4E, #$162B, #$22D0, #$2E5A, #$1970, #$7616
; dw #$6565, #$7271, #$2AB7, #$477E, #$1997, #$14B5, #$459B, #$69F2
; dw #$7AB8, #$2609, #$19D8, #$3D95, #$567C, #$1890, #$52F6, #$2357, #$0000
; =============================================================================
@@ -56,7 +52,7 @@ org $07A569
LinkItem_ZoraMask:
{
; No removing the mask whilst diving.
LDA $0AAB : BNE .return
LDA !ZoraDiving : BNE .return
; Check for R button held
%CheckNewR_ButtonPress() : BEQ .return
@@ -120,10 +116,10 @@ LinkState_UsingZoraMask:
LDA $3A : AND.b #$BF : STA $3A
; Check if already underwater
LDA $0AAB : BEQ .dive
LDA !ZoraDiving : BEQ .dive
STZ $55 ; Reset cape flag
STZ $0AAB ; Reset underwater flag
STZ !ZoraDiving ; Reset underwater flag
STZ $0351 ; Reset ripple flag
STZ $037B ; Reset invincibility flag
LDA #$04 : STA $5D ; Put Link in Swimming State
@@ -135,7 +131,7 @@ LinkState_UsingZoraMask:
LDA #$01 : STA $55 ; Set cape flag
STA $037B ; Set invincible flag
LDA #$08 : STA $5E ; Set underwater speed
LDA #$01 : STA $0AAB ; Set underwater flag
LDA #$01 : STA !ZoraDiving ; Set underwater flag
STA $0351 ; Set ripple flag
; Splash visual effect
@@ -159,7 +155,7 @@ LinkState_UsingZoraMask:
LDA $5D : CMP #$04 : BNE .return_dungeon : CLC
; Check if already underwater
LDA $0AAB : BNE .return_dungeon : CLC
LDA !ZoraDiving : BNE .return_dungeon : CLC
; Check if we are on a proper tile or not
;
@@ -185,7 +181,7 @@ LinkState_UsingZoraMask:
STZ $0345 ; Reset deep water flag
LDA #$01
STA $0AAB ; Set the player underwater flag
STA !ZoraDiving ; Set the player underwater flag
.return_dungeon
JSR $E8F0 ; HandleIndoorCameraAndDoors
@@ -198,7 +194,7 @@ pushpc
; End of LinkState_Default
org $0782D2
JSR LinkState_UsingZoraMask_dungeon_resurface
JSR $E8F0
JSR $E8F0 ; HandleIndoorCameraAndDoors
CLC
RTS
@@ -211,7 +207,7 @@ pullpc
LDA $1B : BEQ .return_default ; We are in overworld actually
; Check if the player is actually diving
LDA $0AAB : BEQ .return_default
LDA !ZoraDiving : BEQ .return_default
LDA $0114 : CMP #$85 : BEQ .player_is_falling
LDA $0114 : CMP #$09 : BEQ .player_is_falling
@@ -238,7 +234,7 @@ pullpc
.player_is_falling
LDA $67 : AND #$01 : STA $2F
STZ $5E ; Reset speed to normal
STZ $0AAB ; Reset underwater flag
STZ !ZoraDiving ; Reset underwater flag
STZ $0351 ; Reset ripple flag
STZ $24 ; Reset z coordinate for link
STZ $0372 ; Reset link bounce flag
@@ -264,7 +260,7 @@ pullpc
{
LDA $02B2 : CMP #$02 : BNE .return_hop
STZ $5E ; Reset speed to normal
STZ $0AAB ; Reset underwater flag
STZ !ZoraDiving ; Reset underwater flag
LDA #$62 : STA $9A ; Reset dungeon layer
.return_hop
LDA #$06 : STA $5D ; Set Link to Recoil State