2019-08-07 05:17:02 +00:00
|
|
|
|
2019-08-08 04:38:55 +00:00
|
|
|
DOOR_STATUS = 0
|
|
|
|
DOOR_STATUS_OPEN = $01
|
|
|
|
DOOR_STATUS_OPENING = $02
|
|
|
|
DOOR_STATUS_CLOSING = $04
|
|
|
|
DOOR_STATUS_CLOSED = $08
|
|
|
|
DOOR_STATUS_EXPLODED = $10
|
|
|
|
DOOR_STATUS_LOCKED = $20
|
|
|
|
DOOR_STATUS_EXPLODING = $40
|
|
|
|
|
|
|
|
|
|
|
|
door_state0:
|
|
|
|
.byte $0 ; status
|
|
|
|
.byte $0 ; explode_dir
|
|
|
|
.byte $0 ; left_trigger
|
|
|
|
.byte $0 ; right_trigger
|
|
|
|
.byte $0 ; step
|
|
|
|
|
|
|
|
|
2019-08-15 14:30:07 +00:00
|
|
|
;==================================
|
|
|
|
; draw_doors
|
|
|
|
;==================================
|
|
|
|
; be sure to smc to point to right place
|
2019-08-08 04:38:55 +00:00
|
|
|
|
2019-08-15 14:30:07 +00:00
|
|
|
draw_doors:
|
|
|
|
lda NUM_DOORS
|
|
|
|
beq done_draw_doors
|
2019-08-08 04:38:55 +00:00
|
|
|
|
2019-08-15 14:30:07 +00:00
|
|
|
ldx #0
|
|
|
|
draw_doors_loop:
|
2019-08-08 04:38:55 +00:00
|
|
|
lda #<door_closed_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>door_closed_sprite
|
|
|
|
sta INH
|
|
|
|
jmp actually_draw_door
|
|
|
|
|
|
|
|
|
|
|
|
door_not_closed:
|
|
|
|
|
|
|
|
|
|
|
|
actually_draw_door:
|
2019-08-15 14:30:07 +00:00
|
|
|
lda door_x,X
|
2019-08-08 04:38:55 +00:00
|
|
|
sta XPOS
|
2019-08-15 14:30:07 +00:00
|
|
|
lda door_y,X
|
2019-08-08 04:38:55 +00:00
|
|
|
sta YPOS
|
|
|
|
|
2019-08-15 14:30:07 +00:00
|
|
|
txa
|
|
|
|
pha
|
|
|
|
|
2019-08-08 04:38:55 +00:00
|
|
|
jsr put_sprite
|
|
|
|
|
2019-08-15 14:30:07 +00:00
|
|
|
pla
|
|
|
|
tax
|
|
|
|
|
|
|
|
draw_doors_continue:
|
|
|
|
inx
|
|
|
|
cmp NUM_DOORS
|
|
|
|
bne draw_doors_loop
|
|
|
|
|
2019-08-08 04:38:55 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
; if opening, update
|
|
|
|
|
|
|
|
; if closing, update
|
|
|
|
|
|
|
|
; if exploding, update
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;======================================
|
|
|
|
;======================================
|
|
|
|
; door sprites
|
|
|
|
;======================================
|
|
|
|
;======================================
|
|
|
|
|
|
|
|
door_closed_sprite:
|
|
|
|
.byte 1,10
|
|
|
|
.byte $00
|
|
|
|
.byte $00
|
|
|
|
.byte $00
|
|
|
|
.byte $00
|
|
|
|
.byte $00
|
|
|
|
.byte $00
|
|
|
|
.byte $00
|
|
|
|
.byte $00
|
|
|
|
.byte $00
|
|
|
|
.byte $00
|
|
|
|
|
|
|
|
door_open_sprite:
|
|
|
|
.byte 1,10
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
|
|
|
|
door_opening_sprite:
|
|
|
|
door_closing_sprite1:
|
|
|
|
.byte 1,10
|
|
|
|
.byte $00
|
|
|
|
.byte $A0
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $0A
|
|
|
|
.byte $00
|
|
|
|
|
|
|
|
door_closing_sprite2:
|
|
|
|
.byte 1,10
|
|
|
|
.byte $00
|
|
|
|
.byte $00
|
|
|
|
.byte $00
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $00
|
|
|
|
.byte $00
|
|
|
|
.byte $00
|
|
|
|
|
2019-08-08 19:38:10 +00:00
|
|
|
|
|
|
|
door_exploded_sprite:
|
|
|
|
.byte 1,10
|
|
|
|
.byte $00
|
|
|
|
.byte $A5
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $A5
|