Skip to content

Commit 830b5fb

Browse files
committed
Rug-behaviour only triggers once
This prevents weirdness if a player gets the rug, drops it, then gets it again.
1 parent 0ccd899 commit 830b5fb

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

game.z80

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,13 +1126,32 @@ get_found_it_take:
11261126
inc hl
11271127
ld (hl),255
11281128

1129-
; HACK - Was the item being taken the rug?
1129+
;
1130+
; HACK - We don't have a notion of a take-handler
1131+
; so we can't show the trapdoor when the rug
1132+
; is taken.
1133+
;
1134+
; Hardwire that behaviour here, even though that
1135+
; is horrid.
1136+
;
1137+
; The alternative would have been to give some kind of
1138+
; "rug covers other objects" property to the rug.
1139+
;
11301140
ld de, tmp_buffer+1
11311141
ld hl, item_7_name
11321142
ld b, 3 ; strlen("RUG")
11331143
call CompareStringsWithLength
11341144
jp nz, not_taken_rug
11351145

1146+
; Taking the rug should only trigger this behaviour
1147+
; once - store state in `RUG_TAKEN` and ensure it
1148+
; doesn't get triggered more than once.
1149+
ld hl, RUG_TAKEN
1150+
ld a,(hl)
1151+
cp 0
1152+
jr nz, not_taken_rug
1153+
inc (hl)
1154+
11361155
; show a message telling the user about the trapdoor.
11371156
ld de, rug_taken_msg
11381157
call show_msg
@@ -1902,7 +1921,8 @@ PLAYER_WON:
19021921
db 0
19031922
MAGIC_LOCATION
19041923
db 0
1905-
1924+
RUG_TAKEN:
1925+
db 0
19061926

19071927
;********************************************************************
19081928
; String Area

0 commit comments

Comments
 (0)