mist: move initial entry screen to title

also modularize the linking book sound
This commit is contained in:
Vince Weaver 2020-03-19 13:55:29 -04:00
parent b1a8a9cb36
commit 603313cf27
9 changed files with 329 additions and 50 deletions

View File

@ -16,6 +16,7 @@ mist.dsk: HELLO LOADER MIST_TITLE MIST MECHE SELENA
$(DOS33) -y mist.dsk BSAVE -a 0x1400 MIST
$(DOS33) -y mist.dsk BSAVE -a 0x1400 MECHE
$(DOS33) -y mist.dsk BSAVE -a 0x1400 SELENA
$(DOS33) -y mist.dsk BSAVE -a 0x9000 ./audio/link_noise.btc LINK_NOISE.BTC
###
@ -36,8 +37,12 @@ HELLO: hello.bas
MIST_TITLE: mist_title.o
ld65 -o MIST_TITLE mist_title.o -C ../linker_scripts/apple2_4000.inc
mist_title.o: mist_title.s zp.inc hardware.inc \
graphics_title/mist_title.lzsa
mist_title.o: mist_title.s zp.inc hardware.inc common_defines.inc \
graphics_title/mist_title.lzsa graphics_title/title_graphics.inc \
gr_copy.s gr_offsets.s gr_pageflip.s gr_putsprite_crop.s \
text_print.s gr_fast_clear.s decompress_fast_v2.s \
keyboard.s draw_pointer.s end_level.s audio.s \
link_book_mist_dock.s common_sprites.inc leveldata_title.inc
ca65 -o mist_title.o mist_title.s -l mist_title.lst
####

44
mist/common_defines.inc Normal file
View File

@ -0,0 +1,44 @@
;=============================
; other common stuff
; external routines
opendir_filename = $1039
; audio files
linking_noise = $9000
LINKING_NOISE_LENGTH = 43
;===============================================
; level data structure definitions
;===============================================
; 24 bytes each location
; we put special at end as it's ignored if not set
LOCATION_NORTH_EXIT=0 ; new room when heading north
LOCATION_SOUTH_EXIT=1 ; new room when heading south
LOCATION_EAST_EXIT=2 ; new room when heading east
LOCATION_WEST_EXIT=3 ; new room when heading west
LOCATION_NORTH_EXIT_DIR=4 ; direction faced in new room when N
LOCATION_SOUTH_EXIT_DIR=5 ; direction faced in new room when S
LOCATION_EAST_EXIT_DIR=6 ; direction faced in new room when E
LOCATION_WEST_EXIT_DIR=7 ; direction faced in new room when W
LOCATION_NORTH_BG=8 ; pointer to north background image
LOCATION_SOUTH_BG=10 ; pointer to south background image
LOCATION_EAST_BG=12 ; pointer to east background image
LOCATION_WEST_BG=14 ; pointer to west background image
LOCATION_BGS = 16 ; bitmap saying which backgrounds valid
BG_NORTH = 1
BG_SOUTH = 2
BG_EAST = 4
BG_WEST = 8
LOCATION_SPECIAL_EXIT=17 ; if we have something clickable
; $FF if not, direction if so
LOCATION_SPECIAL_X1=18 ; collision box for the thing to click
LOCATION_SPECIAL_X2=19
LOCATION_SPECIAL_Y1=20
LOCATION_SPECIAL_Y2=21
LOCATION_SPECIAL_FUNC=22 ; pointer-1 of function to call on click

View File

@ -1,9 +1,11 @@
#include ../Makefile.inc
B2D = ../../bmp2dhr/b2d
PNG2GR = ../../gr-utils/png2gr
LZSA = ~/research/lzsa/lzsa/lzsa
all: mist_title.lzsa
all: mist_title.lzsa title_graphics.inc
####
@ -15,5 +17,17 @@ MIST_TITLEC.BIN: mist_title.bmp
####
title_graphics.inc: m_link_book.lzsa
echo "m_link_book_lzsa: .incbin \"m_link_book.lzsa\"" > title_graphics.inc
%.gr: %.png
$(PNG2GR) $< $@
%.lzsa: %.gr
$(LZSA) -r -f2 $< $@
####
clean:
rm -f *~ *.o *.lst

View File

@ -1,36 +1,7 @@
;===============================================
; level data for Island level
; level data for Mist Island level
;===============================================
; 24 bytes each location
; we put special at end as it's ignored if not set
LOCATION_NORTH_EXIT=0 ; new room when heading north
LOCATION_SOUTH_EXIT=1 ; new room when heading south
LOCATION_EAST_EXIT=2 ; new room when heading east
LOCATION_WEST_EXIT=3 ; new room when heading west
LOCATION_NORTH_EXIT_DIR=4 ; direction faced in new room when N
LOCATION_SOUTH_EXIT_DIR=5 ; direction faced in new room when S
LOCATION_EAST_EXIT_DIR=6 ; direction faced in new room when E
LOCATION_WEST_EXIT_DIR=7 ; direction faced in new room when W
LOCATION_NORTH_BG=8 ; pointer to north background image
LOCATION_SOUTH_BG=10 ; pointer to south background image
LOCATION_EAST_BG=12 ; pointer to east background image
LOCATION_WEST_BG=14 ; pointer to west background image
LOCATION_BGS = 16 ; bitmap saying which backgrounds valid
BG_NORTH = 1
BG_SOUTH = 2
BG_EAST = 4
BG_WEST = 8
LOCATION_SPECIAL_EXIT=17 ; if we have something clickable
; $FF if not, direction if so
LOCATION_SPECIAL_X1=18 ; collision box for the thing to click
LOCATION_SPECIAL_X2=19
LOCATION_SPECIAL_Y1=20
LOCATION_SPECIAL_Y2=21
LOCATION_SPECIAL_FUNC=22 ; pointer-1 of function to call on click
locations:
.word location0, location1, location2, location3

