mist: selena: hook up light switch in tunnel

for completeness, I think it looks better in the dark
This commit is contained in:
Vince Weaver 2020-07-31 14:07:00 -04:00
parent 6a11d5c7fe
commit 7574bda01e
4 changed files with 99 additions and 3 deletions

View File

@ -579,7 +579,11 @@ location30:
.word ladder_bottom_lzsa ; east bg
.word tunnel_basement_lzsa ; west bg
.byte BG_EAST|BG_WEST
.byte $ff
.byte DIRECTION_W ; special exit
.byte 32,40 ; special x
.byte 22,36 ; special y
.word tunnel_toggle_lights-1 ; special function
; SELENA_TUNNEL -- middle of tunnel (dark for now)
location31:
@ -613,7 +617,10 @@ location32:
.word tunnel_basement_lzsa ; east bg
.word ladder_bottom_lzsa ; west bg
.byte BG_EAST|BG_WEST
.byte $ff
.byte DIRECTION_E ; special exit
.byte 32,40 ; special x
.byte 22,36 ; special y
.word tunnel_toggle_lights-1 ; special function
; SELENA_ANTENNA_MID -- antenna ladder, mid
location33:

View File

@ -43,6 +43,11 @@ selena_start:
;=================
; init vars
; update the light background
jsr update_tunnel_lights
; copy in rocket note puzzle state
lda ROCKET_NOTE1
sta rocket_notes

View File

@ -1304,6 +1304,90 @@ red_button_sprite:
; switch up = lights on
; switch down = lights off
; turning one switch also flips other one
;
; technically the bottom of steps gets slightly lighter but we ignore
; also in game the two bottom locations are slightly different
; you also can click the switch from multiple angles but we removed
; that as it made things a lot easier
tunnel_toggle_lights:
lda SELENA_BUTTON_STATUS
eor #SELENA_LIGHTSWITCH
sta SELENA_BUTTON_STATUS
jsr update_tunnel_lights
jmp change_location
;===========================================
; update backgrounds based on light switch
;===========================================
update_tunnel_lights:
lda SELENA_BUTTON_STATUS
bmi tunnel_lights_on
tunnel_lights_off:
ldy #LOCATION_EAST_BG
lda #<tunnel_e_lzsa
sta location31,Y ; SELENA_TUNNEL
lda #>tunnel_e_lzsa
sta location31+1,Y ; SELENA_TUNNEL
lda #<tunnel_basement_lzsa
sta location32,Y ; SELENA_ANTENNA_BASEMENT
lda #>tunnel_basement_lzsa
sta location32+1,Y ; SELENA_ANTENNA_BASEMENT
ldy #LOCATION_WEST_BG
lda #<tunnel_w_lzsa
sta location31,Y ; SELENA_TUNNEL
lda #>tunnel_w_lzsa
sta location31+1,Y ; SELENA_TUNNEL
lda #<tunnel_basement_lzsa
sta location30,Y ; SELENA_TUNNEL_BASEMENT
lda #>tunnel_basement_lzsa
sta location30+1,Y ; SELENA_TUNNEL_BASEMENT
jmp done_tunnel_lights
tunnel_lights_on:
ldy #LOCATION_EAST_BG
lda #<tunnel_middle_lightson_e_lzsa
sta location31,Y ; SELENA_TUNNEL
lda #>tunnel_middle_lightson_e_lzsa
sta location31+1,Y ; SELENA_TUNNEL
lda #<tunnel_lightson_e_lzsa
sta location32,Y ; SELENA_ANTENNA_BASEMENT
lda #>tunnel_lightson_e_lzsa
sta location32+1,Y ; SELENA_ANTENNA_BASEMENT
ldy #LOCATION_WEST_BG
lda #<tunnel_middle_lightson_w_lzsa
sta location31,Y ; SELENA_TUNNEL
lda #>tunnel_middle_lightson_w_lzsa
sta location31+1,Y ; SELENA_TUNNEL
lda #<tunnel_lightson_w_lzsa
sta location30,Y ; SELENA_TUNNEL_BASEMENT
lda #>tunnel_lightson_w_lzsa
sta location30+1,Y ; SELENA_TUNNEL_BASEMENT
done_tunnel_lights:
rts

View File

@ -246,7 +246,7 @@ SELENA_BUTTON_STATUS = $CA
SELENA_BUTTON3 = $04 ; CLOCK (ticking)
SELENA_BUTTON4 = $08 ; CRYSTALS (whistle)
SELENA_BUTTON5 = $10 ; TUNNEL (wind)
SELENA_LIGHTSWITCH= $80 ; light in the tunnel
SELENA_ANTENNA1 = $CB
SELENA_ANTENNA2 = $CC