mist: viewer: hook up controls

This commit is contained in:
Vince Weaver 2020-03-27 15:43:24 -04:00
parent 9296140132
commit 21cffa5f84
10 changed files with 341 additions and 8 deletions

View File

@ -133,6 +133,7 @@ viewer.o: viewer.s zp.inc hardware.inc common_defines.inc \
common_sprites.inc \
page_sprites.inc \
leveldata_viewer.inc \
viewer_controls.s \
keyboard.s \
draw_pointer.s \
gr_copy.s audio.s text_print.s decompress_fast_v2.s

View File

@ -185,6 +185,8 @@ SELENA_BOOK_OPEN = 10
VIEWER_STEPS = 0
VIEWER_POOL = 1
VIEWER_POOL_CLOSE = 2
VIEWER_CONTROL_PANEL = 3
; Stoney Ship
STONEY_SHIP_STERN = 0

View File

@ -10,11 +10,16 @@ all: viewer_graphics.inc
viewer_graphics.inc: \
viewer_e.lzsa viewer_w.lzsa \
viewer_stairs_e.lzsa viewer_stairs_w.lzsa
viewer_far_w.lzsa \
viewer_stairs_e.lzsa viewer_stairs_w.lzsa \
viewer_controls_e.lzsa
echo "viewer_e_lzsa: .incbin \"viewer_e.lzsa\"" > viewer_graphics.inc
echo "viewer_far_w_lzsa: .incbin \"viewer_far_w.lzsa\"" >> viewer_graphics.inc
echo "viewer_w_lzsa: .incbin \"viewer_w.lzsa\"" >> viewer_graphics.inc
echo "viewer_stairs_e_lzsa: .incbin \"viewer_stairs_e.lzsa\"" >> viewer_graphics.inc
echo "viewer_stairs_w_lzsa: .incbin \"viewer_stairs_w.lzsa\"" >> viewer_graphics.inc
echo "viewer_controls_e_lzsa: .incbin \"viewer_controls_e.lzsa\"" >> viewer_graphics.inc
%.gr: %.png
$(PNG2GR) $< $@

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1017 B

View File

@ -48,4 +48,7 @@ init_state:
sta MECHE_LOCK3
sta MECHE_LOCK4
sta VIEWER_CHANNEL
sta VIEWER_LATCHED
rts

View File

@ -4,7 +4,7 @@
;===============================================
locations:
.word location0, location1
.word location0, location1, location2, location3
; VIEWER_STEPS -- steps
location0:
@ -26,21 +26,41 @@ location0:
.byte 2,46 ; special y
.word back_to_mist-1 ; special function
; VIEWER_POOL -- the viewer pool
; VIEWER_POOL -- the viewer far
location1:
.byte $ff ; north exit
.byte $ff ; south exit
.byte VIEWER_STEPS ; east exit
.byte VIEWER_POOL ; west exit
.byte VIEWER_POOL_CLOSE ; west exit
.byte $ff ; north exit_dir
.byte $ff ; south exit_dir
.byte DIRECTION_E ; east exit_dir
.byte DIRECTION_E ; west exit_dir
.byte DIRECTION_W ; west exit_dir
.word $0000 ; north bg
.word $0000 ; south bg
.word viewer_e_lzsa ; east bg
.word viewer_w_lzsa ; west bg
.word viewer_far_w_lzsa ; west bg
.byte BG_EAST|BG_WEST
.byte DIRECTION_E ; special exit
.byte 6,12 ; special x
.byte 18,26 ; special y
.word enter_control_panel-1 ; special function
; VIEWER_POOL_CLOSE -- the viewer close
location2:
.byte $ff ; north exit
.byte $ff ; south exit
.byte $ff ; east exit
.byte VIEWER_POOL ; west exit
.byte $ff ; north exit_dir
.byte $ff ; south exit_dir
.byte $ff ; east exit_dir
.byte DIRECTION_W ; west exit_dir
.word $0000 ; north bg
.word $0000 ; south bg
.word $0000 ; east bg
.word viewer_w_lzsa ; west bg
.byte BG_WEST
.byte $ff
; .byte DIRECTION_E ; special exit
; .byte 12,25 ; special x
@ -48,3 +68,24 @@ location1:
; .word controls_pressed-1 ; special function
; VIEWER_CONTROL_PANEL -- the viewer control panel
location3:
.byte $ff ; north exit
.byte $ff ; south exit
.byte VIEWER_POOL ; east exit
.byte $ff ; west exit
.byte $ff ; north exit_dir
.byte $ff ; south exit_dir
.byte DIRECTION_W ; east exit_dir
.byte $ff ; west exit_dir
.word $0000 ; north bg
.word $0000 ; south bg
.word viewer_controls_e_lzsa ; east bg
.word $0000 ; west bg
.byte BG_WEST
.byte DIRECTION_E ; special exit
.byte 11,28 ; special x
.byte 16,40 ; special y
.word control_panel_pressed-1 ; special function

