ootw: c4: can collide with locked doors now

This commit is contained in:
Vince Weaver 2019-08-15 13:38:11 -04:00
parent 8fbea750da
commit c1220ab573
7 changed files with 127 additions and 13 deletions

View File

@ -30,6 +30,7 @@ ootw_c1.o: ootw_c1.s \
gr_copy.s gr_fast_clear.s gr_pageflip.s gr_unrle.s \
gr_putsprite.s gr_putsprite_flipped.s gr_putsprite_crop.s \
gr_make_quake.s gr_overlay.s zp.inc keyboard.s \
collision.s \
ootw_sluggy.s ootw_beast.s \
ootw_c1_arrival.s ootw_c1_rope.s earthquake.s ootw_c1_mesa.s \
ootw_c1_pool.s ootw_c1_cavern.s physicist.s random16.s \
@ -62,7 +63,7 @@ ootw_c2.o: ootw_c2.s \
gr_hlin.s gr_putsprite.s gr_putsprite_flipped.s gr_putsprite_crop.s \
keyboard.s gr_run_sequence.s audio.s \
physicist.s alien.s friend.s \
door.s laser.s shield.s blast.s gun.s \
collision.s door.s laser.s shield.s blast.s gun.s \
ootw_c2_miners.s \
ootw_graphics/sprites/physicist.inc \
ootw_graphics/sprites/alien.inc \
@ -97,6 +98,7 @@ ootw_c4.o: ootw_c4.s \
gr_unrle.s gr_hlin.s \
gr_putsprite.s gr_putsprite_flipped.s gr_putsprite_crop.s \
keyboard.s gr_run_sequence.s physicist.s \
collision.s \
ootw_c4_city.s ootw_c4_action.s \
door.s laser.s shield.s blast.s gun.s charger.s \
ootw_graphics/sprites/physicist.inc \
@ -112,7 +114,7 @@ ootw_c5.o: ootw_c5.s \
gr_copy.s gr_copy_offset.s gr_fast_clear.s gr_pageflip.s gr_unrle.s \
gr_putsprite.s gr_putsprite_flipped.s gr_putsprite_crop.s \
keyboard.s gr_run_sequence.s physicist.s ootw_c5_cave.s \
door.s \
collision.s door.s gun.s blast.s shield.s \
ootw_graphics/sprites/physicist.inc \
ootw_graphics/l5cave/ootw_c5_cave.inc
ca65 -o ootw_c5.o ootw_c5.s -l ootw_c5.lst

View File

@ -1,3 +1,26 @@
Before release:
L1 -- fix run/jumping
L1 -- fix beast ending
L1 -- fix slugs
L2 -- add doors
L2 -- disable door by shooting wall
L2 -- add aliens
L2 -- add minimal friend AI
L2 -- add way to leave L2 to L3
L4 -- genericze doors
L4 -- blow up door to exit to L5
L4 -- allow crouching w gun, up to exit crouch
L4 -- getting rid of alien
L5 -- add ending scenes?
intro -- add music?
BEHAVIOR DIFFERENCES:
alien guard behavior:

75
ootw/collision.s Normal file
View File

@ -0,0 +1,75 @@
;=============================
;=============================
; recalc_walk_collision
;=============================
;=============================
; far left limit is LEVEL_LEFT limit
; far right limit is LEVEL_RIGHT limit
; any LOCKED doors in the way also stop things
recalc_walk_collision:
lda RIGHT_LIMIT
sta RIGHT_WALK_LIMIT
lda LEFT_LIMIT
sta LEFT_WALK_LIMIT
lda NUM_DOORS
beq done_recalc_walk_right_collision
recalc_walk_left:
lda PHYSICIST_X
ldx NUM_DOORS
dex
recalc_walk_left_loop:
cmp door_x,X
bcc recalc_walk_left_continue ; bcs
lda door_status,X
cmp #DOOR_STATUS_LOCKED
bne recalc_walk_left_continue
; early exit
lda door_x,X
ora #$80
sta LEFT_WALK_LIMIT
jmp done_recalc_walk_left_collision
recalc_walk_left_continue:
dex
bpl recalc_walk_left_loop
done_recalc_walk_left_collision:
lda PHYSICIST_X
ldx #0
recalc_walk_right_loop:
cmp door_x,X
bcs recalc_walk_right_continue ; bge
lda door_status,X
cmp #DOOR_STATUS_LOCKED
bne recalc_walk_right_continue
; early exit
lda door_x,X
sec
sbc #4
ora #$80
sta RIGHT_WALK_LIMIT
jmp done_recalc_walk_right_collision
recalc_walk_right_continue:
inx
cpx NUM_DOORS
bne recalc_walk_right_loop
done_recalc_walk_right_collision:
rts

