aboutsummaryrefslogtreecommitdiff
path: root/src/driver.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-03-16 22:04:19 +0100
committerMiquel Sabaté Solà <mssola@mssola.com>2026-03-16 22:04:19 +0100
commit3b238d047207441a9ed4c3ae503f323e04b62bef (patch)
treed32acd3182cfd409f34a3c6dc886a5b9759336fa /src/driver.s
parentf6e0cca4031ebad414667aba4054b9af4b71eb5f (diff)
downloadjetpac.nes-3b238d047207441a9ed4c3ae503f323e04b62bef.tar.gz
jetpac.nes-3b238d047207441a9ed4c3ae503f323e04b62bef.zip
Wait for items to fall before changing screen
More specifically, whenever the player dies and we need to reset the screen, wait for items to fall in the same way as we do for explosions to disappear. This also brought with it some other changes like removing sprite reset on screen initialization. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'src/driver.s')
-rw-r--r--src/driver.s28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/driver.s b/src/driver.s
index 448efa2..f747c4b 100644
--- a/src/driver.s
+++ b/src/driver.s
@@ -161,15 +161,6 @@
dey
bne @bullets_reset_loop
- ;; Invalidate all items.
- ldx #0
- ldy #Items::POOL_CAPACITY
- @items_reset_loop:
- sta Items::zp_pool_base, x
- NEXT_ITEM_INDEX_X
- dey
- bne @items_reset_loop
-
;; Set that we have done this operation so it's not done in future
;; cycles.
lda Driver::zp_flags
@@ -324,7 +315,12 @@
lda Explosions::zp_active
bne @sprite_cycling
- ;; After all the explosions have been done, is any player alive?
+ ;; Are there still falling items?
+ lda Items::zp_state
+ and #$03
+ bne @sprite_cycling
+
+ ;; After all the explosions/items have been done, is any player alive?
lda Globals::zp_multiplayer
and #%00000110
bne @reset_timer
@@ -335,6 +331,18 @@
ora #%00000010
sta Globals::zp_flags
+ ;; Invalidate items, which were skipped on move_sprites_out() on purpose
+ ;; to keep them after each death. But since we are about to go to the
+ ;; title screen, now they are no longer useful.
+ lda #$FF
+ ldx #0
+ ldy #Items::POOL_CAPACITY
+ @items_reset_loop:
+ sta Items::zp_pool_base, x
+ NEXT_ITEM_INDEX_X
+ dey
+ bne @items_reset_loop
+
@reset_timer:
;; Reset the player's timer to enter the game screen again.
lda #PLAYER_TIMER_VALUE