mist: add viewer room

This commit is contained in:
Vince Weaver 2020-03-25 01:17:59 -04:00
parent 2b5e1a9d08
commit 46dc8b5e4d
15 changed files with 305 additions and 12 deletions

View File

@ -8,7 +8,7 @@ B2D = ../bmp2dhr/b2d
all: mist.dsk
mist.dsk: HELLO LOADER MIST_TITLE MIST OCTAGON MECHE SELENA
mist.dsk: HELLO LOADER MIST_TITLE MIST OCTAGON MECHE SELENA VIEWER
cp empty.dsk mist.dsk
$(DOS33) -y mist.dsk SAVE A HELLO
$(DOS33) -y mist.dsk BSAVE -a 0x1000 LOADER
@ -17,6 +17,7 @@ mist.dsk: HELLO LOADER MIST_TITLE MIST OCTAGON MECHE SELENA
$(DOS33) -y mist.dsk BSAVE -a 0x1400 OCTAGON
$(DOS33) -y mist.dsk BSAVE -a 0x1400 MECHE
$(DOS33) -y mist.dsk BSAVE -a 0x1400 SELENA
$(DOS33) -y mist.dsk BSAVE -a 0x1400 VIEWER
$(DOS33) -y mist.dsk BSAVE -a 0x9000 ./audio/link_noise.btc LINK_NOISE.BTC
###
@ -121,6 +122,22 @@ selena.o: selena.s zp.inc hardware.inc common_defines.inc \
ca65 -o selena.o selena.s -l selena.lst
####
VIEWER: viewer.o
ld65 -o VIEWER viewer.o -C ../linker_scripts/apple2_1400.inc
viewer.o: viewer.s zp.inc hardware.inc common_defines.inc \
graphics_viewer/viewer_graphics.inc \
common_sprites.inc \
page_sprites.inc \
leveldata_viewer.inc \
keyboard.s \
draw_pointer.s \
gr_copy.s audio.s text_print.s decompress_fast_v2.s
ca65 -o viewer.o viewer.s -l viewer.lst
####
graphics_island/mist_graphics.inc:

View File

@ -51,9 +51,10 @@ LOAD_MIST = $1
LOAD_MECHE = $2
LOAD_SELENA = $3
LOAD_OCTAGON = $4
LOAD_STONEDSHIP = $5
LOAD_CHANNEL = $6
LOAD_ENDING = $7
LOAD_VIEWER = $5
LOAD_STONEDSHIP = $6
LOAD_CHANNEL = $7
LOAD_ENDING = $8
@ -106,7 +107,7 @@ MIST_TOWER1_TRAIL = 36
MIST_TOWER1_TRAIL2 = 37
MIST_TOWER1_BOTTOM = 38
MIST_TOWER1_TOP = 39
MIST_VIEWER_DOOR = 40
; Mist Octagon Building
@ -178,3 +179,10 @@ SELENA_SUB_ROOM = 7
SELENA_BOOK_ROOM = 8
SELENA_BOOK_CLOSED = 9
SELENA_BOOK_OPEN = 10
; Viewer Room
VIEWER_STEPS = 0
VIEWER_POOL = 1

View File

@ -10,7 +10,7 @@ all: mist_graphics.inc
####
mist_graphics.inc: \
dock_n.lzsa dock_s.lzsa dock_e.lzsa dock_w.lzsa \
dock_n.lzsa dock_s.lzsa dock_e.lzsa dock_w.lzsa dock_w_open.lzsa \
dock_switch_n.lzsa dock_switch_s.lzsa \
dock_steps_w.lzsa \
above_dock_e.lzsa above_dock_n.lzsa above_dock_s.lzsa \
@ -53,6 +53,7 @@ mist_graphics.inc: \
echo "dock_s_lzsa: .incbin \"dock_s.lzsa\"" >> mist_graphics.inc
echo "dock_e_lzsa: .incbin \"dock_e.lzsa\"" >> mist_graphics.inc
echo "dock_w_lzsa: .incbin \"dock_w.lzsa\"" >> mist_graphics.inc
echo "dock_w_open_lzsa: .incbin \"dock_w_open.lzsa\"" >> mist_graphics.inc
echo "dock_switch_n_lzsa: .incbin \"dock_switch_n.lzsa\"" >> mist_graphics.inc
echo "dock_switch_s_lzsa: .incbin \"dock_switch_s.lzsa\"" >> mist_graphics.inc
echo "dock_steps_w_lzsa: .incbin \"dock_steps_w.lzsa\"" >> mist_graphics.inc

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -2,6 +2,7 @@ dock_n_lzsa: .incbin "dock_n.lzsa"
dock_s_lzsa: .incbin "dock_s.lzsa"
dock_e_lzsa: .incbin "dock_e.lzsa"
dock_w_lzsa: .incbin "dock_w.lzsa"
dock_w_open_lzsa: .incbin "dock_w_open.lzsa"
dock_switch_n_lzsa: .incbin "dock_switch_n.lzsa"
dock_switch_s_lzsa: .incbin "dock_switch_s.lzsa"
dock_steps_w_lzsa: .incbin "dock_steps_w.lzsa"