View File

@ -108,6 +108,7 @@ end_message:
.include "laser.s"
.include "shield.s"
.include "blast.s"
.include "collision.s"
.include "ootw_c4_action.s"

View File

@ -165,6 +165,7 @@ room0_falling:
jmp room_setup_done
;===========================
; hallway with weird ceiling
room1:
cmp #1
@ -193,6 +194,7 @@ room1:
jmp room_setup_done
;===================
; causeway part 1
room2:
cmp #2
@ -221,7 +223,8 @@ room2:
jmp room_setup_done
; causeway part 2
;=======================
; causeway part 2 / pit
room3:
cmp #3
bne room4
@ -272,8 +275,11 @@ room3:
jmp room_setup_done
;======================
; down at the bottom
room4:
lda #1
sta NUM_DOORS
lda #(16+128)
sta LEFT_LIMIT
@ -307,10 +313,13 @@ r4_impaled:
room_setup_done:
; laod bg image
sta GBASL
lda #$c ; load to page $c00
jsr load_rle_gr
; setup walk collision
jsr recalc_walk_collision
ootw_room_already_set:
;===========================
@ -1039,11 +1048,11 @@ door_y:
c4_r0_door4_y: .byte 24
door_status:
c4_r0_door0_status: .byte DOOR_STATUS_OPEN
c4_r0_door0_status: .byte DOOR_STATUS_CLOSED
c4_r0_door1_status: .byte DOOR_STATUS_CLOSED
c4_r0_door2_status: .byte DOOR_STATUS_EXPLODED
c4_r0_door3_status: .byte DOOR_STATUS_OPENING1
c4_r0_door4_status: .byte DOOR_STATUS_OPENING2
c4_r0_door2_status: .byte DOOR_STATUS_LOCKED
c4_r0_door3_status: .byte DOOR_STATUS_LOCKED
c4_r0_door4_status: .byte DOOR_STATUS_LOCKED
door_x:
c4_r0_door0_x: .byte 7

View File

@ -474,7 +474,7 @@ check_screen_limit:
clc
lda PHYSICIST_X
adc #$80
cmp LEFT_LIMIT
cmp LEFT_WALK_LIMIT
bcs just_fine_left ; (bge==bcs)
left_on_screen:
@ -482,7 +482,7 @@ left_on_screen:
; if limit was -4, means we are off screen
; otherwise, stop physicist at limit
lda LEFT_LIMIT
lda LEFT_WALK_LIMIT
cmp #($80 - 4)
beq too_far_left
@ -490,7 +490,7 @@ left_stop_at_barrier:
lda #0
sta PHYSICIST_STATE
lda LEFT_LIMIT
lda LEFT_WALK_LIMIT
sec
sbc #$7f
sta PHYSICIST_X
@ -507,7 +507,7 @@ just_fine_left:
; Check right edge of screen
; lda PHYSICIST_X
cmp RIGHT_LIMIT
cmp RIGHT_WALK_LIMIT
bcc just_fine_right ; blt
@ -516,7 +516,7 @@ right_on_screen:
; if limit was 39, means we are off screen
; otherwise, stop physicist at limit
lda RIGHT_LIMIT
lda RIGHT_WALK_LIMIT
cmp #($80 + 39)
beq too_far_right
@ -524,7 +524,7 @@ right_stop_at_barrier:
lda #0
sta PHYSICIST_STATE
lda RIGHT_LIMIT
lda RIGHT_WALK_LIMIT
clc
adc #$7f
sta PHYSICIST_X

View File

@ -117,6 +117,10 @@ LZ4_DONE = $96
; More zero-page addresses
; we try not to conflict with anything DOS, MONITOR or BASIC related
LEFT_WALK_LIMIT = $D1 ; ALL
RIGHT_WALK_LIMIT= $D2 ; ALL
LEFT_SHOOT_LIMIT= $D3 ; ALL
RIGHT_SHOOT_LIMIT=$D4 ; ALL
NUM_DOORS = $D5 ; 2+