mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-02-19 08:31:23 +00:00
ootw: c4: doors work!
This commit is contained in:
parent
7095729b0d
commit
8fbea750da
@ -5,6 +5,10 @@ alien guard behavior:
|
||||
+ l4, if you draw gun (but not fire) guard won't shoot you,
|
||||
but instead will yell at you a bit
|
||||
|
||||
gun behavior:
|
||||
+ doors/walls should explode outward away from blast
|
||||
*unless* there is another door/wall behind it
|
||||
|
||||
+ L1
|
||||
- underwater there is a water-motion effect
|
||||
- bubble motion is fancier in real thing
|
||||
|
107
ootw/door.s
107
ootw/door.s
@ -1,7 +1,6 @@
|
||||
|
||||
DOOR_STATUS_OPEN = $00
|
||||
DOOR_STATUS_OPENING1 = $01
|
||||
DOOR_STATUS_OPENING2 = $02
|
||||
DOOR_STATUS_OPENING1 = $00
|
||||
DOOR_STATUS_OPENING2 = $01
|
||||
DOOR_STATUS_OPEN = $02
|
||||
DOOR_STATUS_CLOSING1 = $03
|
||||
DOOR_STATUS_CLOSING2 = $04
|
||||
DOOR_STATUS_CLOSED = $05
|
||||
@ -55,24 +54,108 @@ done_draw_doors:
|
||||
rts
|
||||
|
||||
|
||||
;==========================
|
||||
;==========================
|
||||
; handle doors
|
||||
|
||||
;==========================
|
||||
;==========================
|
||||
handle_doors:
|
||||
|
||||
; if closed xpos in range and phys ypos match -> opening
|
||||
; if open, xpos out of range, -> closing
|
||||
lda NUM_DOORS
|
||||
beq done_handle_doors
|
||||
|
||||
; if opening, update
|
||||
ldx #0
|
||||
handle_doors_loop:
|
||||
|
||||
; if closing, update
|
||||
; state machine
|
||||
lda door_status,X
|
||||
|
||||
; if exploding, update
|
||||
; if locked->do nothing
|
||||
cmp #DOOR_STATUS_LOCKED
|
||||
beq handle_doors_continue
|
||||
|
||||
; if exploded->do nothing
|
||||
cmp #DOOR_STATUS_EXPLODED
|
||||
beq handle_doors_continue
|
||||
|
||||
|
||||
; if closed and xpos/ypos in range: open
|
||||
; if open and xpos/ypos not ni range: close
|
||||
cmp #DOOR_STATUS_OPEN
|
||||
beq handle_doors_open
|
||||
cmp #DOOR_STATUS_CLOSED
|
||||
beq handle_doors_closed
|
||||
|
||||
; if exploding: continue exploding
|
||||
; if opening, continue to open
|
||||
; if closing, continue to close
|
||||
handle_door_inc_state:
|
||||
inc door_status,X
|
||||
|
||||
handle_doors_continue:
|
||||
inx
|
||||
cpx NUM_DOORS
|
||||
bne handle_doors_loop
|
||||
|
||||
done_handle_doors:
|
||||
rts
|
||||
|
||||
handle_doors_open:
|
||||
|
||||
; only open/close if on same level
|
||||
ldy door_y,X
|
||||
iny
|
||||
iny
|
||||
iny
|
||||
iny
|
||||
cpy PHYSICIST_Y
|
||||
bne close_door
|
||||
|
||||
lda PHYSICIST_X
|
||||
cmp door_xmax,X
|
||||
bcs close_door ; bge
|
||||
|
||||
cmp door_xmin,X
|
||||
bcc close_door ; blt
|
||||
|
||||
; made it here, we are in bounds, stay open
|
||||
|
||||
jmp handle_doors_continue
|
||||
|
||||
close_door:
|
||||
lda #DOOR_STATUS_CLOSING1
|
||||
sta door_status,X
|
||||
jmp handle_doors_continue
|
||||
|
||||
handle_doors_closed:
|
||||
|
||||
; only open if on same level
|
||||
|
||||
ldy door_y,X
|
||||
iny
|
||||
iny
|
||||
iny
|
||||
iny
|
||||
cpy PHYSICIST_Y
|
||||
bne handle_doors_continue
|
||||
|
||||
lda PHYSICIST_X
|
||||
cmp door_xmax,X
|
||||
bcs handle_doors_continue
|
||||
|
||||
cmp door_xmin,X
|
||||
bcc handle_doors_continue
|
||||
|
||||
open_door:
|
||||
lda #DOOR_STATUS_OPENING1
|
||||
sta door_status,X
|
||||
jmp handle_doors_continue
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -84,9 +167,9 @@ handle_doors:
|
||||
|
||||
|
||||
door_sprite_lookup_lo:
|
||||
.byte <door_open_sprite ; DOOR_STATUS_OPEN
|
||||
.byte <door_opening_sprite1 ; DOOR_STATUS_OPENING1
|
||||
.byte <door_opening_sprite2 ; DOOR_STATUS_OPENING2
|
||||
.byte <door_open_sprite ; DOOR_STATUS_OPEN
|
||||
.byte <door_closing_sprite1 ; DOOR_STATUS_CLOSING1
|
||||
.byte <door_closing_sprite2 ; DOOR_STATUS_CLOSING2
|
||||
.byte <door_closed_sprite ; DOOR_STATUS_CLOSED
|
||||
@ -96,9 +179,9 @@ door_sprite_lookup_lo:
|
||||
|
||||
door_sprite_lookup_hi:
|
||||
|
||||
.byte >door_open_sprite ; DOOR_STATUS_OPEN
|
||||
.byte >door_opening_sprite1 ; DOOR_STATUS_OPENING1
|
||||
.byte >door_opening_sprite2 ; DOOR_STATUS_OPENING2
|
||||
.byte >door_open_sprite ; DOOR_STATUS_OPEN
|
||||
.byte >door_closing_sprite1 ; DOOR_STATUS_CLOSING1
|
||||
.byte >door_closing_sprite2 ; DOOR_STATUS_CLOSING2
|
||||
.byte >door_closed_sprite ; DOOR_STATUS_CLOSED
|
||||
|
@ -702,12 +702,19 @@ no_fire_laser:
|
||||
|
||||
jsr draw_shields
|
||||
|
||||
;================
|
||||
; handle doors
|
||||
;================
|
||||
|
||||
jsr handle_doors
|
||||
|
||||
;================
|
||||
; draw doors
|
||||
;================
|
||||
|
||||
jsr draw_doors
|
||||
|
||||
|
||||
;========================
|
||||
; draw foreground cover
|
||||
;========================
|
||||
@ -1024,13 +1031,6 @@ pit_door_cover:
|
||||
|
||||
|
||||
|
||||
door_x:
|
||||
c4_r0_door0_x: .byte 7
|
||||
c4_r0_door1_x: .byte 18
|
||||
c4_r0_door2_x: .byte 29
|
||||
c4_r0_door3_x: .byte 31
|
||||
c4_r0_door4_x: .byte 33
|
||||
|
||||
door_y:
|
||||
c4_r0_door0_y: .byte 24
|
||||
c4_r0_door1_y: .byte 24
|
||||
@ -1045,3 +1045,24 @@ door_status:
|
||||
c4_r0_door3_status: .byte DOOR_STATUS_OPENING1
|
||||
c4_r0_door4_status: .byte DOOR_STATUS_OPENING2
|
||||
|
||||
door_x:
|
||||
c4_r0_door0_x: .byte 7
|
||||
c4_r0_door1_x: .byte 18
|
||||
c4_r0_door2_x: .byte 29
|
||||
c4_r0_door3_x: .byte 31
|
||||
c4_r0_door4_x: .byte 33
|
||||
|
||||
door_xmin:
|
||||
c4_r0_door0_xmin: .byte 0 ; 7-4-5
|
||||
c4_r0_door1_xmin: .byte 9 ; 18-4-5
|
||||
c4_r0_door2_xmin: .byte 20 ; 29-4-5
|
||||
c4_r0_door3_xmin: .byte 22 ; 31-4-5
|
||||
c4_r0_door4_xmin: .byte 24 ; 33-4-5
|
||||
|
||||
door_xmax:
|
||||
c4_r0_door0_xmax: .byte 11 ; 7+4
|
||||
c4_r0_door1_xmax: .byte 22 ; 18+4
|
||||
c4_r0_door2_xmax: .byte 33 ; don't care
|
||||
c4_r0_door3_xmax: .byte 35 ; don't care
|
||||
c4_r0_door4_xmax: .byte 37 ; don't care
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user