mist: implement the marker switches in MIST

This commit is contained in:
Vince Weaver 2020-07-11 12:12:10 -04:00
parent e215bc0835
commit f68ab79d28
13 changed files with 255 additions and 13 deletions

View File

@ -433,4 +433,5 @@ DENTIST_PANEL = 5
DNI_ARRIVAL = 0
DNI_DESK = 1
DNI_MYST_BOOK = 2
DNI_MYST_BOOK_OPEN = 3

View File

@ -1,3 +1,21 @@
; Ending with page steps
;
; DNI_PROGRESS
; 5 say text both
; 6 say give me page (until you do)
; 7 takes page
; 8 puts in book / says staement about sons
; 9 zaps into book
; 10 pause
; 11 zaps out of book
; 12 page3/it is done
; 13 page4/reward
; 14 page5/stick around
; effect of clicking is now myst linking book
; red/blue book in myst replaced and no longer can click on
; all red/blue/white pages cleared out
; atrus no longer talks in green book
atrus_text:
.word atrus_text_nothing ; 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 382 B

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 992 B

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 656 B

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -54,7 +54,7 @@ location1:
.byte DIRECTION_N ; special exit
.byte 23,30 ; special x
.byte 25,32 ; special y
.word click_switch-1 ; special function
.word click_switch_dock-1 ; special function
; MIST_DOCK_STEPS -- dock steps
location2:
@ -277,7 +277,7 @@ location13:
.word tree2_e_lzsa ; east bg
.word tree2_w_lzsa ; west bg
.byte BG_NORTH|BG_SOUTH|BG_EAST|BG_WEST
.byte DIRECTION_E|DIRECTION_W
.byte DIRECTION_E|DIRECTION_W|DIRECTION_N
.byte 6,33 ; special x
.byte 10,38 ; special y
.word tree2_pillars-1
@ -319,9 +319,9 @@ location15:
.word gear_w_lzsa ; west bg
.byte BG_NORTH | BG_SOUTH | BG_WEST
.byte DIRECTION_N ; special exit
.byte 5,10 ; special x
.byte 29,35 ; special y
.word click_switch-1 ; special function
.byte 4,10 ; special x
.byte 28,35 ; special y
.word click_switch_gear-1 ; special function
; MIST_GEAR_BASE -- gear base
location16:
@ -372,7 +372,10 @@ location18:
.word $0000 ; east bg
.word $0000 ; west bg
.byte BG_NORTH
.byte $ff ; special exit
.byte DIRECTION_N ; special exit
.byte 22,27 ; special x
.byte 20,28 ; special y
.word click_switch_spaceship-1 ; special function
; MIST_TREE_CORRIDOR_4 -- tree corridor4 (with generator switch)
location19:
@ -446,7 +449,11 @@ location22:
.word $0000 ; east bg
.word $0000 ; west bg
.byte BG_SOUTH|BG_NORTH
.byte $ff ; special exit
.byte DIRECTION_S ; special exit
.byte 3,9 ; special x
.byte 26,36 ; special y
.word click_switch_clock-1 ; special function
; MYST_CLOCK_INSIDE -- clock inside
location23:

View File