View File

@ -0,0 +1,28 @@
#include ../Makefile.inc
PNG2RLE = ../../gr-utils/png2rle
PNG2GR = ../../gr-utils/png2gr
LZSA = ~/research/lzsa/lzsa/lzsa
all: viewer_graphics.inc
####
viewer_graphics.inc: \
viewer_e.lzsa viewer_w.lzsa \
viewer_stairs_e.lzsa viewer_stairs_w.lzsa
echo "viewer_e_lzsa: .incbin \"viewer_e.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
%.gr: %.png
$(PNG2GR) $< $@
%.lzsa: %.gr
$(LZSA) -r -f2 $< $@
####
clean:
rm -f *~ *.o *.lst *.gr *.lzsa viewer_graphics.inc

Binary file not shown.

After

Width:  |  Height:  |  Size: 934 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -14,17 +14,18 @@ locations:
.word location28,location29,location30,location31
.word location32,location33,location34,location35
.word location36,location37,location38,location39
.word location40
; MIST_ARRIVAL_DOCK -- dock
location0:
.byte MIST_DOCK_SWITCH ; north exit
.byte $ff ; south exit
.byte $ff ; east exit
.byte $ff ; west exit
.byte MIST_VIEWER_DOOR ; west exit
.byte DIRECTION_N ; north exit_dir
.byte DIRECTION_S ; south exit_dir
.byte $ff ; east exit_dir
.byte $ff ; west exit_dir
.byte DIRECTION_W ; west exit_dir
.word dock_n_lzsa ; north bg
.word dock_s_lzsa ; south bg
.word dock_e_lzsa ; east bg
@ -755,3 +756,23 @@ location39:
.byte 10,18 ; special y
.word circuit_breaker-1 ; special function
; MIST_VIEWER_DOOR -- viewer door
location40:
.byte MIST_DOCK_SWITCH ; north exit
.byte $ff ; south exit
.byte $ff ; east exit
.byte $ff ; west exit
.byte DIRECTION_N ; north exit_dir
.byte DIRECTION_S ; south exit_dir
.byte $ff ; east exit_dir
.byte $ff ; west exit_dir
.word dock_n_lzsa ; north bg
.word dock_s_lzsa ; south bg
.word dock_e_lzsa ; east bg
.word dock_w_open_lzsa ; west bg
.byte BG_EAST|BG_NORTH|BG_SOUTH|BG_WEST ; all bgs
.byte DIRECTION_W ; special exit
.byte 9,29 ; special x
.byte 2,46 ; special y
.word enter_viewer-1 ; special function

49
mist/leveldata_viewer.inc Normal file
View File

@ -0,0 +1,49 @@
;===============================================
; level data for Viewer Room
;===============================================
locations:
.word location0, location1
; VIEWER_STEPS -- steps
location0:
.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 DIRECTION_E ; east exit_dir
.byte DIRECTION_W ; west exit_dir
.word $0000 ; north bg
.word $0000 ; south bg
.word viewer_stairs_e_lzsa ; east bg
.word viewer_stairs_w_lzsa ; west bg
.byte BG_WEST | BG_EAST
.byte DIRECTION_E ; special exit
.byte 9,29 ; special x
.byte 2,46 ; special y
.word back_to_mist-1 ; special function
; VIEWER_POOL -- the viewer pool
location1:
.byte $ff ; north exit
.byte $ff ; south exit
.byte VIEWER_STEPS ; east exit
.byte VIEWER_POOL ; west exit
.byte $ff ; north exit_dir
.byte $ff ; south exit_dir
.byte DIRECTION_E ; east exit_dir
.byte DIRECTION_E ; west exit_dir
.word $0000 ; north bg
.word $0000 ; south bg
.word viewer_e_lzsa ; east bg
.word viewer_w_lzsa ; west bg
.byte BG_EAST|BG_WEST
; .byte DIRECTION_E ; special exit
; .byte 12,25 ; special x
; .byte 26,46 ; special y
; .word controls_pressed-1 ; special function

