mist: channelwood: fix behavior of bridge/pipe

validated with actual game if you could repeatedly open/close
including when water is running
This commit is contained in:
Vince Weaver 2020-06-15 00:47:07 -04:00
parent d69e65def5
commit 42ef2297d7

View File

@ -4,11 +4,13 @@
; if CHANNEL_SWITCHES CHANNEL_SW_WINDMILL and CHANNEL_SW_FAUCET ; if CHANNEL_SWITCHES CHANNEL_SW_WINDMILL and CHANNEL_SW_FAUCET
; TODO: also if various valves in correct pattern ; TODO: also if various valves in correct pattern
; verified: can raise and lower bridge if powered with water
raise_bridge: raise_bridge:
bit $C030 ; click speaker bit $C030 ; click speaker
; only raise it if water is flowing ; only raise/lower if water is flowing
lda CHANNEL_SWITCHES lda CHANNEL_SWITCHES
and #CHANNEL_SW_WINDMILL|CHANNEL_SW_FAUCET and #CHANNEL_SW_WINDMILL|CHANNEL_SW_FAUCET
@ -16,10 +18,10 @@ raise_bridge:
; bne no_raise_bridge ; bne no_raise_bridge
; only raise the bridge, don't think you can lower it ; toggle bridge state
lda CHANNEL_SWITCHES lda CHANNEL_SWITCHES
ora #CHANNEL_BRIDGE_UP eor #CHANNEL_BRIDGE_UP
sta CHANNEL_SWITCHES sta CHANNEL_SWITCHES
jsr adjust_after_changes jsr adjust_after_changes
@ -35,17 +37,16 @@ no_raise_bridge:
;======================= ;=======================
; extend_pipe ; extend_pipe
; TODO: can you unextend in game? ; verified: can open/shut even if water is flowing
; TODO: can you unextend if water flowing?
extend_pipe: extend_pipe:
bit $C030 ; click speaker bit $C030 ; click speaker
; only extend pipe ; toggle state
lda CHANNEL_SWITCHES lda CHANNEL_SWITCHES
ora #CHANNEL_PIPE_EXTENDED eor #CHANNEL_PIPE_EXTENDED
sta CHANNEL_SWITCHES sta CHANNEL_SWITCHES
jsr adjust_after_changes jsr adjust_after_changes