cleanup deku mask and bunny hood code

This commit is contained in:
scawful
2024-05-12 12:39:26 -04:00
parent f98a83559a
commit aa3da8e8ad
3 changed files with 87 additions and 109 deletions

View File

@@ -46,15 +46,15 @@ print "End of Bunny Hood GFX ", pc
; =========================================================
; Bunny Hood Speed Modification
; Link_HandleVelocity_load_subvel
org $07E330
JSR Link_CheckForBunnyRun
CLC
JSR Link_CheckForBunnyRun
CLC
; org $87FD66
pullpc
Link_CheckForBunnyRun:
JSL LinkState_BunnyHoodRun
RTS
JSL LinkState_BunnyHoodRun
RTS
pushpc
org $20AF20

View File

@@ -1,5 +1,10 @@
; =========================================================
; Deku Mask
; Deku Mask
; Press R to transform into Deku Link
; Press Y to perform a spin and jump, allowing you to hover
; for a short period of time, as well as drop bombs while
; hovering with the Y button, and cancelling the hover with
; the B button.
; =========================================================
UpdateDekuPalette:
@@ -20,27 +25,21 @@ deku_palette:
dw #$6739, #$15C5, #$150E, #$26C9, #$17AA, #$21F4, #$17DF, #$42DB
dw #$14A5, #$14BC, #$14B2, #$14A5, #$7FFF, #$7A18, #$178C
; =========================================================
org $07A64B ; formerly Quake
LinkItem_DekuMask:
{
JSR Link_CheckNewY_ButtonPress : BCC .continue
LDX.b #$01 : JSR LinkItem_EvaluateMagicCost : BCC .return
JSL PrepareQuakeSpell
RTS
LDX.b #$01
JSR LinkItem_EvaluateMagicCost : BCC .return
JSL PrepareQuakeSpell
RTS
.continue
LDA #$01
JSL Link_TransformMask : BCC .return
STA $02F5 ; Somaria platform flag, no dash.
; .unequip
; STZ $5D
; ; Restore the shield
; LDA $0AAF : STA.l $7EF35A
; STZ $02F5
; %ResetToLinkGraphics()
LDA #$01 : STA $02F5 ; Somaria platform flag, no dash.
.return
RTS
@@ -53,7 +52,7 @@ warnpc $07A6BE
org $07811A
JSR Link_HandleDekuTransformation
pullpc ; Bank 07 Free Space from minish_form
pullpc ; Free space in bank07 - all_sprites.asm
Link_HandleDekuTransformation:
{
; Check if using Quake Medallion
@@ -78,9 +77,6 @@ org $078926
org $078932
Link_HandleChangeInZVelocity_preset:
org $099589
AncillaAdd_QuakeSpell:
org $078028
PlaySFX_Set2:
@@ -100,7 +96,6 @@ LinkState_UsingQuake:
db 5, 5, 5, 5
db 5, 5, 5, 19
; INC.w $0FC1 ; Keep sprites frozen
JSR $F514 ; CacheCameraPropertiesIfOutdoors
STZ.b $27 : STZ.b $28 ; Reset recoil X and Y
@@ -170,11 +165,6 @@ LinkState_UsingQuake:
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
@@ -183,7 +173,6 @@ LinkState_UsingQuake:
.special
DEC $5C
JSL DekuLink_HoverBasedOnInput
JSR $E8F0 ; HandleIndoorCameraAndDoors
RTS
}

View File

@@ -324,42 +324,28 @@ 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
LDA.b #$0A : STA.b $5D ; Set Link to the hover state
LDA.b #$00 : STA.b $3D ; Clear the animation timer
#_07A69A: LDA #$00
#_07A69D: STA.b $3D
LDA #$00 : STA.w $031C ; Clear the spin animation gfx
STZ.w $031D ; Clear the spin animation step
STZ.w $0324 ; Prevent multiple ancillae from being added
STZ.b $46 ; Clear the link damage timer
#_07A69F: LDA #$00
#_07A6A2: STA.w $031C
#_07A6A5: STZ.w $031D
; Set low and high of HOPVZ2
; Usually used as the hopping speed for diagonal jumps
LDA.b #$28 : STA.w $0362 : STA.w $0363
STZ.w $0364 ; Clear Z-coordinate for the jump
#_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
STZ $70 ; Clear bomb drop check flag
RTL
}
; =========================================================
HandleCamera:
{
LDA $22 : SEC : SBC $3F : STA $31
@@ -374,6 +360,8 @@ HandleCamera:
RTS
}
; =========================================================
HandleMovement:
{
LDA $F0 : AND #$08 : BEQ .not_up
@@ -382,6 +370,7 @@ HandleMovement:
LDA #$01 : STA $031C
LDA #$05 : STA $3D
STZ $2F
; DEC.b $E8
.not_up
LDA $F0 : AND #$04 : BEQ .not_down
LDA $20 : CLC : ADC #1 : STA $20
@@ -389,6 +378,7 @@ HandleMovement:
LDA #$02 : STA $031C
LDA #$05 : STA $3D
LDA #$02 : STA $2F
; INC.b $E8
.not_down
LDA $F0 : AND #$02 : BEQ .not_left
LDA $22 : CLC : ADC #-1 : STA $22
@@ -396,6 +386,7 @@ HandleMovement:
LDA #$03 : STA $031C
LDA #$05 : STA $3D
LDA #$04 : STA $2F
; DEC.b $E2
.not_left
LDA $F0 : AND #$01 : BEQ .not_right
LDA $22 : CLC : ADC #1 : STA $22
@@ -403,81 +394,79 @@ HandleMovement:
LDA #$04 : STA $031C
LDA #$05 : STA $3D
LDA #$06 : STA $2F
; INC.b $E2
.not_right
LDA.w $22 : STA $0FD8
LDA.w $23 : STA $0FD9
LDA.w $20 : STA $0FDA
LDA.w $21 : STA $0FDB
LDA.w $22 : STA $0FD8 : LDA.w $23 : STA $0FD9
LDA.w $20 : STA $0FDA : LDA.w $21 : STA $0FDB
RTS
}
; =========================================================
DekuLink_HoverBasedOnInput:
{
JSR HandleCamera
JSR HandleCamera
LDA $5C : AND #$1F : BNE .continue_me
DEC $24
.continue_me
LDA $5C : AND #$1F : BNE .continue_me
DEC $24
.continue_me
LDA $5C : BEQ .auto_cancel
LDA $5C : BEQ .auto_cancel
JSR HandleMovement
JSR HandleMovement
LDA $70 : BEQ .no_bomb_drop
LDA $F0 : AND #%01000000 : BEQ .no_bomb_drop
LDA $70 : BEQ .no_bomb_drop
LDA $F0 : AND #%01000000 : BEQ .no_bomb_drop
LDY.b #$01 : LDA.b #$07 ; ANCILLA 07
JSL $09811F ; AncillaAdd_Bomb
.no_bomb_drop
#_07A14F: LDY.b #$01
#_07A151: LDA.b #$07 ; ANCILLA 07
#_07A153: JSL $09811F ; AncillaAdd_Bomb
LDA $F0 : AND #%10000000 : BEQ .no_cancel
.no_bomb_drop
.auto_cancel
LDA $F0 : AND #%10000000 : BEQ .no_cancel
; Reset LinkState to Default
STZ $5D
.auto_cancel
#_08B6A5: LDA.b #$01
#_08B6A7: STA.w $0AAA
; Reset LinkState to Default
STZ $5D
#_08B6AA: STZ.w $0324
#_08B6AD: STZ.w $031C
#_08B6B0: STZ.w $031D
#_08B6A5: LDA.b #$01
#_08B6A7: STA.w $0AAA
#_08B6B3: STZ.b $50
#_08B6B5: STZ.b $3D
#_08B6AA: STZ.w $0324
#_08B6AD: STZ.w $031C
#_08B6B0: STZ.w $031D
#_08B6B7: STZ.w $0FC1
#_08B6B3: STZ.b $50
#_08B6B5: STZ.b $3D
#_08B6BA: STZ.w $011A
#_08B6BD: STZ.w $011B
#_08B6C0: STZ.w $011C
#_08B6C3: STZ.w $011D
#_08B6B7: STZ.w $0FC1
.no_turtle_rock_trigger
#_08B6E4: LDY.b #$00
#_08B6BA: STZ.w $011A
#_08B6BD: STZ.w $011B
#_08B6C0: STZ.w $011C
#_08B6C3: STZ.w $011D
#_08B6E6: LDA.b $3C
#_08B6E8: BEQ .no_sword_charge
.no_turtle_rock_trigger
#_08B6E4: LDY.b #$00
#_08B6EA: LDA.b $F0
#_08B6EC: AND.b #$80
#_08B6EE: TAY
#_08B6E6: LDA.b $3C
#_08B6E8: BEQ .no_sword_charge
.no_sword_charge
#_08B6EF: STY.b $3A
#_08B6EA: LDA.b $F0
#_08B6EC: AND.b #$80
#_08B6EE: TAY
#_08B6F1: STZ.b $5E
#_08B6F3: STZ.w $0325
; Set height at end of hover
; This makes it so the landing animation timer looks correct
; Floating for a bit, then slowly landing on the ground
LDA.b #$12 : STA $24
.no_cancel
.no_sword_charge
#_08B6EF: STY.b $3A
#_08B6F1: STZ.b $5E
#_08B6F3: STZ.w $0325
; Set height at end of hover
; This makes it so the landing animation timer looks correct
; Floating for a bit, then slowly landing on the ground
LDA.b #$12 : STA $24
.no_cancel
RTL
RTL
}
print "End of mask_routines.asm ", pc