mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-08-15 08:27:41 +00:00
ootw: c4: generic doors now implemented
This commit is contained in:
@@ -37,7 +37,7 @@ recalc_walk_left:
|
|||||||
dey
|
dey
|
||||||
recalc_walk_left_loop:
|
recalc_walk_left_loop:
|
||||||
|
|
||||||
cmp door_x,Y
|
cmp (DOOR_X),Y
|
||||||
bcc recalc_walk_left_continue ; bcs
|
bcc recalc_walk_left_continue ; bcs
|
||||||
|
|
||||||
lda (DOOR_STATUS),Y
|
lda (DOOR_STATUS),Y
|
||||||
@@ -45,7 +45,7 @@ recalc_walk_left_loop:
|
|||||||
bne recalc_walk_left_continue
|
bne recalc_walk_left_continue
|
||||||
|
|
||||||
; early exit
|
; early exit
|
||||||
lda door_x,Y
|
lda (DOOR_X),Y
|
||||||
ora #$80
|
ora #$80
|
||||||
sta LEFT_WALK_LIMIT
|
sta LEFT_WALK_LIMIT
|
||||||
jmp done_recalc_walk_left_collision
|
jmp done_recalc_walk_left_collision
|
||||||
@@ -61,7 +61,7 @@ done_recalc_walk_left_collision:
|
|||||||
ldy #0
|
ldy #0
|
||||||
recalc_walk_right_loop:
|
recalc_walk_right_loop:
|
||||||
|
|
||||||
cmp door_x,Y
|
cmp (DOOR_X),Y
|
||||||
bcs recalc_walk_right_continue ; bge
|
bcs recalc_walk_right_continue ; bge
|
||||||
|
|
||||||
lda (DOOR_STATUS),Y
|
lda (DOOR_STATUS),Y
|
||||||
@@ -69,7 +69,7 @@ recalc_walk_right_loop:
|
|||||||
bne recalc_walk_right_continue
|
bne recalc_walk_right_continue
|
||||||
|
|
||||||
; early exit
|
; early exit
|
||||||
lda door_x,Y
|
lda (DOOR_X),Y
|
||||||
sec
|
sec
|
||||||
sbc #4
|
sbc #4
|
||||||
ora #$80
|
ora #$80
|
||||||
@@ -125,7 +125,7 @@ calc_gun_right_door_loop:
|
|||||||
|
|
||||||
lda PHYSICIST_X
|
lda PHYSICIST_X
|
||||||
|
|
||||||
cmp door_x,Y
|
cmp (DOOR_X),Y
|
||||||
bcs calc_gun_right_door_continue ; bge
|
bcs calc_gun_right_door_continue ; bge
|
||||||
|
|
||||||
lda (DOOR_STATUS),Y
|
lda (DOOR_STATUS),Y
|
||||||
@@ -136,7 +136,7 @@ calc_gun_right_door_loop:
|
|||||||
|
|
||||||
calc_gun_right_door_there:
|
calc_gun_right_door_there:
|
||||||
; early exit
|
; early exit
|
||||||
lda door_x,Y
|
lda (DOOR_X),Y
|
||||||
sta RIGHT_SHOOT_LIMIT
|
sta RIGHT_SHOOT_LIMIT
|
||||||
|
|
||||||
tya ; set target if hit
|
tya ; set target if hit
|
||||||
@@ -233,7 +233,7 @@ calc_gun_left_doors:
|
|||||||
calc_gun_left_door_loop:
|
calc_gun_left_door_loop:
|
||||||
lda PHYSICIST_X
|
lda PHYSICIST_X
|
||||||
|
|
||||||
cmp door_x,Y
|
cmp (DOOR_X),Y
|
||||||
bcc calc_gun_left_door_continue ; blt
|
bcc calc_gun_left_door_continue ; blt
|
||||||
|
|
||||||
lda (DOOR_STATUS),Y
|
lda (DOOR_STATUS),Y
|
||||||
@@ -244,7 +244,7 @@ calc_gun_left_door_loop:
|
|||||||
|
|
||||||
calc_gun_left_door_there:
|
calc_gun_left_door_there:
|
||||||
; early exit
|
; early exit
|
||||||
lda door_x,Y
|
lda (DOOR_X),Y
|
||||||
sta LEFT_SHOOT_LIMIT
|
sta LEFT_SHOOT_LIMIT
|
||||||
|
|
||||||
tya ; set target if hit
|
tya ; set target if hit
|
||||||
|
31
ootw/door.s
31
ootw/door.s
@@ -35,10 +35,10 @@ draw_doors_loop:
|
|||||||
sta INH
|
sta INH
|
||||||
|
|
||||||
actually_draw_door:
|
actually_draw_door:
|
||||||
lda door_x,Y
|
lda (DOOR_X),Y
|
||||||
sta XPOS
|
sta XPOS
|
||||||
|
|
||||||
lda door_y,Y
|
lda (DOOR_Y),Y
|
||||||
sta YPOS
|
sta YPOS
|
||||||
|
|
||||||
tya
|
tya
|
||||||
@@ -146,17 +146,17 @@ done_handle_doors:
|
|||||||
handle_doors_open:
|
handle_doors_open:
|
||||||
|
|
||||||
; only open/close if on same level
|
; only open/close if on same level
|
||||||
lda door_y,Y
|
lda (DOOR_Y),Y
|
||||||
clc
|
clc
|
||||||
adc #4
|
adc #4
|
||||||
cmp PHYSICIST_Y
|
cmp PHYSICIST_Y
|
||||||
bne close_door
|
bne close_door
|
||||||
|
|
||||||
lda PHYSICIST_X
|
lda PHYSICIST_X
|
||||||
cmp door_xmax,Y
|
cmp (DOOR_XMAX),Y
|
||||||
bcs close_door ; bge
|
bcs close_door ; bge
|
||||||
|
|
||||||
cmp door_xmin,Y
|
cmp (DOOR_XMIN),Y
|
||||||
bcc close_door ; blt
|
bcc close_door ; blt
|
||||||
|
|
||||||
; made it here, we are in bounds, stay open
|
; made it here, we are in bounds, stay open
|
||||||
@@ -172,17 +172,17 @@ handle_doors_closed:
|
|||||||
|
|
||||||
; only open if on same level
|
; only open if on same level
|
||||||
|
|
||||||
lda door_y,Y
|
lda (DOOR_Y),Y
|
||||||
clc
|
clc
|
||||||
adc #4
|
adc #4
|
||||||
cmp PHYSICIST_Y
|
cmp PHYSICIST_Y
|
||||||
bne handle_doors_continue
|
bne handle_doors_continue
|
||||||
|
|
||||||
lda PHYSICIST_X
|
lda PHYSICIST_X
|
||||||
cmp door_xmax,Y
|
cmp (DOOR_XMAX),Y
|
||||||
bcs handle_doors_continue
|
bcs handle_doors_continue
|
||||||
|
|
||||||
cmp door_xmin,Y
|
cmp (DOOR_XMIN),Y
|
||||||
bcc handle_doors_continue
|
bcc handle_doors_continue
|
||||||
|
|
||||||
open_door:
|
open_door:
|
||||||
@@ -191,8 +191,21 @@ open_door:
|
|||||||
jmp handle_doors_continue
|
jmp handle_doors_continue
|
||||||
|
|
||||||
|
|
||||||
|
;====================
|
||||||
|
;====================
|
||||||
|
; setup door table
|
||||||
|
;====================
|
||||||
|
;====================
|
||||||
|
setup_door_table:
|
||||||
|
|
||||||
|
ldx #9
|
||||||
|
setup_door_table_loop:
|
||||||
|
setup_door_table_loop_smc:
|
||||||
|
lda $1000,X
|
||||||
|
sta DOOR_STATUS,X
|
||||||
|
dex
|
||||||
|
bpl setup_door_table_loop
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -118,10 +118,13 @@ room0:
|
|||||||
lda #5
|
lda #5
|
||||||
sta NUM_DOORS
|
sta NUM_DOORS
|
||||||
|
|
||||||
lda #<door_status
|
lda #<door_c4_r0
|
||||||
sta DOOR_STATUS
|
sta setup_door_table_loop_smc+1
|
||||||
lda #>door_status
|
lda #>door_c4_r0
|
||||||
sta DOOR_STATUS_H
|
sta setup_door_table_loop_smc+2
|
||||||
|
jsr setup_door_table
|
||||||
|
|
||||||
|
; set up room limits
|
||||||
|
|
||||||
lda #(6+128)
|
lda #(6+128)
|
||||||
sta LEFT_LIMIT
|
sta LEFT_LIMIT
|
||||||
@@ -976,39 +979,42 @@ pit_door_cover:
|
|||||||
; bne clear1
|
; bne clear1
|
||||||
; rts
|
; rts
|
||||||
|
|
||||||
|
door_c4_r0:
|
||||||
|
.word door_c4_r0_status
|
||||||
|
.word door_c4_r0_x
|
||||||
|
.word door_c4_r0_y
|
||||||
|
.word door_c4_r0_xmin
|
||||||
|
.word door_c4_r0_xmax
|
||||||
|
|
||||||
|
door_c4_r0_status:
|
||||||
|
|
||||||
|
|
||||||
door_status:
|
|
||||||
c4_r0_door0_status: .byte DOOR_STATUS_CLOSED
|
c4_r0_door0_status: .byte DOOR_STATUS_CLOSED
|
||||||
c4_r0_door1_status: .byte DOOR_STATUS_CLOSED
|
c4_r0_door1_status: .byte DOOR_STATUS_CLOSED
|
||||||
c4_r0_door2_status: .byte DOOR_STATUS_LOCKED
|
c4_r0_door2_status: .byte DOOR_STATUS_LOCKED
|
||||||
c4_r0_door3_status: .byte DOOR_STATUS_LOCKED
|
c4_r0_door3_status: .byte DOOR_STATUS_LOCKED
|
||||||
c4_r0_door4_status: .byte DOOR_STATUS_LOCKED
|
c4_r0_door4_status: .byte DOOR_STATUS_LOCKED
|
||||||
|
|
||||||
door_x:
|
door_c4_r0_x:
|
||||||
c4_r0_door0_x: .byte 7
|
c4_r0_door0_x: .byte 7
|
||||||
c4_r0_door1_x: .byte 18
|
c4_r0_door1_x: .byte 18
|
||||||
c4_r0_door2_x: .byte 29
|
c4_r0_door2_x: .byte 29
|
||||||
c4_r0_door3_x: .byte 31
|
c4_r0_door3_x: .byte 31
|
||||||
c4_r0_door4_x: .byte 33
|
c4_r0_door4_x: .byte 33
|
||||||
|
|
||||||
door_y:
|
door_c4_r0_y:
|
||||||
c4_r0_door0_y: .byte 24
|
c4_r0_door0_y: .byte 24
|
||||||
c4_r0_door1_y: .byte 24
|
c4_r0_door1_y: .byte 24
|
||||||
c4_r0_door2_y: .byte 24
|
c4_r0_door2_y: .byte 24
|
||||||
c4_r0_door3_y: .byte 24
|
c4_r0_door3_y: .byte 24
|
||||||
c4_r0_door4_y: .byte 24
|
c4_r0_door4_y: .byte 24
|
||||||
|
|
||||||
door_xmin:
|
door_c4_r0_xmin:
|
||||||
c4_r0_door0_xmin: .byte 0 ; 7-4-5
|
c4_r0_door0_xmin: .byte 0 ; 7-4-5
|
||||||
c4_r0_door1_xmin: .byte 11 ; 18-4-5
|
c4_r0_door1_xmin: .byte 11 ; 18-4-5
|
||||||
c4_r0_door2_xmin: .byte 20 ; 29-4-5
|
c4_r0_door2_xmin: .byte 20 ; 29-4-5
|
||||||
c4_r0_door3_xmin: .byte 22 ; 31-4-5
|
c4_r0_door3_xmin: .byte 22 ; 31-4-5
|
||||||
c4_r0_door4_xmin: .byte 24 ; 33-4-5
|
c4_r0_door4_xmin: .byte 24 ; 33-4-5
|
||||||
|
|
||||||
door_xmax:
|
door_c4_r0_xmax:
|
||||||
c4_r0_door0_xmax: .byte 11 ; 7+4
|
c4_r0_door0_xmax: .byte 11 ; 7+4
|
||||||
c4_r0_door1_xmax: .byte 21 ; 18+4
|
c4_r0_door1_xmax: .byte 21 ; 18+4
|
||||||
c4_r0_door2_xmax: .byte 33 ; don't care
|
c4_r0_door2_xmax: .byte 33 ; don't care
|
||||||
|
Reference in New Issue
Block a user