From 1cb5bc68f4cedadc8d6503e7e1b22e8ae7a2ce11 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Fri, 7 Aug 2020 16:36:45 -0400 Subject: [PATCH] mist: stoney: draw doorways properly in dark --- mist/Makefile | 1 + mist/hlin_list.s | 63 ++++++++++++++++++++++++ mist/stoney.s | 29 +++++++++++ mist/stoney_puzzles.s | 109 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 202 insertions(+) create mode 100644 mist/hlin_list.s diff --git a/mist/Makefile b/mist/Makefile index 8ace2b42..4529f1f6 100644 --- a/mist/Makefile +++ b/mist/Makefile @@ -259,6 +259,7 @@ stoney.o: stoney.s zp.inc hardware.inc common_defines.inc \ link_book_stoney.s \ link_book_mist.s \ handle_pages.s \ + hlin_list.s \ lights_off.s stoney_puzzles.s ca65 -o stoney.o stoney.s -l stoney.lst diff --git a/mist/hlin_list.s b/mist/hlin_list.s new file mode 100644 index 00000000..f176ac00 --- /dev/null +++ b/mist/hlin_list.s @@ -0,0 +1,63 @@ + + ; draw a list of hlins, two wide + ; at call time: + ; INL:INH = addrss of list + ; X is y value to start at (must be even) + ; list is + ; color,xstart,xlen + ; xlen >128 means quit + +hlin_list: + + ldy #0 +hlin_list_yloop: + + lda (INL),Y ; color + iny + sta hlin_list_color_smc+1 + + lda gr_offsets,X ; address low + clc + adc (INL),Y + sec + sbc #1 + iny + sta hlin_list_addr_smc+1 + + lda (INL),Y ; count + bmi done_hlin_list + iny + sta hlin_list_start_smc+1 + + lda gr_offsets+1,X ; address high + clc + adc DRAW_PAGE + sta hlin_list_addr_smc+2 + + txa + pha + + ;============================ + ; hlin + +hlin_list_color_smc: + lda #$00 +hlin_list_start_smc: + ldx #$00 +hlin_list_xloop: + +hlin_list_addr_smc: + sta $400,X + dex + bne hlin_list_xloop + + ; + ;============================= + + pla + tax + inx + inx + jmp hlin_list_yloop +done_hlin_list: + rts diff --git a/mist/stoney.s b/mist/stoney.s index 5c1a3327..5e9ad3fc 100644 --- a/mist/stoney.s +++ b/mist/stoney.s @@ -80,6 +80,7 @@ check_ship_lights: lda COMPASS_STATE bne check_tunnel_lights + ; turn off the ship cabin lights if applicable lda LOCATION cmp #STONEY_BOOK_STAIRS1 beq turn_off_the_lights @@ -127,6 +128,7 @@ turn_off_the_lights: dont_touch_lights: + ;==================================== ; copy background to current page ;==================================== @@ -140,6 +142,32 @@ dont_touch_lights: ; check to see if draw compass light jsr compass_draw_light + + ; check doorways for water/darkness + lda LOCATION + cmp #STONEY_DOORWAY1 + beq handle_doorway1 + cmp #STONEY_DOORWAY2 + beq handle_doorway2 + cmp #STONEY_RIGHT_TUNNEL1 + beq handle_doorway_light + cmp #STONEY_LEFT_TUNNEL1 + beq handle_doorway_light + bne not_a_doorway + +handle_doorway1: + jsr draw_doorway1 + jmp not_a_doorway +handle_doorway2: + jsr draw_doorway2 + jmp not_a_doorway +handle_doorway_light: + jsr draw_light_doorway + jmp not_a_doorway + +not_a_doorway: + + lda LOCATION cmp #STONEY_BOOK_TABLE_OPEN @@ -352,6 +380,7 @@ stoney_half_message: .include "lights_off.s" .include "simple_sounds.s" + .include "hlin_list.s" ; level data .include "leveldata_stoney.inc" diff --git a/mist/stoney_puzzles.s b/mist/stoney_puzzles.s index 47971d39..c9fd7455 100644 --- a/mist/stoney_puzzles.s +++ b/mist/stoney_puzzles.s @@ -1072,3 +1072,112 @@ lighthouse_beacon_on: sta telescope_bg12_sprite+13 sta telescope_bg13_sprite+10 rts + + + +draw_doorway1: + lda DIRECTION + cmp #DIRECTION_N + bne done_doorway + + lda BATTERY_CHARGE + bne done_doorway + + ldx #0 + lda #doorway1_dark_list + sta INH + jmp hlin_list + +draw_doorway2: + lda DIRECTION + cmp #DIRECTION_N + bne done_doorway + + lda BATTERY_CHARGE + bne done_doorway + + ldx #8 + lda #doorway2_dark_list + sta INH + jmp hlin_list + +done_doorway: + rts + +draw_light_doorway: + lda DIRECTION + cmp #DIRECTION_S + bne done_doorway + + lda BATTERY_CHARGE + bne done_doorway + + ldx #12 + lda #doorway_light_list + sta INH + jmp hlin_list + + ; at 0 +doorway1_dark_list: + .byte $00,15,12 + .byte $00,15,12 + .byte $00,15,12 + .byte $00,16,11 + .byte $00,16,11 + .byte $00,16,11 + .byte $00,16,11 + .byte $00,16,11 + .byte $00,17,10 + .byte $00,17,10 + .byte $00,17,10 + .byte $00,17,10 + .byte $00,17,10 + .byte $00,17,10 + .byte $00,17,10 + .byte $00,17,10 + .byte $00,17,9 + .byte $00,24,2 + .byte $00,24,2 + .byte $00,24,2 + .byte $00,24,2 + .byte $00,24,2 + .byte $00,24,2 + .byte $00,25,1 + .byte $ff,$ff,$ff + + ; at 8 +doorway2_dark_list: + .byte $00,16,10 + .byte $00,17,9 + .byte $00,17,9 + .byte $00,18,8 + .byte $00,19,7 + .byte $00,20,5 + .byte $00,21,4 + .byte $00,22,3 + .byte $00,23,2 + .byte $00,23,2 + .byte $55,21,2 + .byte $55,20,3 + .byte $55,16,7 + .byte $55,16,7 + .byte $55,16,8 + .byte $55,16,8 + .byte $ff,$ff,$ff + + ; at 12 +doorway_light_list: + .byte $ff,19,2 + .byte $ff,19,2 + .byte $ff,19,2 + .byte $ff,19,2 + .byte $ff,19,2 + .byte $ff,19,2 + .byte $ff,$ff,$ff +