aboutsummaryrefslogtreecommitdiff
path: root/src/items.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-04-03 22:32:52 +0200
committerMiquel Sabaté Solà <mssola@mssola.com>2026-04-03 22:32:52 +0200
commit1963d7d8dd70ee9bc4cf9b81363aeab440a6f786 (patch)
tree9a0da613df46caf4620f58c1f06a8508d7e6fc77 /src/items.s
parentcb1111055f7b03989daac63675d27bfd156a4e21 (diff)
downloadjetpac.nes-1963d7d8dd70ee9bc4cf9b81363aeab440a6f786.tar.gz
jetpac.nes-1963d7d8dd70ee9bc4cf9b81363aeab440a6f786.zip
Add a table with tile IDs for shuttle parts
This will allow us to select the proper shuttle depending on 'Globals::zp_shuttle_kind'. Hence, now only the actual shuttle parts on the CHR file are missing, which is why I left a couple of TODOs on the table itself. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'src/items.s')
-rw-r--r--src/items.s46
1 files changed, 39 insertions, 7 deletions
diff --git a/src/items.s b/src/items.s
index 9ad1aba..a2f867a 100644
--- a/src/items.s
+++ b/src/items.s
@@ -294,13 +294,20 @@
;; Should we allocate a part from the shuttle?
bne @try_next_shuttle
- lda #$04
- bne @no_attributes
+ stx Globals::zp_tmp0
+ ldx Globals::zp_shuttle_kind
+ lda Items::shuttle_sprites, x
+ ldx Globals::zp_tmp0
+ jmp @no_attributes
@try_next_shuttle:
cmp #$01
bne @do_fuel_or_regular
- lda #$06
- beq @do_fuel_or_regular
+ stx Globals::zp_tmp0
+ ldx Globals::zp_shuttle_kind
+ lda Items::shuttle_sprites, x
+ clc
+ adc #2
+ ldx Globals::zp_tmp0
@no_attributes:
sta Globals::zp_arg0
@@ -1157,7 +1164,14 @@
;;
;; NOTE: this has to be called with the PPU disabled.
.proc draw_middle_part_shuttle
- ldx #$08
+ ;; Compute the tile ID for the middle part of the shuttle depending on
+ ;; the kind.
+ ldx Globals::zp_shuttle_kind
+ lda Items::shuttle_backgrounds, x
+ clc
+ adc #4
+ tax
+
ldy #$2A
bit PPU::m_status
@@ -1184,7 +1198,11 @@
;;
;; NOTE: this has to be called with the PPU disabled.
.proc draw_high_part_shuttle
- ldx #$04
+ ;; Compute the tile ID for the middle part of the shuttle depending on
+ ;; the kind.
+ ldy Globals::zp_shuttle_kind
+ ldx Items::shuttle_backgrounds, y
+
ldy #$2A
bit PPU::m_status
@@ -1211,13 +1229,20 @@
;;
;; NOTE: this has to be called with the PPU disabled.
.proc draw_low_part_shuttle
+ ;; Compute the tile ID for the low part of the shuttle depending on the
+ ;; kind.
+ ldx Globals::zp_shuttle_kind
+ lda Items::shuttle_backgrounds, x
+ clc
+ adc #8
+ tax
+
;; The low part of the rocket.
bit PPU::m_status
lda #$2A
sta PPU::m_address
lda #$F5
sta PPU::m_address
- ldx #$0C
stx PPU::m_data
inx
stx PPU::m_data
@@ -1233,4 +1258,11 @@
rts
.endproc
+
+shuttle_sprites:
+ ;; TODO: rest of IDs
+ .byte $04, $00, $00, $00
+shuttle_backgrounds:
+ ;; TODO: rest of IDs
+ .byte $04, $00, $00, $00
.endscope