From f827c36eba87a9d3a95608ff488da2b5dec6afd8 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 15 Jul 2020 23:52:50 -0400 Subject: [PATCH] mist: cabin: can light boiler now --- mist/cabin.s | 52 ++++++++++++++++++++++ mist/cabin_boiler_puzzle.s | 88 ++++++++++++++++++++++++++++++++++++++ mist/leveldata_cabin.inc | 6 ++- 3 files changed, 145 insertions(+), 1 deletion(-) diff --git a/mist/cabin.s b/mist/cabin.s index 1fca5484..6f63b1c7 100644 --- a/mist/cabin.s +++ b/mist/cabin.s @@ -68,6 +68,57 @@ game_loop: jsr gr_copy_to_current + ;==================================== + ; handle matches + ;==================================== + +check_match_lit_outside: + lda LOCATION + cmp #CABIN_OUTSIDE + bne check_match_on_pilot + + ; FIXME: actual game match sputters a bit before going out + lda HOLDING_ITEM + cmp #HOLDING_MATCH + beq put_out_match + cmp #HOLDING_LIT_MATCH + bne check_match_on_pilot +put_out_match: + lda #0 + sta HOLDING_ITEM + +check_match_on_pilot: + lda LOCATION + cmp #CABIN_INSIDE + bne done_match_handler + + lda DIRECTION + and #$f + cmp #DIRECTION_E + bne done_match_handler + + lda HOLDING_ITEM + cmp #HOLDING_LIT_MATCH + bne done_match_handler + + lda CURSOR_Y + cmp #34 + bcc done_match_handler + + lda CURSOR_X + cmp #13 + bcc done_match_handler + cmp #17 + bcs done_match_handler + + lda #$80 ; light pilot + sta BOILER_LEVEL + + lda #$0 ; drop match + sta HOLDING_ITEM + +done_match_handler: + ;==================================== ; handle special-case forground logic ;==================================== @@ -177,6 +228,7 @@ really_exit: jmp end_level + ; exit back to mist by the clock path enter_clock: diff --git a/mist/cabin_boiler_puzzle.s b/mist/cabin_boiler_puzzle.s index d4ffc178..ee50a005 100644 --- a/mist/cabin_boiler_puzzle.s +++ b/mist/cabin_boiler_puzzle.s @@ -15,6 +15,7 @@ ; can turn up to 25 ; at 12 starts gradually going up ; (needle swings hits end, waits like 5s, goes up) + ; PSI counts 0 to 24? ; 0 - basement ; 1 - down 1/2 ; 2 - down 1 @@ -458,13 +459,79 @@ valve3_sprite: .byte $AA,$AA,$A1,$A1,$A1,$AA + ;============== + ; flame sprites +flame_sprites: + .word flame1_sprite + .word flame2_sprite + +flame1_sprite: + .byte 6,3 + .byte $f5,$d5,$d5,$95,$95,$95 + .byte $ff,$ff,$df,$dd,$9d,$9d + .byte $59,$59,$59,$59,$58,$58 + +flame2_sprite: + .byte 6,3 + .byte $f5,$d5,$d5,$95,$95,$95 + .byte $ff,$ff,$df,$dd,$9d,$ff + .byte $5d,$5d,$59,$59,$59,$59 + + + ;============================= + ; draw valve and other things + ; involving the boiler + ;============================= draw_valve_cabin: + + ; make sure facing right direction + lda DIRECTION and #$f cmp #DIRECTION_E bne done_draw_valve + ; see if we need to draw pilot + + lda BOILER_LEVEL + bpl skip_pilot + + ; put $91 at 15,36, $55f + + lda #$5 + clc + adc DRAW_PAGE + sta pilot_smc+2 + + lda #$91 +pilot_smc: + sta $55f + + ; see if need to draw flame + lda BOILER_VALVE + beq skip_pilot + + ; draw flame + lda FRAMEL + and #$8 + lsr + lsr + tay + + lda flame_sprites,Y + sta INL + lda flame_sprites+1,Y + sta INH + + lda #18 + sta XPOS + lda #32 + sta YPOS + jsr put_sprite_crop + +skip_pilot: + bit TEXTGR ; bit of a hack lda #31 @@ -500,3 +567,24 @@ really_draw_valve: done_draw_valve: rts + + + ;============================== + ; press elevator button + ;============================== +press_elevator_button: + + lda TREE_LEVEL + cmp #2 + beq bump_up + bcc button_ineffective + + dec TREE_LEVEL ; drops you a floor + +button_ineffective: + rts + +bump_up: + inc TREE_LEVEL ; if on ground floor it bumps you up + jmp button_ineffective + diff --git a/mist/leveldata_cabin.inc b/mist/leveldata_cabin.inc index 3e6c3397..9af96ae0 100644 --- a/mist/leveldata_cabin.inc +++ b/mist/leveldata_cabin.inc @@ -180,7 +180,11 @@ location8: .word $0000 ; east bg .word $0000 ; west bg .byte BG_SOUTH - .byte $ff + .byte DIRECTION_S ; special exit + .byte 7,12 ; special x + .byte 8,18 ; special y + .word press_elevator_button-1 + ; CABIN_TREE_BASEMENT -- in the tree basement location9: