mist: channelwood: can raise the bridge now

This commit is contained in:
Vince Weaver 2020-06-13 00:27:13 -04:00
parent dc004c673f
commit d91169a2e7
8 changed files with 118 additions and 25 deletions

View File

@ -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 \

View File

@ -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

81
mist/channel_switches.s Normal file
View File

@ -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,Y ; CHANNEL_BRIDGE
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,Y ; CHANNEL_BRIDGE
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

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -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

View File

@ -16,22 +16,22 @@ channel_link_book:
;====================================
; load linking audio (12k) to $9000
lda #<linking_filename
sta OUTL
lda #>linking_filename
sta OUTH
; lda #<linking_filename
; sta OUTL
; lda #>linking_filename
; sta OUTH
jsr opendir_filename
; jsr opendir_filename
; play sound effect?
lda #<linking_noise
sta BTC_L
lda #>linking_noise
sta BTC_H
ldx #LINKING_NOISE_LENGTH ; 45 pages long???
jsr play_audio
; lda #<linking_noise
; sta BTC_L
; lda #>linking_noise
; sta BTC_H
; ldx #LINKING_NOISE_LENGTH ; 45 pages long???
; jsr play_audio
lda #CHANNEL_ARRIVAL
sta LOCATION

View File

@ -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