diff --git a/mist/Makefile b/mist/Makefile index 2c7658ed..2a09afa7 100644 --- a/mist/Makefile +++ b/mist/Makefile @@ -186,6 +186,7 @@ channel.o: channel.s zp.inc hardware.inc common_defines.inc \ common_sprites.inc \ page_sprites.inc \ leveldata_channel.inc \ + channel_switches.s \ keyboard.s \ draw_pointer.s \ link_book_channel.s \ diff --git a/mist/channel.s b/mist/channel.s index 5546da30..4f040415 100644 --- a/mist/channel.s +++ b/mist/channel.s @@ -253,12 +253,15 @@ exit_to_mist: .include "graphics_channel/channel_graphics.inc" - ; puzzles + ; sprites .include "common_sprites.inc" - .include "page_sprites.inc" + ; puzzles + + .include "channel_switches.s" + .include "leveldata_channel.inc" ; linking books diff --git a/mist/channel_switches.s b/mist/channel_switches.s new file mode 100644 index 00000000..2d6e4f70 --- /dev/null +++ b/mist/channel_switches.s @@ -0,0 +1,81 @@ +;======================= +; raise bridge + +; if CHANNEL_SWITCHES CHANNEL_SW_WINDMILL and CHANNEL_SW_FAUCET +; TODO: also if various valves in correct pattern + +raise_bridge: + + bit $C030 ; click speaker + + ; only raise it if water is flowing + + lda CHANNEL_SWITCHES + and #CHANNEL_SW_WINDMILL|CHANNEL_SW_FAUCET + cmp #CHANNEL_SW_WINDMILL|CHANNEL_SW_FAUCET +; bne no_raise_bridge + + + ; only raise the bridge, don't think you can lower it + + lda CHANNEL_SWITCHES + ora #CHANNEL_BRIDGE_UP + sta CHANNEL_SWITCHES + + jsr adjust_after_changes + + jsr change_location + +no_raise_bridge: + rts + + + + ; should call this when entering level +adjust_after_changes: + + +adjust_bridge: + ;======================= + ; put bridge up or down + + lda CHANNEL_SWITCHES + and #CHANNEL_BRIDGE_UP + beq bridge_is_down + +bridge_is_up: + ; change to bridge up bg + ldy #LOCATION_EAST_BG + + lda #bridge_up_e_lzsa + sta location16+1,Y ; CHANNEL_BRIDGE + + ; change to allow crossing bridge + ldy #LOCATION_EAST_EXIT + lda #CHANNEL_AFTER_BRIDGE1 + sta location16,Y ; CHANNEL_BRIDGE + jmp adjust_pipe + +bridge_is_down: + ; change to bridge down bg + + ldy #LOCATION_EAST_BG + + lda #bridge_down_e_lzsa + sta location16+1,Y ; CHANNEL_BRIDGE + + ; change to allow crossing bridge + ldy #LOCATION_EAST_EXIT + lda #$ff + sta location16,Y ; CHANNEL_BRIDGE + +adjust_pipe: + ;======================= + ; extend pipe or not + + + rts diff --git a/mist/graphics_channel/Makefile b/mist/graphics_channel/Makefile index 65eb0a1b..56bf82eb 100644 --- a/mist/graphics_channel/Makefile +++ b/mist/graphics_channel/Makefile @@ -23,7 +23,7 @@ channel_graphics.inc: \ tree_basement_book_open_s.lzsa \ tree_basement_book_closed_s.lzsa \ tree_elevator_basement_s.lzsa \ - bridge_w.lzsa bridge_down_e.lzsa \ + bridge_w.lzsa bridge_down_e.lzsa bridge_up_e.lzsa \ path2_e.lzsa path2_s.lzsa path2_n.lzsa \ path3_w.lzsa path3_e.lzsa path3_n.lzsa \ path4_e.lzsa path4_w.lzsa path4_s.lzsa \ @@ -73,6 +73,7 @@ channel_graphics.inc: \ echo "tree_elevator_basement_s_lzsa: .incbin \"tree_elevator_basement_s.lzsa\"" >> channel_graphics.inc echo "bridge_w_lzsa: .incbin \"bridge_w.lzsa\"" >> channel_graphics.inc echo "bridge_down_e_lzsa: .incbin \"bridge_down_e.lzsa\"" >> channel_graphics.inc + echo "bridge_up_e_lzsa: .incbin \"bridge_up_e.lzsa\"" >> channel_graphics.inc echo "path2_n_lzsa: .incbin \"path2_n.lzsa\"" >> channel_graphics.inc echo "path2_s_lzsa: .incbin \"path2_s.lzsa\"" >> channel_graphics.inc echo "path2_e_lzsa: .incbin \"path2_e.lzsa\"" >> channel_graphics.inc diff --git a/mist/graphics_channel/bridge_up_e.png b/mist/graphics_channel/bridge_up_e.png new file mode 100644 index 00000000..c6a1e178 Binary files /dev/null and b/mist/graphics_channel/bridge_up_e.png differ diff --git a/mist/leveldata_channel.inc b/mist/leveldata_channel.inc index d6d346bb..023b83a7 100644 --- a/mist/leveldata_channel.inc +++ b/mist/leveldata_channel.inc @@ -317,7 +317,10 @@ location16: .word bridge_down_e_lzsa ; east bg .word bridge_w_lzsa ; west bg .byte BG_WEST|BG_EAST - .byte $ff + .byte DIRECTION_E ; special exit + .byte 14,20 ; special x + .byte 28,36 ; special y + .word raise_bridge-1 ; CHANNEL_PATH4 -- twisty maze of passages all alike location17: @@ -677,7 +680,7 @@ location37: .byte $ff ; north exit_dir .byte $ff ; south exit_dir .byte DIRECTION_E ; east exit_dir - .byte DIRECTION_E ; west exit_dir + .byte DIRECTION_W ; west exit_dir .word $0000 ; north bg .word $0000 ; south bg .word after_bridge1_e_lzsa ; east bg @@ -689,8 +692,8 @@ location37: location38: .byte $ff ; north exit .byte $ff ; south exit - .byte CHANNEL_AFTER_BRIDGE1 ; east exit - .byte CHANNEL_BOOK_FORK ; west exit + .byte CHANNEL_BOOK_FORK ; east exit + .byte CHANNEL_AFTER_BRIDGE1 ; west exit .byte $ff ; north exit_dir .byte $ff ; south exit_dir .byte DIRECTION_N ; east exit_dir @@ -715,7 +718,7 @@ location39: .word book_fork_n_lzsa ; north bg .word book_fork_s_lzsa ; south bg .word $0000 ; east bg - .word $0000 ; west bg + .word book_fork_w_lzsa ; west bg .byte BG_NORTH|BG_SOUTH|BG_WEST .byte $ff diff --git a/mist/link_book_channel.s b/mist/link_book_channel.s index b9f814bb..137c5f87 100644 --- a/mist/link_book_channel.s +++ b/mist/link_book_channel.s @@ -16,22 +16,22 @@ channel_link_book: ;==================================== ; load linking audio (12k) to $9000 - lda #linking_filename - sta OUTH +; lda #linking_filename +; sta OUTH - jsr opendir_filename +; jsr opendir_filename ; play sound effect? - lda #linking_noise - sta BTC_H - ldx #LINKING_NOISE_LENGTH ; 45 pages long??? - jsr play_audio +; lda #linking_noise +; sta BTC_H +; ldx #LINKING_NOISE_LENGTH ; 45 pages long??? +; jsr play_audio lda #CHANNEL_ARRIVAL sta LOCATION diff --git a/mist/zp.inc b/mist/zp.inc index b38642bf..4604fa1f 100644 --- a/mist/zp.inc +++ b/mist/zp.inc @@ -134,14 +134,18 @@ COMPASS_ANGLE = $AF CRANK_ANGLE = $B0 WHITE_PAGE_TAKEN= $B1 CHANNEL_SWITCHES= $B2 - CHANNEL_SW1 = $01 - CHANNEL_SW2 = $02 - CHANNEL_SW3 = $04 - CHANNEL_SW4 = $08 - CHANNEL_SW5 = $10 - CHANNEL_SW6 = $20 + CHANNEL_BRIDGE_UP = $01 + CHANNEL_PIPE_EXTENDED = $02 CHANNEL_SW_WINDMILL = $40 CHANNEL_SW_FAUCET = $80 +CHANNEL_VALVES = $B3 + CHANNEL_VALVE1 = $01 + CHANNEL_VALVE2 = $02 + CHANNEL_VALVE3 = $04 + CHANNEL_VALVE4 = $08 + CHANNEL_VALVE5 = $10 + CHANNEL_VALVE6 = $20 + ; done game puzzle state