@ -1,12 +1,176 @@
; Marker switches
; 1 MARKER_DOCK = $01 MIST_DOCK_SWITCH N 0
; 15 MARKER_GEARS = $02 MIST_GEAR N 1
; 18 MARKER_SPACESHIP= $04 MIST_SPACESHIP_SWITCH N 2
; 19 MARKER_GENERATOR= $08 MIST_TREE_CORRIDOR_4 W 3
; 22 MARKER_CLOCK = $10 MIST_CLOCK_ISLAND S 4
; cab/0 MARKER_TREE = $20 CABIN_OUTSIDE E 5
; 13 MARKER_POOL = $40 MIST_TREE_CORRIDOR_2 N 6
; den/0 MARKER_DENTIST = $80 DENTIST_OUTSIDE N 7
; up is on
click_switch:
; which switch in A
click_marker_switch:
; click
bit $C030
bit $C030
eor MARKER_SWITCHES ; toggle switch
sta MARKER_SWITCHES
rts
marker_sprite_off:
.byte 2,2
.byte $AA,$AA
.byte $6A,$6A
marker_sprite_on:
.byte 2,2
.byte $6A,$6A
.byte $AA,$AA
marker_sprites_on:
.word marker_sprite_on ; dock
.word marker_sprite_on ; gears
.word marker_sprite_on ; spaceship
.word marker_sprite_on ; generator
.word marker_sprite_on ; clock
.word marker_sprite_on ; tree
.word marker_sprite_on ; pool
.word marker_sprite_on ; dentist
marker_sprites_off:
.word marker_sprite_off ; dock
.word marker_sprite_off ; gears
.word marker_sprite_off ; spaceship
.word marker_sprite_off ; generator
.word marker_sprite_off ; clock
.word marker_sprite_off ; tree
.word marker_sprite_off ; pool
.word marker_sprite_off ; dentist
marker_sprites_direction:
.byte DIRECTION_N ; dock
.byte DIRECTION_N ; gears
.byte DIRECTION_N ; spaceship
.byte DIRECTION_W ; generator
.byte DIRECTION_S ; clock
.byte DIRECTION_E ; tree
.byte DIRECTION_N ; pool
.byte DIRECTION_N ; dentist
marker_sprites_xy:
.byte 26,26 ; dock
.byte 7,30 ; gears
.byte 23,22 ; spaceship
.byte 8,28 ; generator
.byte 5,28 ; clock
.byte 10,10 ; tree
.byte 28,18 ; pool
.byte 10,10 ; dentist
; FIXME: use generic log2 table somewhere
marker_which:
.byte $01,$02,$04,$08,$10,$20,$40,$80
draw_marker_switch:
; see if need to draw
lda WHICH_LOAD
cmp #LOAD_DENTIST
beq marker_check_dentist
cmp #LOAD_CABIN
beq marker_check_cabin
cmp #LOAD_MIST
bne done_draw_marker
marker_check_myst:
lda LOCATION
check_ms_dock:
cmp #MIST_DOCK_SWITCH
bne check_ms_gear
ldy #0
beq draw_marker
check_ms_gear:
cmp #MIST_GEAR
bne check_ms_spaceship
ldy #1
bne draw_marker
check_ms_spaceship:
cmp #MIST_SPACESHIP_SWITCH
bne check_ms_generator
ldy #2
bne draw_marker
check_ms_generator:
cmp #MIST_TREE_CORRIDOR_4
bne check_ms_clock
ldy #3
bne draw_marker
check_ms_clock:
cmp #MIST_CLOCK_ISLAND
bne check_ms_pool
ldy #4
bne draw_marker
check_ms_pool:
cmp #MIST_TREE_CORRIDOR_2
bne done_draw_marker
ldy #6
bne draw_marker
marker_check_dentist:
lda LOCATION
cmp #DENTIST_OUTSIDE
bne done_draw_marker
ldy #7
bne draw_marker ; bra
marker_check_cabin:
lda LOCATION
cmp #CABIN_OUTSIDE
bne done_draw_marker
ldy #5
draw_marker:
; check if facing right direction
lda marker_sprites_direction,Y
cmp DIRECTION
bne done_draw_marker
tya
tax
asl
tay
lda marker_sprites_xy,Y
sta XPOS
lda marker_sprites_xy+1,Y
sta YPOS
lda MARKER_SWITCHES
and marker_which,X
beq draw_marker_off
draw_marker_on:
lda marker_sprites_on,Y
sta INL
lda marker_sprites_on+1,Y
jmp actually_draw_marker
draw_marker_off:
lda marker_sprites_off,Y
sta INL
lda marker_sprites_off+1,Y
actually_draw_marker:
sta INH
jsr put_sprite_crop
done_draw_marker:
rts

View File

@ -81,6 +81,10 @@ game_loop:
; handle special-case forground logic
;====================================
; handle marker switch drawing
jsr draw_marker_switch
; handle gear opening
lda GEAR_OPEN
@ -296,6 +300,21 @@ read_letter:
rts
;===========================
; marker switch clicks
click_switch_dock:
lda #MARKER_DOCK
jmp click_marker_switch
click_switch_gear:
lda #MARKER_GEARS
jmp click_marker_switch
click_switch_spaceship:
lda #MARKER_SPACESHIP
jmp click_marker_switch
click_switch_clock:
lda #MARKER_CLOCK
jmp click_marker_switch
;==========================
; includes
;==========================

View File

@ -400,13 +400,35 @@ emu_sprite: ; @17,16
tree2_pillars:
lda DIRECTION
cmp #DIRECTION_E
beq tree2_east
bne tree2_west
cmp #DIRECTION_W
beq tree2_west
; handle the pool marker switch
tree2_north:
lda CURSOR_X
cmp #25
bcc tree2_not_switch
cmp #32
bcs tree2_not_switch
lda CURSOR_Y
cmp #16
bcc tree2_not_switch
cmp #24
bcs tree2_not_switch
lda #MARKER_POOL
jmp click_marker_switch
tree2_not_switch:
; we have to fake going north
lda #MIST_TREE_CORRIDOR_1
sta LOCATION
jmp change_location
tree2_west:
lda CURSOR_X
@ -582,7 +604,18 @@ go_to_generator:
bcs goto_shack
marker_switch:
; FIXME
lda CURSOR_Y
cmp #24
bcc missed_switch
cmp #38
bcs missed_switch
lda #MARKER_GENERATOR
jmp click_marker_switch
missed_switch:
rts
goto_shack: