diff --git a/mist/common_sprites.inc b/mist/common_sprites.inc index 1f1a2380..146ec3e6 100644 --- a/mist/common_sprites.inc +++ b/mist/common_sprites.inc @@ -58,7 +58,7 @@ finger_match_lit_sprite: finger_key_sprite: .byte 6,4 - .byte $aa,$aa,$aa,$aa,$aa,$ba + .byte $aa,$aa,$aa,$aa,$aa,$bd .byte $dd,$dd,$dd,$dd,$db,$bb .byte $aa,$ad,$aa,$ab,$bd,$bb .byte $aa,$aa,$aa,$aa,$ab,$ab diff --git a/mist/graphics_stoney/Makefile b/mist/graphics_stoney/Makefile index a0f2e780..c2d6b917 100644 --- a/mist/graphics_stoney/Makefile +++ b/mist/graphics_stoney/Makefile @@ -15,6 +15,7 @@ stoney_graphics.inc: \ lighthouse_path_e.lzsa lighthouse_path_w.lzsa \ lighthouse_door_e.lzsa lighthouse_door_w.lzsa \ lighthouse_inside_e.lzsa lighthouse_inside_w.lzsa \ + lighthouse_inside_locked_e.lzsa \ lighthouse_inside_n.lzsa \ lighthouse_inside_nowater_n.lzsa lighthouse_inside_notrunk_n.lzsa \ lighthouse_inside_lidup_n.lzsa \ @@ -67,6 +68,7 @@ stoney_graphics.inc: \ echo "lighthouse_door_e_lzsa: .incbin \"lighthouse_door_e.lzsa\"" >> stoney_graphics.inc echo "lighthouse_door_w_lzsa: .incbin \"lighthouse_door_w.lzsa\"" >> stoney_graphics.inc echo "lighthouse_inside_e_lzsa: .incbin \"lighthouse_inside_e.lzsa\"" >> stoney_graphics.inc + echo "lighthouse_inside_locked_e_lzsa: .incbin \"lighthouse_inside_locked_e.lzsa\"" >> stoney_graphics.inc echo "lighthouse_inside_w_lzsa: .incbin \"lighthouse_inside_w.lzsa\"" >> stoney_graphics.inc echo "lighthouse_inside_n_lzsa: .incbin \"lighthouse_inside_n.lzsa\"" >> stoney_graphics.inc echo "lighthouse_inside_nowater_n_lzsa: .incbin \"lighthouse_inside_nowater_n.lzsa\"" >> stoney_graphics.inc diff --git a/mist/graphics_stoney/lighthouse_door_e.png b/mist/graphics_stoney/lighthouse_door_e.png index 8fd621aa..213ed319 100644 Binary files a/mist/graphics_stoney/lighthouse_door_e.png and b/mist/graphics_stoney/lighthouse_door_e.png differ diff --git a/mist/graphics_stoney/lighthouse_inside_locked_e.png b/mist/graphics_stoney/lighthouse_inside_locked_e.png new file mode 100644 index 00000000..1e0c7cad Binary files /dev/null and b/mist/graphics_stoney/lighthouse_inside_locked_e.png differ diff --git a/mist/leveldata_stoney.inc b/mist/leveldata_stoney.inc index 228b4149..dc0d2fbc 100644 --- a/mist/leveldata_stoney.inc +++ b/mist/leveldata_stoney.inc @@ -98,7 +98,7 @@ location4: .byte STONEY_LIGHTHOUSE_PATH ; west exit .byte $ff ; north exit_dir .byte $ff ; south exit_dir - .byte DIRECTION_E ; east exit_dir + .byte DIRECTION_E|DIRECTION_ONLY_POINT ; east exit_dir .byte DIRECTION_W ; west exit_dir .word $0000 ; north bg .word $0000 ; south bg diff --git a/mist/stoney.s b/mist/stoney.s index 04ebfe85..737784d6 100644 --- a/mist/stoney.s +++ b/mist/stoney.s @@ -52,6 +52,8 @@ stoney_start: jsr update_compass_state jsr update_tunnel_lights jsr update_pump_state + jsr update_hatch_state + jsr update_inside_lighthouse_action lda #1 sta CURSOR_VISIBLE ; visible at first diff --git a/mist/stoney_puzzles.s b/mist/stoney_puzzles.s index 150ba5c1..611dba0b 100644 --- a/mist/stoney_puzzles.s +++ b/mist/stoney_puzzles.s @@ -1469,9 +1469,12 @@ trunk_open_plug: bne water_already_gone lda #12 - sta ANIMATE_FRAME + bne water_water_water ; bra water_already_gone: + lda #0 +water_water_water: + sta ANIMATE_FRAME lda TRUNK_STATE eor #TRUNK_VALVE_OPEN ora #TRUNK_WATER_DRAINED @@ -1619,9 +1622,28 @@ inside_and_drained: lda #STONEY_LIGHTHOUSE_SPIRAL sta LOCATION jmp change_location + inside_water_up: + lda TRUNK_STATE + and #TRUNK_LID_OPEN + beq inside_water_do_nothing + ; take key + lda TRUNK_STATE + ora #TRUNK_KEY_TAKEN + sta TRUNK_STATE + + ; switch cursor to have key + lda #HOLDING_KEY + sta HOLDING_ITEM + + ; HACK + ; swap out so we can open lock now + + jsr update_inside_lighthouse_action + +inside_water_do_nothing: rts rotate_to_ladder: @@ -1630,6 +1652,9 @@ rotate_to_ladder: jmp change_direction + ;============================= + ; draw inside of lighthouse + ;============================= draw_inside_lighthouse: @@ -1640,6 +1665,26 @@ draw_inside_lighthouse: looking_toward_trunk: + ; if trunk is open and key not taken, draw it + lda TRUNK_STATE + and #(TRUNK_KEY_TAKEN|TRUNK_LID_OPEN) + cmp #TRUNK_LID_OPEN + bne dont_draw_key + + lda #16 + sta XPOS + lda #30 + sta YPOS + + lda #trunk_key_sprite + sta INH + jsr put_sprite_crop + + +dont_draw_key: + lda ANIMATE_FRAME ; since 0 is the static image, we can just treat @@ -1767,3 +1812,120 @@ trunk_key_sprite: .byte $00,$A0,$A0,$00,$A0 + + ;============================ + ; update hatch state + ;============================ +update_hatch_state: + ; default is locked and can't go to top + + lda TRUNK_STATE + and #TRUNK_HATCH_OPEN + beq close_hatch + +open_hatch: + ldy #LOCATION_EAST_EXIT + lda #STONEY_LIGHTHOUSE_UPSTAIRS + sta location5,Y ; STONEY_LIGHTHOUSE_INSIDE + + ldy #LOCATION_EAST_BG + lda #lighthouse_inside_e_lzsa + sta location5+1,Y ; STONEY_LIGHTHOUSE_INSIDE + + rts + +close_hatch: + ldy #LOCATION_EAST_EXIT + lda #$ff + sta location5,Y ; STONEY_LIGHTHOUSE_INSIDE + + ldy #LOCATION_EAST_BG + lda #lighthouse_inside_locked_e_lzsa + sta location5+1,Y ; STONEY_LIGHTHOUSE_INSIDE + + rts + + + ;======================== + ; update inside lighthouse action + ;======================== + ; change action behavior if holding key +update_inside_lighthouse_action: + + lda HOLDING_ITEM + cmp #HOLDING_KEY + bne normal_action + +holding_action: + ldy #LOCATION_SPECIAL_EXIT + lda #DIRECTION_E + sta location5,Y ; STONEY_LIGHTHOUSE_INSIDE + ldy #LOCATION_SPECIAL_X1 + lda #12 + sta location5,Y + lda #19 + sta location5+1,Y + lda #8 + sta location5+2,Y + lda #20 + sta location5+3,Y + + ldy #LOCATION_SPECIAL_FUNC + lda #<(unlock_hatch-1) + sta location5,Y + lda #>(unlock_hatch-1) + sta location5+1,Y + + rts + +normal_action: + ldy #LOCATION_SPECIAL_EXIT + lda #DIRECTION_N + sta location5,Y ; STONEY_LIGHTHOUSE_INSIDE + ldy #LOCATION_SPECIAL_X1 + lda #10 + sta location5,Y + lda #35 + sta location5+1,Y + lda #20 + sta location5+2,Y + lda #44 + sta location5+3,Y + + ldy #LOCATION_SPECIAL_FUNC + lda #<(handle_inside_lighthouse-1) + sta location5,Y + lda #>(handle_inside_lighthouse-1) + sta location5+1,Y + + rts + + + + ;======================== + ; unlock the hatch + ;======================== + ; FIXME: show animation? + ; drop key? + ; in actual game you still have to manually open hatch + ; after the lock falls off +unlock_hatch: + + ; drop key + lda #0 + sta HOLDING_ITEM + + jsr update_inside_lighthouse_action + + ; unlock the hatch + lda TRUNK_STATE + ora #TRUNK_HATCH_OPEN + sta TRUNK_STATE + + jsr update_hatch_state + jmp change_direction +