Add Sprite_CheckForPresence, takes $00 as SprID

This commit is contained in:
scawful
2024-12-13 09:50:48 -05:00
parent ba3657505a
commit f0fb30bc7b

View File

@@ -318,6 +318,34 @@ Sprite_Damage_Flash:
RTS RTS
} }
; $00 - ID of the sprite to check
; $02 - Index of the sprite found
Sprite_CheckForPresence:
{
PHX
CLC
LDX.b #$10
.x_loop
DEX
LDY.b #$04
.y_loop
DEY
LDA $0E20, X : CMP.b $00 : BEQ .set_flag
BRA .not_b0
.set_flag
SEC ; Set flag indicating sprite is present
STX.w $02
BRA .done
.not_b0
CPY.b #$00 : BNE .y_loop
CPX.b #$00 : BNE .x_loop
.done
PLX
RTS
}
; ========================================================= ; =========================================================
Link_CheckNewY_ButtonPress_Long: Link_CheckNewY_ButtonPress_Long: