Prev: 40381 Up: Map Next: 40485
40409: Condition: Same Place As The Player
Tests whether an object is in the same place as the player.
ConditionSamePlaceAsThePlayer 40409 PUSH BC Read *Pointer_CurrentCharacter.
40410 PUSH DE
40411 PUSH IY
40413 LD IY,(46860)
40417 LD D,(IY+16) Read the location from IY.
40420 LD A,(46864) Read *46864.
40423 LD E,A Keep the kind filter (0 not a live animal, 1 a live animal, 2 anything).
ConditionSamePlaceAsThePlayer_Loop 40424 CALL Table_StepThroughThreeByteRecords Call Table_StepThroughThreeByteRecords to step to the next index entry.
40427 JR Z,ConditionSamePlaceAsThePlayer_ReturnTheId Jump to ConditionSamePlaceAsThePlayer_ReturnTheId at the end of the index.
40429 LD A,2 Jump to ConditionSamePlaceAsThePlayer_PointAtTheName if the kind filter is 2 (any object).
40431 CP E
40432 JR Z,ConditionSamePlaceAsThePlayer_PointAtTheName
40434 LD A,(IY+7) Read the attribute flags from IY.
40437 AND 72 Keep bits 3, 6.
40439 CP 64 Take zero unless the object is an animal that is not broken.
40441 LD A,0
40443 JR NZ,ConditionSamePlaceAsThePlayer_TestTheKind
40445 INC A Count on from zero.
ConditionSamePlaceAsThePlayer_TestTheKind 40446 CP E Jump back to ConditionSamePlaceAsThePlayer_Loop unless this object's kind (1 for a live animal, else 0) matches the filter.
40447 JR NZ,ConditionSamePlaceAsThePlayer_Loop
ConditionSamePlaceAsThePlayer_PointAtTheName 40449 LD BC,8 Start at the object's name, 8 bytes into the record.
40452 PUSH IY Add 0008 onto the current object record.
40454 ADD IY,BC
40456 CALL Inglish_MatchClausePairs Call Inglish_MatchClausePairs to match clause pairs.
40459 POP IY Jump back to ConditionSamePlaceAsThePlayer_Loop if Inglish_MatchClausePairs did not match the name.
40461 JR NZ,ConditionSamePlaceAsThePlayer_Loop
Test this flag.
40463 LD A,(46863) Jump to ConditionSamePlaceAsThePlayer_ReturnTheId if *46863 is not zero.
40466 AND A
40467 JR NZ,ConditionSamePlaceAsThePlayer_ReturnTheId
40469 LD A,(IX+0) Read the id from the index entry.
40472 CALL ConditionTheObjectIsHere Call ConditionTheObjectIsHere to test whether the object is here.
40475 JR Z,ConditionSamePlaceAsThePlayer_Loop Jump back to ConditionSamePlaceAsThePlayer_Loop if ConditionTheObjectIsHere did not find the object here.
ConditionSamePlaceAsThePlayer_ReturnTheId 40477 LD A,(IX+0) Read the id from the index entry.
40480 POP IY Restore IY, DE and BC from the stack.
40482 POP DE
40483 POP BC
40484 RET Return.
View the equivalent code in;
Prev: 40381 Up: Map Next: 40485