Prev: 9DBD Up: Map Next: 9E25
9DD9: Condition: Same Place As The Player
Tests whether an object is in the same place as the player.
ConditionSamePlaceAsThePlayer 9DD9 PUSH BC Read *Pointer_CurrentCharacter.
9DDA PUSH DE
9DDB PUSH IY
9DDD LD IY,($B70C)
9DE1 LD D,(IY+$10) Read the location from IY.
9DE4 LD A,($B710) Read *B710.
9DE7 LD E,A Keep the kind filter (00 not a live animal, 01 a live animal, 02 anything).
ConditionSamePlaceAsThePlayer_Loop 9DE8 CALL Table_StepThroughThreeByteRecords Call Table_StepThroughThreeByteRecords to step to the next index entry.
9DEB JR Z,ConditionSamePlaceAsThePlayer_ReturnTheId Jump to ConditionSamePlaceAsThePlayer_ReturnTheId at the end of the index.
9DED LD A,$02 Jump to ConditionSamePlaceAsThePlayer_PointAtTheName if the kind filter is 02 (any object).
9DEF CP E
9DF0 JR Z,ConditionSamePlaceAsThePlayer_PointAtTheName
9DF2 LD A,(IY+$07) Read the attribute flags from IY.
9DF5 AND $48 Keep bits 3, 6.
9DF7 CP $40 Take zero unless the object is an animal that is not broken.
9DF9 LD A,$00
9DFB JR NZ,ConditionSamePlaceAsThePlayer_TestTheKind
9DFD INC A Count on from zero.
ConditionSamePlaceAsThePlayer_TestTheKind 9DFE CP E Jump back to ConditionSamePlaceAsThePlayer_Loop unless this object's kind (01 for a live animal, else 00) matches the filter.
9DFF JR NZ,ConditionSamePlaceAsThePlayer_Loop
ConditionSamePlaceAsThePlayer_PointAtTheName 9E01 LD BC,$0008 Start at the object's name, 08 bytes into the record.
9E04 PUSH IY Add 0008 onto the current object record.
9E06 ADD IY,BC
9E08 CALL Inglish_MatchClausePairs Call Inglish_MatchClausePairs to match clause pairs.
9E0B POP IY Jump back to ConditionSamePlaceAsThePlayer_Loop if Inglish_MatchClausePairs did not match the name.
9E0D JR NZ,ConditionSamePlaceAsThePlayer_Loop
Test this flag.
9E0F LD A,($B70F) Jump to ConditionSamePlaceAsThePlayer_ReturnTheId if *B70F is not zero.
9E12 AND A
9E13 JR NZ,ConditionSamePlaceAsThePlayer_ReturnTheId
9E15 LD A,(IX+$00) Read the id from the index entry.
9E18 CALL ConditionTheObjectIsHere Call ConditionTheObjectIsHere to test whether the object is here.
9E1B JR Z,ConditionSamePlaceAsThePlayer_Loop Jump back to ConditionSamePlaceAsThePlayer_Loop if ConditionTheObjectIsHere did not find the object here.
ConditionSamePlaceAsThePlayer_ReturnTheId 9E1D LD A,(IX+$00) Read the id from the index entry.
9E20 POP IY Restore IY, DE and BC from the stack.
9E22 POP DE
9E23 POP BC
9E24 RET Return.
View the equivalent code in;
Prev: 9DBD Up: Map Next: 9E25