28
mist/leveldata_title.inc Normal file
View File

@ -0,0 +1,28 @@
;===============================================
; level data for Title
;===============================================
locations:
.word location0
; myst linking book
location0:
.byte $ff ; north exit
.byte $ff ; south exit
.byte $ff ; east exit
.byte $ff ; west exit
.byte $ff ; north exit_dir
.byte $ff ; south exit_dir
.byte $ff ; east exit_dir
.byte $ff ; west exit_dir
.word m_link_book_lzsa ; north bg
.word $0000 ; south bg
.word $0000 ; east bg
.word $0000 ; west bg
.byte BG_NORTH ; only north bg
.byte DIRECTION_N ; special exit
.byte 21,31 ; special x
.byte 10,24 ; special y
.word mist_link_book-1 ; special function

View File

@ -3,17 +3,34 @@
;=============================
mist_link_book:
; clear screen
lda #0
sta clear_all_color+1
jsr clear_all
jsr page_flip
jsr clear_all
jsr page_flip
; play sound effect?
.if 0
lda #<audio_link_noise
lda #<linking_noise
sta BTC_L
lda #>audio_link_noise
lda #>linking_noise
sta BTC_H
ldx #43 ; 45 pages long???
ldx #LINKING_NOISE_LENGTH ; 45 pages long???
jsr play_audio
.endif
lda #1
sta LOCATION
jsr change_location
lda #LOAD_MIST ; start at Mist
sta WHICH_LOAD
lda #$ff
sta LEVEL_OVER
rts

View File

@ -98,6 +98,21 @@ actual_load:
;===================================================
;===================================================
load_file_and_execute:
jsr opendir_filename
entry_smc:
jsr $1000 ; jump to common entry point
; hope they updated the WHICH_LOAD value
jmp which_load_loop
;==============================
; setup filename then open/load
opendir_filename:
; clear out the filename with $A0 (space)
@ -126,13 +141,7 @@ copy_filename_loop:
copy_filename_done:
jsr opendir ; open and read entire file into memory
entry_smc:
jsr $1000 ; jump to common entry point
; hope they updated the WHICH_LOAD value
jmp which_load_loop
rts
filenames:
.word intro_filename

View File

@ -8,7 +8,7 @@
; Zero Page
.include "zp.inc"
.include "hardware.inc"
.include "common_defines.inc"
mist_start:
;===================

View File

@ -1,13 +1,14 @@
; Mist Title
; loads a HGR version of the title
; also handles the initial link to mist
; by deater (Vince Weaver) <vince@deater.net>
; Zero Page
.include "zp.inc"
.include "hardware.inc"
.include "common_defines.inc"
mist_start:
;===================
@ -36,24 +37,214 @@ reload_everything:
jsr decompress_lzsa2_fast
;====================================
; load linking audio (12k) to $9000
lda #<linking_filename
sta OUTL
lda #>linking_filename
sta OUTH
jsr opendir_filename
;====================================
; wait for keypress or a few seconds
bit KEYRESET
lda #0
sta FRAMEL
keyloop:
lda #64 ; delay a bit
jsr WAIT
inc FRAMEL
lda FRAMEL ; time out eventually
beq done_keyloop
lda KEYPRESS
bpl keyloop
done_keyloop:
bit KEYRESET
lda #0
sta LOCATION ; start at first room
lda #LOAD_MIST ; load mist
sta WHICH_LOAD
rts
;===================
; init screen
jsr TEXT
jsr HOME
bit KEYRESET
bit SET_GR
bit PAGE0
bit LORES
bit FULLGR
lda #0
sta DRAW_PAGE
; init cursor
lda #20
sta CURSOR_X
sta CURSOR_Y
lda #0
sta LOCATION
sta LEVEL_OVER
lda #DIRECTION_N
sta DIRECTION
; 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 #2
bne nothing_special
; handle animated linking book
; lda ANIMATE_FRAME
; asl
; tay
; lda meche_movie,Y
; sta INL
; lda meche_movie+1,Y
; sta INH
; lda #22
; sta XPOS
; lda #12
; sta YPOS
; jsr put_sprite_crop
; lda FRAMEL
; and #$f
; bne done_animate_book
; inc ANIMATE_FRAME
; lda ANIMATE_FRAME
; cmp #11
; bne done_animate_book
; lda #0
; sta ANIMATE_FRAME
;done_animate_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
;==========================
; 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 "audio.s"
.include "graphics_title/title_graphics.inc"
; puzzles
; linking books
.include "link_book_mist_dock.s"
.include "common_sprites.inc"
.include "leveldata_title.inc"
linking_filename:
.byte "LINK_NOISE.BTC",0
file:
.incbin "graphics_title/mist_title.lzsa"