riven_hgr: can walk between levels now

This commit is contained in:
Vince Weaver 2024-05-15 16:12:35 -04:00
parent d6a42b3732
commit 774cd13bb4
7 changed files with 84 additions and 27 deletions

View File

@ -54,6 +54,7 @@ dome.o: dome.s zp.inc hardware.inc \
hgr_sprite.s hgr_tables.s \ hgr_sprite.s hgr_tables.s \
keyboard.s \ keyboard.s \
hgr_14x14_sprite.s \ hgr_14x14_sprite.s \
leveldata_dome.inc \
graphics_sprites/pointer_sprites.inc \ graphics_sprites/pointer_sprites.inc \
graphics_dome/dome_graphics.inc graphics_dome/dome_graphics.inc
ca65 -o dome.o dome.s -l dome.lst ca65 -o dome.o dome.s -l dome.lst
@ -68,6 +69,7 @@ level_projector.o: level_projector.s zp.inc hardware.inc \
hgr_sprite.s hgr_tables.s \ hgr_sprite.s hgr_tables.s \
keyboard.s \ keyboard.s \
hgr_14x14_sprite.s \ hgr_14x14_sprite.s \
leveldata_projector.inc \
graphics_sprites/pointer_sprites.inc \ graphics_sprites/pointer_sprites.inc \
graphics_projector/projector_graphics.inc graphics_projector/projector_graphics.inc
ca65 -o level_projector.o level_projector.s -l level_projector.lst ca65 -o level_projector.o level_projector.s -l level_projector.lst

View File

@ -98,7 +98,7 @@ frame_no_oflo:
really_exit: really_exit:
jmp really_exit rts
;========================== ;==========================

View File

@ -124,11 +124,11 @@ check_left:
cmp #8 ; left key cmp #8 ; left key
bne check_right bne check_right
left_pressed: left_pressed:
lda CURSOR_X ; if 41<x<$FE don't decrement lda CURSOR_X ; if x>0
cmp #41 ; cmp #41
bcc do_dec_cursor_x ; bcc do_dec_cursor_x
cmp #$FE ; cmp #$FE
bcc done_left_pressed beq done_left_pressed
do_dec_cursor_x: do_dec_cursor_x:
dec CURSOR_X dec CURSOR_X
done_left_pressed: done_left_pressed:
@ -141,7 +141,7 @@ check_right:
bne check_up bne check_up
right_pressed: right_pressed:
lda CURSOR_X ; if 40<x<$FE don't increment lda CURSOR_X ; if 40<x<$FE don't increment
cmp #40 cmp #38
bcc do_inc_cursor_x bcc do_inc_cursor_x
cmp #$FE cmp #$FE
bcc done_right_pressed bcc done_right_pressed
@ -156,11 +156,11 @@ check_up:
cmp #$0B ; up key cmp #$0B ; up key
bne check_down bne check_down
up_pressed: up_pressed:
lda CURSOR_Y ; if 191<y<$F0 don't decrement lda CURSOR_Y ; if > 4 then decrement
cmp #191 cmp #4
bcc do_dec_cursor_y ; bcs do_dec_cursor_y ; bge
cmp #$F0 ; cmp #$F0
bcc done_up_pressed bcc done_up_pressed ; blt
do_dec_cursor_y: do_dec_cursor_y:
dec CURSOR_Y dec CURSOR_Y
dec CURSOR_Y dec CURSOR_Y
@ -176,11 +176,11 @@ check_down:
cmp #$0A cmp #$0A
bne check_return bne check_return
down_pressed: down_pressed:
lda CURSOR_Y ; if 191<y<$EE don't decrement lda CURSOR_Y ; if y<177 (14 high)
cmp #191 cmp #177
bcc do_inc_cursor_y ; bcc do_inc_cursor_y
cmp #$EE ; cmp #$EE
bcc done_down_pressed bcs done_down_pressed
do_inc_cursor_y: do_inc_cursor_y:
inc CURSOR_Y inc CURSOR_Y
inc CURSOR_Y inc CURSOR_Y
@ -327,6 +327,7 @@ done_split:
;============================= ;=============================
; change location ; change location
;============================= ;=============================
;
change_location: change_location:
; reset graphics ; reset graphics
bit SET_GR bit SET_GR
@ -376,9 +377,19 @@ go_forward:
tay tay
lda (LOCATION_STRUCT_L),Y lda (LOCATION_STRUCT_L),Y
; A has new destination
; FF = can't go forward
; otherwise if top 4 bits set, new level
; otherwise, in current
cmp #$ff cmp #$ff
beq cant_go_forward beq cant_go_forward
cmp #$10
bcs new_level
same_level:
sta LOCATION sta LOCATION
; update new direction ; update new direction
@ -397,6 +408,39 @@ go_forward:
cant_go_forward: cant_go_forward:
rts rts
new_level:
pha
lsr
lsr
lsr
lsr
sta WHICH_LOAD
pla
and #$0f
sta LOCATION
; update new direction
lda DIRECTION
and #$f
tay
lda log2_table,Y
clc
adc #LOCATION_NORTH_EXIT_DIR
tay
lda (LOCATION_STRUCT_L),Y
sta DIRECTION
lda #1
sta LEVEL_OVER
rts
;========================== ;==========================
; turn left ; turn left
;=========================== ;===========================

