riven: hook up audio in chair room

This commit is contained in:
Vince Weaver 2024-08-18 23:45:28 -04:00
parent 83cfe67cf5
commit 39b537fc10
5 changed files with 192 additions and 10 deletions

View File

@ -110,9 +110,9 @@ Disk05 Map (disk has 35 tracks, each 4k in size)
T 0 = Qboot
T 0.5 = TITLE 1805 bytes 8S = 0T8S (2048) 400B free
T 1 = QLOAD 2314 bytes 16S= 1T0S (4096) 2k free
T 2 = CHAIR 14263 bytes = 6T0S (24576) 10k free
T 2 = CHAIR 16480 bytes = 6T0S (24576) 8k free
T 8 = CHAIR2 27064 bytes = 7T0S (28672) 1k free
T 15 = MOV_CHAIR 20480 bytes = 5T0S (20480) 1k free
T 15 = MOV_CHAIR 5414 bytes = 5T0S (20480) 15k free
Disk10 Map (disk has 35 tracks, each 4k in size)

View File

@ -22,7 +22,8 @@ level_chair.o: level_chair.s \
../zp.inc ../hardware.inc ../qload.inc \
../common_defines.inc disk05_defines.inc \
leveldata_chair.inc \
graphics_chair/chair_graphics.inc
graphics_chair/chair_graphics.inc \
../audio.s audio/chair_close.btc.zx02
ca65 -o level_chair.o level_chair.s -l level_chair.lst
####
@ -46,7 +47,8 @@ movie_chair.o: movie_chair.s \
../flip_pages.s ../disk00_files/draw_scene.s \
../zp.inc ../hardware.inc ../qload.inc \
../common_defines.inc disk05_defines.inc \
movie_chair/movie_chair.inc
movie_chair/movie_chair.inc \
../audio.s audio/chair_open.btc.zx02
ca65 -o movie_chair.o movie_chair.s -l movie_chair.lst
####
@ -60,6 +62,11 @@ graphics_chair2/chair2_graphics.inc:
movie_chair/movie_chair.inc:
cd movie_chair && make
audio/chair_open.btc.zx02:
cd audio && make
audio/chair_close.btc.zx02:
cd audio && make
####
@ -74,6 +81,6 @@ distclean:
LEVEL_CHAIR LEVEL_CHAIR2
cd graphics_chair && make clean
cd graphics_chair2 && make clean
cd audio && make clean

View File

@ -22,6 +22,34 @@ chair_start:
; bit HIRES
; bit FULLGR
;===============================
; load sound into language card
;===============================
lda SOUND_STATUS
and #SOUND_IN_LC
beq do_not_load_audio
; load sounds into LC
; read ram, write ram, use $d000 bank1
bit $C08B
bit $C08B
lda #<chair_close_audio
sta ZX0_src
lda #>chair_close_audio
sta ZX0_src+1
lda #$D0 ; decompress to $D000
jsr full_decomp
; read rom, nowrite, use $d000 bank1
bit $C08A
do_not_load_audio:
;========================
; set up location
;========================
@ -108,6 +136,66 @@ really_exit:
rts
;===================================
; play exit audio
;===================================
play_exit_audio:
; only play sound if language card
lda SOUND_STATUS
and #SOUND_IN_LC
bne do_play_audio
; wait a bit instead
ldx #20
jsr wait_50xms
jmp done_play_audio
do_play_audio:
; switch in language card
; read/write RAM $d000 bank 1
bit $C08B
bit $C08B
; call the btc player
lda #$00
sta BTC_L
lda #$D0
sta BTC_H
ldx #36 ; length
jsr play_audio
; read ROM/no-write
bit $c08A ; restore language card
done_play_audio:
lda #RIVEN_ENTRANCE
sta LOCATION
lda #LOAD_CHAIR
sta WHICH_LOAD
lda #DIRECTION_S
sta DIRECTION
lda #1
sta LEVEL_OVER
rts
;==========================
; includes
;==========================
@ -116,3 +204,12 @@ really_exit:
.include "graphics_chair/chair_graphics.inc"
.include "leveldata_chair.inc"
.include "../audio.s"
chair_close_audio:
.incbin "audio/chair_close.btc.zx02"

View File

@ -20,7 +20,11 @@ location0:
.word $0000 ; east bg
.word $0000 ; west bg
.byte BG_NORTH|BG_SOUTH ;
.byte $ff ; special exit
.byte DIRECTION_S ; special exit
.byte 7,33
.byte 0,180
.word play_exit_audio-1
; RIVEN_ENTRANCE -- entrance to chair room
location1:

View File

@ -36,10 +36,32 @@ chair_start:
bit KEYRESET
;===============================
; load sound into language card
;===============================
; play sound effect?
;===============================
;===============================
lda SOUND_STATUS
and #SOUND_IN_LC
beq do_not_load_audio
; load sounds into LC
; read ram, write ram, use $d000 bank1
bit $C08B
bit $C08B
lda #<chair_open_audio
sta ZX0_src
lda #>chair_open_audio
sta ZX0_src+1
lda #$D0 ; decompress to $D000
jsr full_decomp
; read rom, nowrite, use $d000 bank1
bit $C08A
do_not_load_audio:
;===============================
@ -58,6 +80,54 @@ chair_start:
sta WHICH_OVERLAY
chair_loop:
; see if play sound
lda WHICH_OVERLAY
cmp #1
bne no_open_sound
; only play sound if language card
lda SOUND_STATUS
and #SOUND_IN_LC
bne do_play_audio
; wait a bit instead
ldx #20
jsr wait_50xms
jmp done_play_audio
do_play_audio:
; switch in language card
; read/write RAM $d000 bank 1
bit $C08B
bit $C08B
; call the btc player
lda #$00
sta BTC_L
lda #$D0
sta BTC_H
ldx #44 ; length
jsr play_audio
; read ROM/no-write
bit $c08A ; restore language card
done_play_audio:
no_open_sound:
; draw scene with overlay
; switch background
@ -77,7 +147,7 @@ chair_loop:
; in theory we are 5 fps, so 200ms here
; wait_a_bit is *50? so should be 4?
ldx #4
ldx #3
jsr wait_a_bit
jmp chair_loop
@ -143,3 +213,7 @@ frames_h:
chair_graphics:
.include "movie_chair/movie_chair.inc"
.include "../audio.s"
chair_open_audio:
.incbin "audio/chair_open.btc.zx02"