mist: stoney: draw doorways properly in dark

This commit is contained in:
Vince Weaver 2020-08-07 16:36:45 -04:00
parent bc32e0157b
commit 1cb5bc68f4
4 changed files with 202 additions and 0 deletions

View File

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

63
mist/hlin_list.s Normal file
View File

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

View File

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

View File

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