mist: stoney: only draw underwater lamp if on

This commit is contained in:
Vince Weaver 2020-08-06 23:18:37 -04:00
parent ce533e347c
commit dcec7fa124
4 changed files with 84 additions and 3 deletions

View File

@ -109,8 +109,8 @@
.byte $00 ; SHIP_RAISED = $AF
; stoneship
.byte $00 ; PUMP_STATE = $B0
.byte $00 ; BATTERY_CHARGE = $B1
.byte $00 ; COMPASS_ANGLE = $B2
.byte $07 ; BATTERY_CHARGE = $B1
.byte $00 ; COMPASS_STATE = $B2
.byte $00 ; CRANK_ANGLE = $B3
.byte $00 ; WHITE_PAGE_TAKEN = $B4
.byte $00 ; CHANNEL_SWITCHES = $B5

View File

@ -48,6 +48,9 @@ stoney_start:
jsr change_location
; make sure book access set up right
jsr update_compass_state
lda #1
sta CURSOR_VISIBLE ; visible at first
@ -92,6 +95,9 @@ dont_touch_lights:
; handle special-case forground logic
;====================================
; check to see if draw compass light
jsr compass_draw_light
lda LOCATION
cmp #STONEY_BOOK_TABLE_OPEN

View File

@ -64,6 +64,79 @@ compass_puzzle:
rts
;==================================
; draw compass light
;==================================
; underwater light comes on if compass successful
; if in room STONEY_COMPASS_ROOM_RIGHT (facing N) or
; STONEY_COMPASS_ROOM_LEFT (facing W)
; and COMPASS_STATE is not 0 then draw the sprite
compass_draw_light:
lda COMPASS_STATE
beq done_compass_draw_light
lda LOCATION
cmp #STONEY_COMPASS_ROOM_RIGHT
beq light_room_right
cmp #STONEY_COMPASS_ROOM_LEFT
beq light_room_left
rts
light_room_right:
lda DIRECTION
cmp #DIRECTION_N
beq actually_draw_light
rts
light_room_left:
lda DIRECTION
cmp #DIRECTION_W
bne done_compass_draw_light
actually_draw_light:
lda #17
sta XPOS
lda #14
sta YPOS
lda #<compass_light_sprite
sta INL
lda #>compass_light_sprite
sta INH
jsr put_sprite_crop
done_compass_draw_light:
rts
compass_light_sprite:
.byte 6,4
.byte $44,$94,$94,$94,$94,$44
.byte $44,$99,$ff,$ff,$99,$44
.byte $44,$99,$9f,$9f,$99,$44
.byte $24,$24,$24,$24,$24,$24
;==================================
; update compass state
;==================================
; if COMPASS_STATE is 0:
; disable access to linking book
; if COMPASS_STATE is 1:
; enable access to linking book
update_compass_state:
ldy #LOCATION_NORTH_EXIT
lda COMPASS_STATE
bne enable_book_access
disable_book_access:
lda #$ff
bne update_book_access ; bra
enable_book_access:
lda #STONEY_BOOK_TABLE
update_book_access:
sta location16,Y ; STONEY_BOOK_ROOM
rts
;===================================
; crawlways
;===================================

View File

@ -172,7 +172,9 @@ SHIP_RAISED = $AF ; ship raised or not
PUMP_STATE = $B0 ; stoneship pump state
BATTERY_CHARGE = $B1 ; stoneship battery charge
COMPASS_ANGLE = $B2 ; stoneship compass angle
COMPASS_STATE = $B2 ; stoneship compass state
COMPASS_DEFAULT = 0 ; cabin lights off
COMPASS_LIGHT_ON= 1 ; proper angle selected
CRANK_ANGLE = $B3 ; stoneship crank angle
WHITE_PAGE_TAKEN= $B4 ; white page taken