View File

@ -98,7 +98,7 @@ frame_no_oflo:
really_exit: really_exit:
jmp really_exit rts
;========================== ;==========================

View File

@ -8,11 +8,11 @@ locations:
; RIVEN_MAGLEV1 -- maglev steps ; RIVEN_MAGLEV1 -- maglev steps
location0: location0:
.byte RIVEN_MAGLEV2 ; north exit .byte RIVEN_MAGLEV2 ; north exit
.byte $ff ; south exit .byte LOAD_PROJECTOR<<4|RIVEN_PROJ_DOOR ; south exit
.byte $ff ; east exit .byte $ff ; east exit
.byte $ff ; west exit .byte $ff ; west exit
.byte DIRECTION_N ; north exit_dir .byte DIRECTION_N ; north exit_dir
.byte $ff ; south exit_dir .byte DIRECTION_S ; south exit_dir
.byte $ff ; east exit_dir .byte $ff ; east exit_dir
.byte $ff ; west exit_dir .byte $ff ; west exit_dir
.word maglev1_n_zx02 ; north bg .word maglev1_n_zx02 ; north bg

View File

@ -24,12 +24,12 @@ location0:
; RIVEN_PROJ_DOOR -- doorway to projector room ; RIVEN_PROJ_DOOR -- doorway to projector room
location1: location1:
.byte RIVEN_PROJECTOR ; north exit .byte LOAD_DOME<<4 | RIVEN_MAGLEV1 ; north exit
.byte $ff ; south exit .byte RIVEN_PROJECTOR ; south exit
.byte $ff ; east exit .byte $ff ; east exit
.byte $ff ; west exit .byte $ff ; west exit
.byte DIRECTION_N ; north exit_dir .byte DIRECTION_N ; north exit_dir
.byte $ff ; south exit_dir .byte DIRECTION_S ; south exit_dir
.byte $ff ; east exit_dir .byte $ff ; east exit_dir
.byte $ff ; west exit_dir .byte $ff ; west exit_dir
.word doorway_n_zx02 ; north bg .word doorway_n_zx02 ; north bg

View File

@ -184,14 +184,25 @@ done_setup_sound:
lda #100 lda #100
jsr wait_a_bit jsr wait_a_bit
lda #RIVEN_MAGLEV1 ; lda #LOAD_DOME
; sta WHICH_LOAD ; assume new game (dome island)
; lda #RIVEN_MAGLEV1
; sta LOCATION
; lda #DIRECTION_N
; sta DIRECTION
lda #LOAD_PROJECTOR
sta WHICH_LOAD ; assume new game (dome island)
lda #RIVEN_PROJECTOR
sta LOCATION sta LOCATION
lda #DIRECTION_N lda #DIRECTION_S
sta DIRECTION sta DIRECTION
lda #LOAD_DOME
sta WHICH_LOAD ; assume new game (dome island)
rts rts