diff --git a/mist/leveldata_selena.inc b/mist/leveldata_selena.inc index 19259401..f6b15b5e 100644 --- a/mist/leveldata_selena.inc +++ b/mist/leveldata_selena.inc @@ -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: diff --git a/mist/selena.s b/mist/selena.s index e6d9f860..a47b13fe 100644 --- a/mist/selena.s +++ b/mist/selena.s @@ -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 diff --git a/mist/selena_sound_puzzle.s b/mist/selena_sound_puzzle.s index cfb9439c..29782c42 100644 --- a/mist/selena_sound_puzzle.s +++ b/mist/selena_sound_puzzle.s @@ -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+1,Y ; SELENA_TUNNEL + + lda #tunnel_basement_lzsa + sta location32+1,Y ; SELENA_ANTENNA_BASEMENT + + ldy #LOCATION_WEST_BG + + lda #tunnel_w_lzsa + sta location31+1,Y ; SELENA_TUNNEL + + 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+1,Y ; SELENA_TUNNEL + + lda #tunnel_lightson_e_lzsa + sta location32+1,Y ; SELENA_ANTENNA_BASEMENT + + ldy #LOCATION_WEST_BG + + lda #tunnel_middle_lightson_w_lzsa + sta location31+1,Y ; SELENA_TUNNEL + + lda #tunnel_lightson_w_lzsa + sta location30+1,Y ; SELENA_TUNNEL_BASEMENT + + +done_tunnel_lights: + + rts + + diff --git a/mist/zp.inc b/mist/zp.inc index eb38bd0f..3da81bbc 100644 --- a/mist/zp.inc +++ b/mist/zp.inc @@ -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