2019-08-07 05:17:02 +00:00
|
|
|
|
2019-08-15 15:36:53 +00:00
|
|
|
DOOR_STATUS_OPEN = $00
|
|
|
|
DOOR_STATUS_OPENING1 = $01
|
|
|
|
DOOR_STATUS_OPENING2 = $02
|
|
|
|
DOOR_STATUS_CLOSING1 = $03
|
|
|
|
DOOR_STATUS_CLOSING2 = $04
|
|
|
|
DOOR_STATUS_CLOSED = $05
|
|
|
|
DOOR_STATUS_EXPLODED = $06
|
|
|
|
DOOR_STATUS_LOCKED = $07
|
|
|
|
DOOR_STATUS_EXPLODING = $08
|
2019-08-08 04:38:55 +00:00
|
|
|
|
|
|
|
|
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
|
|
|
|
2019-08-15 15:36:53 +00:00
|
|
|
ldy door_status,X
|
2019-08-08 04:38:55 +00:00
|
|
|
|
2019-08-15 15:36:53 +00:00
|
|
|
; ldy #1
|
2019-08-08 04:38:55 +00:00
|
|
|
|
2019-08-15 15:36:53 +00:00
|
|
|
lda door_sprite_lookup_lo,Y
|
|
|
|
sta INL
|
|
|
|
lda door_sprite_lookup_hi,Y
|
|
|
|
sta INH
|
2019-08-08 04:38:55 +00:00
|
|
|
|
|
|
|
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
|
2019-08-15 15:36:53 +00:00
|
|
|
cpx NUM_DOORS
|
2019-08-15 14:30:07 +00:00
|
|
|
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
|
|
|
|
;======================================
|
|
|
|
;======================================
|
|
|
|
|
2019-08-15 15:36:53 +00:00
|
|
|
|
|
|
|
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_closing_sprite1 ; DOOR_STATUS_CLOSING1
|
|
|
|
.byte <door_closing_sprite2 ; DOOR_STATUS_CLOSING2
|
|
|
|
.byte <door_closed_sprite ; DOOR_STATUS_CLOSED
|
|
|
|
.byte <door_exploded_sprite ; DOOR_STATUS_EXPLODED
|
|
|
|
.byte <door_closed_sprite ; DOOR_STATUS_LOCKED
|
|
|
|
.byte <door_exploding_sprite1 ; DOOR_STATUS_EXPLODING
|
|
|
|
|
|
|
|
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_closing_sprite1 ; DOOR_STATUS_CLOSING1
|
|
|
|
.byte >door_closing_sprite2 ; DOOR_STATUS_CLOSING2
|
|
|
|
.byte >door_closed_sprite ; DOOR_STATUS_CLOSED
|
|
|
|
.byte >door_exploded_sprite ; DOOR_STATUS_EXPLODED
|
|
|
|
.byte >door_closed_sprite ; DOOR_STATUS_LOCKED
|
|
|
|
.byte >door_exploding_sprite1 ; DOOR_STATUS_EXPLODING
|
|
|
|
|
|
|
|
|
2019-08-08 04:38:55 +00:00
|
|
|
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
|
|
|
|
|
2019-08-15 15:36:53 +00:00
|
|
|
door_opening_sprite2:
|
2019-08-08 04:38:55 +00:00
|
|
|
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
|
|
|
|
|
2019-08-15 15:36:53 +00:00
|
|
|
door_opening_sprite1:
|
2019-08-08 04:38:55 +00: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
|
2019-08-15 15:36:53 +00:00
|
|
|
|
|
|
|
door_exploding_sprite1:
|
|
|
|
.byte 1,10
|
|
|
|
.byte $00
|
|
|
|
.byte $A5
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $AA
|
|
|
|
.byte $A5
|