aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-03-15 23:09:26 +0100
committerMiquel Sabaté Solà <mssola@mssola.com>2026-03-15 23:09:26 +0100
commitf6e0cca4031ebad414667aba4054b9af4b71eb5f (patch)
treec488c558b41734200647f9381ce4eb1084be350d
parent6ef407f525324393600a9eb6a39ad7cf21a814a3 (diff)
downloadjetpac.nes-f6e0cca4031ebad414667aba4054b9af4b71eb5f.tar.gz
jetpac.nes-f6e0cca4031ebad414667aba4054b9af4b71eb5f.zip
Account for items switching to following the player in mid-air
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
-rw-r--r--.nasm/segments.txt2
-rw-r--r--src/items.s19
2 files changed, 16 insertions, 5 deletions
diff --git a/.nasm/segments.txt b/.nasm/segments.txt
index bb3538d..bfc83f3 100644
--- a/.nasm/segments.txt
+++ b/.nasm/segments.txt
@@ -1,4 +1,4 @@
- HEADER: 16/16 (100%)
-- ROM0: 7986/32762 (24.38%)
+- ROM0: 8003/32762 (24.43%)
- ROMV: 6/6 (100%)
- ROM2: 8192/8192 (100%)
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.