View File

@ -60,7 +60,15 @@ game_loop:
;====================================
lda LOCATION
; cmp #MECHE_OPEN_BOOK
cmp #VIEWER_CONTROL_PANEL
beq control_panel
jmp nothing_special
control_panel:
jsr display_panel_code
jmp nothing_special
nothing_special:
@ -121,7 +129,19 @@ back_to_mist:
rts
rts
atrus_message:
; 0123456789012345678901234567890123456789
.byte "CATHERINE, SOMETHING IS UP WITH OUR SONS",0
.byte "THEY'VE BEEN MESSING WITH MY BOOKS",0
.byte "I'VE HIDDEN THE REMAINING LINKING BOOKS",0
.byte "HINT: REMEMBER THE TOWER ROTATION",0
wall_text:
.byte "*** SETTINGS -- DIMENSIONAL IMAGER ***",0
.byte "TOPOGRAPHICAL EXTRUSION TEST -- 40",0
.byte "WATER TURBULENT POOL -- 67",0
.byte "MARKER SWITCH DIAGRAM -- 47",0
;==========================
@ -149,3 +169,5 @@ back_to_mist:
.include "page_sprites.inc"
.include "leveldata_viewer.inc"
.include "viewer_controls.s"

257
mist/viewer_controls.s Normal file
View File