View File

@ -56,9 +56,10 @@ LOAD_MIST = $1
LOAD_MECHE = $2
LOAD_SELENA = $3
LOAD_OCTAGON = $4
LOAD_STONEDSHIP = $5
LOAD_CHANNEL = $6
LOAD_ENDING = $7
LOAD_VIEWER = $5
LOAD_STONEDSHIP = $6
LOAD_CHANNEL = $7
LOAD_ENDING = $8
loader_start:
@ -156,7 +157,7 @@ copy_filename_done:
filenames:
.word intro_filename
.word mist_filename,meche_filename,selena_filename,octagon_filename
.word ending_filename
.word viewer_filename,ending_filename
intro_filename:
.byte "MIST_TITLE",0
@ -168,6 +169,8 @@ selena_filename:
.byte "SELENA",0
octagon_filename:
.byte "OCTAGON",0
viewer_filename:
.byte "VIEWER",0
ending_filename:
.byte "ENDING",0

View File

@ -219,6 +219,20 @@ enter_octagon:
rts
enter_viewer:
lda #VIEWER_STEPS
sta LOCATION
lda #LOAD_VIEWER
sta WHICH_LOAD
lda #$ff
sta LEVEL_OVER
rts
;==========================

151
mist/viewer.s Normal file
View File

@ -0,0 +1,151 @@
; Viewer in the room by the dock
; by deater (Vince Weaver) <vince@deater.net>
; Zero Page
.include "zp.inc"
.include "hardware.inc"
.include "common_defines.inc"
viewer_start:
;===================
; init screen
jsr TEXT
jsr HOME
bit KEYRESET
bit SET_GR
bit PAGE0
bit LORES
bit FULLGR
lda #0
sta DRAW_PAGE
sta LEVEL_OVER
; init cursor
lda #20
sta CURSOR_X
sta CURSOR_Y
; set up initial location
jsr change_location
lda #1
sta CURSOR_VISIBLE ; visible at first
lda #0
sta ANIMATE_FRAME
game_loop:
;=================
; reset things
;=================
lda #0
sta IN_SPECIAL
sta IN_RIGHT
sta IN_LEFT
;====================================
; copy background to current page
;====================================
jsr gr_copy_to_current
;====================================
; handle special-case forground logic
;====================================
lda LOCATION
; cmp #MECHE_OPEN_BOOK
nothing_special:
;====================================
; draw pointer
;====================================
jsr draw_pointer
;====================================
; page flip
;====================================
jsr page_flip
;====================================
; handle keypress/joystick
;====================================
jsr handle_keypress
;====================================
; inc frame count
;====================================
inc FRAMEL
bne room_frame_no_oflo
inc FRAMEH
room_frame_no_oflo:
;====================================
; check level over
;====================================
lda LEVEL_OVER
bne really_exit
jmp game_loop
really_exit:
jmp end_level
back_to_mist:
lda #$ff
sta LEVEL_OVER
lda #MIST_ARRIVAL_DOCK ; the dock
sta LOCATION
lda #DIRECTION_E
sta DIRECTION
lda #LOAD_MIST
sta WHICH_LOAD
rts
rts
;==========================
; includes
;==========================
.include "gr_copy.s"
.include "gr_offsets.s"
.include "gr_pageflip.s"
.include "gr_putsprite_crop.s"
.include "text_print.s"
.include "gr_fast_clear.s"
.include "decompress_fast_v2.s"
.include "keyboard.s"
.include "draw_pointer.s"
.include "end_level.s"
.include "graphics_viewer/viewer_graphics.inc"
; puzzles
.include "common_sprites.inc"
.include "page_sprites.inc"
.include "leveldata_viewer.inc"