Routines |
Prev: CCCD | Up: Map | Next: CD31 |
This searches through item_structs for items which have been moved away from their default room. The red cross parcel is ignored.
Used by the routines at move_a_character and is_item_discoverable.
|
||||||||||||||
is_item_discoverable_interior | CCFB | LD C,A | Save the room index in C | |||||||||||
CCFC | LD HL,$76C9 | Point HL at the first item_struct's room member | ||||||||||||
CCFF | LD B,$10 | Set B for 16 iterations (item__LIMIT) | ||||||||||||
Start loop
|
||||||||||||||
iidi_loop | CD01 | LD A,(HL) | Load the room index and flags | |||||||||||
CD02 | AND $3F | Extract the room index | ||||||||||||
Is the item in the specified room?
|
||||||||||||||
CD04 | CP C | Same room? | ||||||||||||
CD05 | JR NZ,iidi_next | Jump if not | ||||||||||||
CD07 | PUSH HL | Preserve the item_struct pointer | ||||||||||||
Has the item been moved to a room other than its default?
Bug: room_and_flags doesn't get its flags masked off in the following sequence. However, the only default_item which uses the flags is the wiresnips. The DOS version of the game fixes this.
|
||||||||||||||
CD08 | DEC HL | Fetch item_and_flags | ||||||||||||
CD09 | LD A,(HL) | |||||||||||||
CD0A | AND $0F | Mask off the item | ||||||||||||
CD0C | LD E,A | Multiply by three - the array stride | ||||||||||||
CD0D | ADD A,A | |||||||||||||
CD0E | ADD A,E | |||||||||||||
CD0F | LD E,A | Widen to 16-bit | ||||||||||||
CD10 | LD D,$00 | |||||||||||||
CD12 | LD HL,$CD6A | Add to default_item_locations | ||||||||||||
CD15 | ADD HL,DE | |||||||||||||
CD16 | LD A,(HL) | Fetch the default item room_and_flags | ||||||||||||
CD17 | CP C | Same room? (bug: not masked) | ||||||||||||
CD18 | JR NZ,iidi_not_default_room | Jump if not | ||||||||||||
CD1A | POP HL | Restore the item_struct pointer | ||||||||||||
iidi_next | CD1B | LD DE,$0007 | Step HL to the next item_struct | |||||||||||
CD1E | ADD HL,DE | |||||||||||||
CD1F | DJNZ iidi_loop | ...loop | ||||||||||||
CD21 | RET | Return with NZ set (not found) | ||||||||||||
iidi_not_default_room | CD22 | POP HL | Restore the item_struct pointer | |||||||||||
CD23 | DEC HL | Fetch item_and_flags | ||||||||||||
CD24 | LD A,(HL) | |||||||||||||
CD25 | AND $0F | Mask off the item | ||||||||||||
Ignore the red cross parcel.
|
||||||||||||||
CD27 | CP $0C | Is this item the red cross parcel? (item_RED_CROSS_PARCEL) | ||||||||||||
CD29 | JR NZ,iidi_found | Jump if not | ||||||||||||
CD2B | INC HL | Otherwise advance HL to room_and_flags | ||||||||||||
CD2C | JR iidi_next | Jump to the next iteration | ||||||||||||
iidi_found | CD2E | LD C,A | Return the item's index in C | |||||||||||
CD2F | XOR A | Return with Z set (found) | ||||||||||||
CD30 | RET |
Prev: CCCD | Up: Map | Next: CD31 |