From a8c3c783e69e4c1fee2de0828eab43f165f35d58 Mon Sep 17 00:00:00 2001 From: scawful Date: Thu, 30 May 2024 15:06:56 -0400 Subject: [PATCH] SpriteSetupHitbox and LinkSetupHitbox long, disable deku mask hover (for now) --- Masks/mask_routines.asm | 64 +++++++++++++++++---- Sprites/Enemies/deku_scrub_enemy.asm | 4 +- Sprites/Objects/deku_leaf.asm | 2 +- Sprites/Objects/minecart.asm | 4 +- Sprites/Objects/portal_sprite.asm | 4 +- Sprites/ZSpriteLib/sprite_new_functions.asm | 6 +- 6 files changed, 62 insertions(+), 22 deletions(-) diff --git a/Masks/mask_routines.asm b/Masks/mask_routines.asm index 28a63ab..31afcc6 100644 --- a/Masks/mask_routines.asm +++ b/Masks/mask_routines.asm @@ -332,26 +332,66 @@ org $0DA3FD pullpc + +CheckDekuFlowerPresence: +{ + PHX + CLC ; Assume sprite ID $B0 is not present + LDX.b #$10 + .x_loop + DEX + + LDY.b #$04 + .y_loop + DEY + LDA $0E20, X : CMP.b #$C0 : BEQ .set_flag + BRA .not_b0 + + .set_flag + SEC ; Set flag indicating sprite ID $B0 is present + STX.w $02 + BRA .done + + .not_b0 + CPY.b #$00 : BNE .y_loop + CPX.b #$00 : BNE .x_loop + .done + PLX + + RTS +} + ; Based on LinkItem_Quake.allow_quake PrepareQuakeSpell: { ; TODO: Set a check for the Deku Flower sprite before activating this ability. + ; Find out if the sprite $C0 is in the room + JSR CheckDekuFlowerPresence : BCC .no_c0 - LDA.b #$0A : STA.b $5D ; Set Link to the hover state - LDA.b #$00 : STA.b $3D ; Clear the animation timer + PHX : LDA $02 : TAX + JSL Link_SetupHitBox - 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 + ; X is now the ID of the sprite $B0 + JSL Sprite_SetupHitBox + PLX + + JSL CheckIfHitBoxesOverlap : BCC .no_c0 - ; 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 + LDA.b #$0A : STA.b $5D ; Set Link to the hover state + LDA.b #$00 : STA.b $3D ; Clear the animation timer - STZ $70 ; Clear bomb drop check flag - + 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 + + ; 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 + + STZ $70 ; Clear bomb drop check flag + .no_c0 RTL } diff --git a/Sprites/Enemies/deku_scrub_enemy.asm b/Sprites/Enemies/deku_scrub_enemy.asm index 2e10d6a..22609da 100644 --- a/Sprites/Enemies/deku_scrub_enemy.asm +++ b/Sprites/Enemies/deku_scrub_enemy.asm @@ -144,7 +144,7 @@ Sprite_DekuScrubEnemy_Main: PHX LDA Offspring1_Id : TAX - JSR Sprite_SetupHitBox + JSL Sprite_SetupHitBox PLX JSL CheckIfHitBoxesOverlap : BCC .no_dano @@ -157,7 +157,7 @@ Sprite_DekuScrubEnemy_Main: ; We will go to recoil PHX LDA Offspring1_Id : TAX - JSR Sprite_SetupHitBox + JSL Sprite_SetupHitBox PLX JSL CheckIfHitBoxesOverlap : BCC .not_done2 %GotoAction(4) diff --git a/Sprites/Objects/deku_leaf.asm b/Sprites/Objects/deku_leaf.asm index f710d10..9e252e6 100644 --- a/Sprites/Objects/deku_leaf.asm +++ b/Sprites/Objects/deku_leaf.asm @@ -12,7 +12,7 @@ !SmallShadow = 00 ; 01 = small shadow, 00 = no shadow !Shadow = 00 ; 00 = don't draw shadow, 01 = draw a shadow !Palette = 00 ; Unused in this template (can be 0 to 7) -!Hitbox = 00 ; 00 to 31, can be viewed in sprite draw tool +!Hitbox = $0D ; 00 to 31, can be viewed in sprite draw tool !Persist = 00 ; 01 = your sprite continue to live offscreen !Statis = 00 ; 00 = is sprite is alive?, (kill all enemies room) !CollisionLayer = 00 ; 01 = will check both layer for collision diff --git a/Sprites/Objects/minecart.asm b/Sprites/Objects/minecart.asm index 7bdf0f4..a68787a 100644 --- a/Sprites/Objects/minecart.asm +++ b/Sprites/Objects/minecart.asm @@ -614,10 +614,10 @@ HandleDynamicSwitchTileDirections: JSR CheckSpritePresence : BCC .no_b0 PHX : LDA $02 : TAX - JSR Link_SetupHitBox + JSL Link_SetupHitBox ; X is now the ID of the sprite $B0 - JSR Sprite_SetupHitBox + JSL Sprite_SetupHitBox PLX JSL CheckIfHitBoxesOverlap : BCC .no_b0 diff --git a/Sprites/Objects/portal_sprite.asm b/Sprites/Objects/portal_sprite.asm index fab7d00..211ff78 100644 --- a/Sprites/Objects/portal_sprite.asm +++ b/Sprites/Objects/portal_sprite.asm @@ -141,7 +141,7 @@ Sprite_Portal_Main: LDA SprTimerD, X : BNE .NoOverlap - JSR Link_SetupHitBox + JSL Link_SetupHitBox JSL $0683EA ; Sprite_SetupHitbox_long JSL CheckIfHitBoxesOverlap : BCC .NoOverlap @@ -172,7 +172,7 @@ Sprite_Portal_Main: CLC LDA SprTimerD, X : BNE .NoOverlap - JSR Link_SetupHitBox + JSL Link_SetupHitBox JSL $0683EA ; Sprite_SetupHitbox_long JSL CheckIfHitBoxesOverlap : BCC .NoOverlap diff --git a/Sprites/ZSpriteLib/sprite_new_functions.asm b/Sprites/ZSpriteLib/sprite_new_functions.asm index 17ba24e..a8c640a 100644 --- a/Sprites/ZSpriteLib/sprite_new_functions.asm +++ b/Sprites/ZSpriteLib/sprite_new_functions.asm @@ -443,7 +443,7 @@ Link_SetupHitBox: LDA $20 : ADC.b #$08 : STA $01 LDA $21 : ADC.b #$00 : STA $09 - RTS + RTL } @@ -490,7 +490,7 @@ Sprite_SetupHitBox: #_06F82F: PLY -#_06F830: RTS +#_06F830: RTL ; --------------------------------------------------------- @@ -498,7 +498,7 @@ Sprite_SetupHitBox: #_06F831: LDA.b #$80 #_06F833: STA.b $0A -#_06F835: RTS +#_06F835: RTL .offset_x_low #_06F72F: db 2 ; 0x00