From 5450e1d92e3582edd3c39d0056f97fe38acdb7dd Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 8 Aug 2019 00:38:55 -0400 Subject: [PATCH] ootw: c4: work on doors --- ootw/Makefile | 1 + ootw/door.s | 145 ++++++++++++++++++++++++++++++++++++++++++++++--- ootw/ootw_c4.s | 2 + 3 files changed, 141 insertions(+), 7 deletions(-) diff --git a/ootw/Makefile b/ootw/Makefile index ba487ab5..86872ec1 100644 --- a/ootw/Makefile +++ b/ootw/Makefile @@ -94,6 +94,7 @@ ootw_c4.o: ootw_c4.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_c4_city.s \ + door.s \ ootw_graphics/sprites/physicist.inc \ ootw_graphics/l4city/ootw_c4_city.inc ca65 -o ootw_c4.o ootw_c4.s -l ootw_c4.lst diff --git a/ootw/door.s b/ootw/door.s index 378ee013..d219e078 100644 --- a/ootw/door.s +++ b/ootw/door.s @@ -1,9 +1,140 @@ +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_EXPLODE_DIR = 1 +DOOR_LEFT_TRIGGER = 2 +DOOR_RIGHT_TRIGGER = 3 +DOOR_STEP = 4 +DOOR_XPOS = 5 +DOOR_YPOS = 6 + door_state: - exploded - opened - opening - closing - explode_direction - left_trigger - right_trigger + +door_state0: + .byte $0 ; status + .byte $0 ; explode_dir + .byte $0 ; left_trigger + .byte $0 ; right_trigger + .byte $0 ; step + + +draw_doors: + + lda door_state+DOOR_STATUS + and #(DOOR_STATUS_OPEN | DOOR_STATUS_EXPLODED) + bne done_draw_doors + + lda door_state+DOOR_STATUS + cmp #DOOR_STATUS_CLOSED + bne door_not_closed + +door_closed: + lda #door_closed_sprite + sta INH + jmp actually_draw_door + + +door_not_closed: + + +actually_draw_door: + lda door_state+DOOR_XPOS + sta XPOS + lda door_state+DOOR_YPOS + sta YPOS + + jsr put_sprite + +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 + diff --git a/ootw/ootw_c4.s b/ootw/ootw_c4.s index a91aa7fa..f653bf25 100644 --- a/ootw/ootw_c4.s +++ b/ootw/ootw_c4.s @@ -100,6 +100,8 @@ end_message: .include "physicist.s" .include "alien.s" +.include "door.s" + ; room backgrounds .include "ootw_graphics/l4city/ootw_c4_city.inc" ; sprites