From f42f2cf598fba8dd71fda0d6644ba0834e1623f0 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 16 Dec 2020 15:39:27 -0500 Subject: [PATCH] duke: can pick up keys now --- duke/move_duke.s | 49 ++++++++++++++++++++++++++++++++++++++++++++++- duke/status_bar.s | 3 +++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/duke/move_duke.s b/duke/move_duke.s index bbae6f3e..7ccf5f7f 100644 --- a/duke/move_duke.s +++ b/duke/move_duke.s @@ -104,11 +104,58 @@ done_move_duke: ;========================= duke_collide: + ;================== + ; check for item + ;================== +duke_check_item: + lda DUKE_FOOT_OFFSET + sec + sbc #16 + tax + +check_red_key: + lda TILEMAP,X + cmp #31 ; red key + bne check_blue_key + + jsr pickup_noise + lda INVENTORY + ora #INV_RED_KEY + sta INVENTORY + + ; erase red key (304,96) + lda #0 + sta $A938 ; hack + + jsr copy_tilemap_subset + + jsr update_status_bar + + jmp duke_check_head + +check_blue_key: + cmp #30 ; blue key + bne duke_check_head + + jsr pickup_noise + lda INVENTORY + ora #INV_BLUE_KEY + sta INVENTORY + + ; erase blue key + lda #0 + sta $970c ; hack + + jsr copy_tilemap_subset + + jsr update_status_bar + + jmp duke_check_head ;=================== ; collide with head ;=================== - +duke_check_head: ; only check above head if jumping lda DUKE_JUMPING beq collide_left_right diff --git a/duke/status_bar.s b/duke/status_bar.s index 2326205e..d167af36 100644 --- a/duke/status_bar.s +++ b/duke/status_bar.s @@ -133,6 +133,9 @@ update_status_bar: jsr update_items + lda #2 + sta UPDATE_STATUS + rts ;===========================