@ -0,0 +1,257 @@
;
enter_control_panel:
lda #VIEWER_CONTROL_PANEL
sta LOCATION
lda #(DIRECTION_E|DIRECTION_ONLY_POINT|DIRECTION_SPLIT)
sta DIRECTION
jsr change_location
rts
control_panel_pressed:
lda CURSOR_Y
cmp #26 ; blt
bcc panel_inc
cmp #30 ; blt
bcc panel_dec
panel_latch:
lda VIEWER_CHANNEL
sta VIEWER_LATCHED ; latch value into pool state
lda #DIRECTION_W
sta DIRECTION
jmp change_location
panel_inc:
lda CURSOR_X
cmp #18
bcs right_arrow_pressed
; 19-23 left arrow
lda VIEWER_CHANNEL
and #$f0
cmp #$90
bcs done_panel_press ; bge
lda VIEWER_CHANNEL
clc
adc #$10
sta VIEWER_CHANNEL
rts
right_arrow_pressed:
; 13-17 right arrow
lda VIEWER_CHANNEL
and #$f
cmp #9
bcs done_panel_press ; bge
inc VIEWER_CHANNEL
rts
panel_dec:
lda CURSOR_X
cmp #18
bcs right_arrow_pressed_dec
; 19-23 left arrow
lda VIEWER_CHANNEL
and #$f0
beq done_panel_press
lda VIEWER_CHANNEL
sec
sbc #$10
sta VIEWER_CHANNEL
rts
right_arrow_pressed_dec:
; 13-17 right arrow
lda VIEWER_CHANNEL
and #$f
beq done_panel_press
dec VIEWER_CHANNEL
done_panel_press:
rts
display_panel_code:
; ones digit
lda VIEWER_CHANNEL
and #$f
asl
tay
lda number_sprites,Y
sta INL
lda number_sprites+1,Y
sta INH
lda #21
sta XPOS
lda #8
sta YPOS
jsr put_sprite_crop
; tens digit
lda VIEWER_CHANNEL
and #$f0
lsr
lsr
lsr
tay
lda number_sprites,Y
sta INL
lda number_sprites+1,Y
sta INH
lda #15
sta XPOS
lda #8
sta YPOS
jsr put_sprite_crop
rts
number_sprites:
.word sprite_0,sprite_1,sprite_2,sprite_3,sprite_4
.word sprite_5,sprite_6,sprite_7,sprite_8,sprite_9
; . . . . . .
; O O ^O ^ O ^ O O O
; O O O O ^O ^^O
; ^.^ .O. O.. ..^ O
sprite_0:
.byte 3,4
.byte $AA,$0A,$AA ;
.byte $00,$AA,$00 ;
.byte $00,$AA,$00 ;
.byte $A0,$0A,$A0 ;
; . . . . . .
; O O ^O ^ O ^ O O O
; O O O O ^O ^^O
; ^.^ .O. O.. ..^ O
sprite_1:
.byte 3,4
.byte $AA,$0A,$AA
.byte $A0,$00,$AA
.byte $AA,$00,$AA
.byte $0A,$00,$0A
; . . . . . .
; O O ^O ^ O ^ O O O
; O O O O ^O ^^O
; ^.^ .O. O.. ..^ O
sprite_2:
.byte 3,4
.byte $AA,$0A,$AA
.byte $A0,$AA,$00
.byte $AA,$00,$AA
.byte $00,$0A,$0A
; . . . . . .
; O O ^O ^ O ^ O O O
; O O O O ^O ^^O
; ^.^ .O. O.. ..^ O
sprite_3:
.byte 3,4
.byte $AA,$0A,$AA
.byte $A0,$AA,$00
.byte $AA,$A0,$00
.byte $0A,$0A,$A0
; . . . . . .
; O O ^O ^ O ^ O O O
; O O O O ^O ^^O
; ^.^ .O. O.. ..^ O
sprite_4:
.byte 3,4
.byte $0A,$AA,$0A
.byte $00,$AA,$00
.byte $A0,$A0,$00
.byte $AA,$AA,$00
; ... .. ... . .
; O O O O O O O
; ^^. O^. O .^. ^O
; ..^ ^.^ O ^.^ ..O
sprite_5:
.byte 3,4
.byte $0A,$0A,$0A
.byte $00,$AA,$AA
.byte $A0,$A0,$0A
.byte $0A,$0A,$A0
; ... .. ... . .
; O O O O O O O
; ^^. O^. O .^. ^O
; ..^ ^.^ O ^.^ ..O
sprite_6:
.byte 3,4
.byte $AA,$0A,$0A
.byte $00,$AA,$AA
.byte $00,$A0,$0A
.byte $A0,$0A,$A0
; ... .. ... . .
; O O O O O O O
; ^^. O^. O .^. ^O
; ..^ ^.^ O ^.^ ..O
sprite_7:
.byte 3,4
.byte $0A,$0A,$0A
.byte $AA,$AA,$00
.byte $AA,$00,$AA
.byte $00,$AA,$AA
; ... .. ... . .
; O O O O O O O
; ^^. O^. O .^. ^O
; ..^ ^.^ O ^.^ ..O
sprite_8:
.byte 3,4
.byte $AA,$0A,$AA
.byte $00,$AA,$00
.byte $0A,$A0,$0A
.byte $A0,$0A,$A0
; ... .. ... . .
; O O O O O O O
; ^^. O^. O .^. ^O
; ..^ ^.^ O ^.^ ..^
sprite_9:
.byte 3,4
.byte $AA,$0A,$AA
.byte $00,$AA,$00
.byte $AA,$A0,$00
.byte $0A,$0A,$A0

View File

@ -105,6 +105,8 @@ HOLDING_PAGE = $A6
HOLDING_WHITE_PAGE = 3
RED_PAGE_COUNT = $A7
BLUE_PAGE_COUNT = $A8
VIEWER_CHANNEL = $A9
VIEWER_LATCHED = $AA
; done game puzzle state