From f6e0cca4031ebad414667aba4054b9af4b71eb5f Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Sun, 15 Mar 2026 23:09:26 +0100 Subject: Account for items switching to following the player in mid-air MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- src/items.s | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/items.s') diff --git a/src/items.s b/src/items.s index 1490174..756da2b 100644 --- a/src/items.s +++ b/src/items.s @@ -523,7 +523,7 @@ ;; A collision happened! Get collected or follow the player (if possible). lda Items::zp_pool_base, x - tay + sta Globals::zp_tmp0 and #$08 beq @try_to_follow_player jsr Items::collect @@ -551,11 +551,22 @@ bne @next @do_follow_player: - ;; TODO: If F was set, unset it and subtract the number of falling items. - ;; Mark this item to be in 'following' mode. - tya + lda Globals::zp_tmp0 ora #$80 + + ;; Moreover, if the 'falling' flag was set, unset it now, and decrease + ;; the number of falling items. + bit Globals::zp_tmp0 + bvc @set_modes + and #%10111111 + tay + lda Items::zp_state + sec + sbc #$04 + sta Items::zp_state + tya + @set_modes: sta Items::zp_pool_base, x ;; Mark the player's to be already grabbing an item. -- cgit v1.2.3