mist: stoney: have way to make rooms dark

This commit is contained in:
Vince Weaver 2020-08-06 22:42:47 -04:00
parent 69d6e4e96b
commit ce533e347c
4 changed files with 78 additions and 2 deletions

View File

@ -259,7 +259,7 @@ stoney.o: stoney.s zp.inc hardware.inc common_defines.inc \
link_book_stoney.s \
link_book_mist.s \
handle_pages.s \
stoney_puzzles.s
lights_off.s stoney_puzzles.s
ca65 -o stoney.o stoney.s -l stoney.lst
####

View File

@ -1,5 +1,5 @@
5 HOME
10 PRINT "LOADING MIST V0.98"
10 PRINT "LOADING MIST V0.98.1"
20 PRINT:PRINT
40 PRINT "CONTROLS: "
42 PRINT " MOVE CURSOR : ARROWS OR WASD"

56
mist/lights_off.s Normal file
View File

@ -0,0 +1,56 @@
; make the room dark if the lights are off
; for use mostly on stoneship
dark_translate:
ldx #0
dark_translate_loop:
lda $c00,X
tay
lda dark_translate_table,Y
sta $c00,X
lda $d00,X
tay
lda dark_translate_table,Y
sta $d00,X
lda $e00,X
tay
lda dark_translate_table,Y
sta $e00,X
lda $f00,X
tay
lda dark_translate_table,Y
sta $f00,X
dex
bne dark_translate_loop
rts
; 0,1,3,4,5,8,9,b,c,d,e,f -> 0
; 2,6,7,A -> 2
dark_translate_table:
; 0 1 2 3 4 5 6 7 8 9 A B C D E F
.byte $00,$00,$02,$00,$00,$00,$02,$02,$00,$00,$02,$00,$00,$00,$00,$00 ; 0
.byte $00,$00,$02,$00,$00,$00,$02,$02,$00,$00,$02,$00,$00,$00,$00,$00 ; 1
.byte $20,$20,$22,$20,$20,$20,$22,$22,$20,$20,$22,$20,$20,$20,$20,$20 ; 2
.byte $00,$00,$02,$00,$00,$00,$02,$02,$00,$00,$02,$00,$00,$00,$00,$00 ; 3
.byte $00,$00,$02,$00,$00,$00,$02,$02,$00,$00,$02,$00,$00,$00,$00,$00 ; 4
.byte $00,$00,$02,$00,$00,$00,$02,$02,$00,$00,$02,$00,$00,$00,$00,$00 ; 5
.byte $20,$20,$22,$20,$20,$20,$22,$22,$20,$20,$22,$20,$20,$20,$20,$20 ; 6
.byte $20,$20,$22,$20,$20,$20,$22,$22,$20,$20,$22,$20,$20,$20,$20,$20 ; 7
.byte $00,$00,$02,$00,$00,$00,$02,$02,$00,$00,$02,$00,$00,$00,$00,$00 ; 8
.byte $00,$00,$02,$00,$00,$00,$02,$02,$00,$00,$02,$00,$00,$00,$00,$00 ; 9
.byte $20,$20,$22,$20,$20,$20,$22,$22,$20,$20,$22,$20,$20,$20,$20,$20 ; A
.byte $00,$00,$02,$00,$00,$00,$02,$02,$00,$00,$02,$00,$00,$00,$00,$00 ; B
.byte $00,$00,$02,$00,$00,$00,$02,$02,$00,$00,$02,$00,$00,$00,$00,$00 ; C
.byte $00,$00,$02,$00,$00,$00,$02,$02,$00,$00,$02,$00,$00,$00,$00,$00 ; D
.byte $00,$00,$02,$00,$00,$00,$02,$02,$00,$00,$02,$00,$00,$00,$00,$00 ; E
.byte $00,$00,$02,$00,$00,$00,$02,$02,$00,$00,$02,$00,$00,$00,$00,$00 ; F

View File

@ -64,6 +64,24 @@ game_loop:
sta IN_RIGHT
sta IN_LEFT
;====================================
; turn lights off (if applicable)
;====================================
lda LOCATION
cmp #STONEY_BOOK_STAIRS1
beq turn_off_the_lights
cmp #STONEY_BOOK_STAIRS2
beq turn_off_the_lights
cmp #STONEY_BOOK_ROOM
beq turn_off_the_lights
bne dont_touch_lights
turn_off_the_lights:
jsr dark_translate
dont_touch_lights:
;====================================
; copy background to current page
;====================================
@ -286,3 +304,5 @@ stoney_half_message:
; level data
.include "leveldata_stoney.inc"
.include "lights_off.s"