peasant: check inventory before looking at things

This commit is contained in:
Vince Weaver 2021-12-06 01:17:58 -05:00
parent 51efed8436
commit 9d407a1dca
3 changed files with 166 additions and 3 deletions

View File

@ -76,6 +76,23 @@ parse_input_smc:
not_dan:
;=================================
; check if "look"ing at something in inventory
lda CURRENT_VERB
cmp #VERB_LOOK
bne not_look
jsr look_check_if_in_inventory
; if carry clear then can return early
bcs not_look
rts
not_look:
;================================
; jump into verb table
@ -1033,6 +1050,7 @@ noun_lookup_again:
.byte "HALDO",NOUN_HALDO|$80
.byte "IN HAY",NOUN_IN_HAY|$80
.byte "HAY",NOUN_HAY|$80
.byte "HELM",NOUN_HELM|$80
.byte "HOLE",NOUN_HOLE|$80
.byte "HORSE",NOUN_HORSE|$80
.byte "INN",NOUN_INN|$80
@ -1074,6 +1092,8 @@ noun_lookup_again:
.byte "SANDWICH",NOUN_SANDWICH|$80
.byte "SAND",NOUN_SAND|$80
.byte "SHELF",NOUN_SHELF|$80
.byte "SHIELD",NOUN_SHIELD|$80
.byte "SHIRT",NOUN_SHIRT|$80
.byte "SIGN",NOUN_SIGN|$80
.byte "SKELETON",NOUN_SKELETON|$80
.byte "SKULL",NOUN_SKULL|$80
@ -1082,6 +1102,7 @@ noun_lookup_again:
.byte "STUFF",NOUN_STUFF|$80
.byte "STUMP",NOUN_STUMP|$80
.byte "SUB",NOUN_SUB|$80
.byte "SWORD",NOUN_SWORD|$80
.byte "TARGET",NOUN_TARGET|$80
.byte "TRACKS",NOUN_TRACKS|$80
.byte "TREE",NOUN_TREE|$80
@ -1338,6 +1359,143 @@ common_verb_table:
.word parse_common_why-1
.byte 0
;===================================
; before looking
; check if item is/was in inventory
;===================================
; carry set if not found
; carry clear if found
look_check_if_in_inventory:
lda CURRENT_NOUN
ldx #INV1_ARROW
cmp #NOUN_ARROW
beq check_inventory_1
ldx #INV1_BABY
cmp #NOUN_BABY
beq check_inventory_1
ldx #INV1_KERREK_BELT
cmp #NOUN_BELT
beq check_inventory_1
ldx #INV1_CHICKEN_FEED
cmp #NOUN_FEED
beq check_inventory_1
ldx #INV1_BOW
cmp #NOUN_BOW
beq check_inventory_1
ldx #INV1_MONSTER_MASK
cmp #NOUN_MASK
beq check_inventory_1
ldx #INV1_PEBBLES
cmp #NOUN_PEBBLES
beq check_inventory_1
ldx #INV1_PILLS
cmp #NOUN_PILLS
beq check_inventory_1
ldx #INV2_RICHES
cmp #NOUN_RICHES
beq check_inventory_2
ldx #INV2_ROBE
cmp #NOUN_ROBE
beq check_inventory_2
ldx #INV2_SODA
cmp #NOUN_SODA
beq check_inventory_2
ldx #INV2_MEATBALL_SUB
cmp #NOUN_SUB
beq check_inventory_2
ldx #INV2_TRINKET
cmp #NOUN_TRINKET
beq check_inventory_2
ldx #INV2_TROGHELM
cmp #NOUN_HELM
beq check_inventory_2
ldx #INV2_TROGSHIELD
cmp #NOUN_SHIELD
beq check_inventory_2
ldx #INV2_TROGSWORD
cmp #NOUN_SWORD
beq check_inventory_2
ldx #INV3_SHIRT
cmp #NOUN_SHIRT
beq check_inventory_3
item_not_found:
sec
rts
check_inventory_1:
txa
and INVENTORY_1_GONE
bne inventory_gone
txa
and INVENTORY_1
bne inventory_there
sec
rts
check_inventory_2:
txa
and INVENTORY_2_GONE
bne inventory_gone
txa
and INVENTORY_2
bne inventory_there
sec
rts
check_inventory_3:
txa
and INVENTORY_3_GONE
bne inventory_gone
txa
and INVENTORY_3
bne inventory_there
sec
rts
inventory_gone:
ldx #<look_inventory_gone_message
ldy #>look_inventory_gone_message
jsr partial_message_step
clc
rts
inventory_there:
ldx #<look_inventory_there_message
ldy #>look_inventory_there_message
jsr partial_message_step
clc
rts
parse_input_file_end:
; make sure smaller than 4.5k

View File

@ -221,15 +221,16 @@ look_irrelevant_message:
.byte "You don't need to look at",13
.byte "that.",0
; TODO
; + look (at something previously in your inventory but now gone)
look_inventory_gone_message:
.byte "You used to have one,",13
.byte "before the great item",13
.byte "blight of 402. Check your",13
.byte "INVENTORY to read about it.",0
; TODO
; + look (at something currently in your inventory)
look_inventory_there_message:
.byte "You've totally got one of",13
.byte "those! Check your",13
.byte "INVENTORY to give'r a",13

View File

@ -194,5 +194,9 @@ NOUN_MATTRESS = 111
NOUN_PARCHMENT = 112
NOUN_DONGOLEV = 113
NOUN_HALDO = 114
NOUN_SHIRT = 115
NOUN_SHIELD = 116
NOUN_SWORD = 117
NOUN_HELM = 118
;
NOUN_UNKNOWN = 115
NOUN_UNKNOWN = 119