Prev: 38579 Up: Map Next: 38780
38696: Report Who Is Carrying An Object
Used by the routine at Turn_RunTheHandlerIfPresent.
On the player's turn, if the object in A is held by a visible animal, it prints "<animal> is carrying <object>" and returns with the zero flag clear; otherwise it returns with the zero flag set.
Turn_ReportWhoIsCarryingAnObject 38696 CP 255 Return if the object id is 255.
38698 RET Z
38699 PUSH IX Save IX, IY and BC, and keep the object id in B.
38701 PUSH IY
38703 PUSH BC
38704 LD B,A
Test whose turn it is.
38705 LD A,(46826) Jump to Turn_ReportWhoIsCarryingAnObject_RestoreTheId if *CurrentCharacter is 0 (the player).
38708 CP 0
38710 JR Z,Turn_ReportWhoIsCarryingAnObject_RestoreTheId
38712 XOR A Set the zero flag.
38713 JR Turn_ReportWhoIsCarryingAnObject_Return Jump to Turn_ReportWhoIsCarryingAnObject_Return to return with the zero flag set.
Turn_ReportWhoIsCarryingAnObject_RestoreTheId 38715 LD A,B Take the object id back into A.
Find the object's record.
38716 CALL LocateObject Call LocateObject to locate object.
38719 LD A,(IX+1) Read where this object is from the object record.
38722 CP 255 Jump to Turn_ReportWhoIsCarryingAnObject_Return if this object is not inside another object.
38724 JR Z,Turn_ReportWhoIsCarryingAnObject_Return
38726 LD A,B Take the object id back into A.
38727 PUSH IX Point IY at this object and call ConditionIsTheObjectCarried_0 to test whether the character whose turn it is is carrying it.
38729 POP IY
38731 CALL ConditionIsTheObjectCarried_0
38734 JR C,Turn_ReportWhoIsCarryingAnObject_Return Jump to Turn_ReportWhoIsCarryingAnObject_Return if the character is carrying it.
Find the object's record.
38736 CALL LocateObject Call LocateObject to locate object.
38739 BIT 6,(IX+7) Jump to Turn_ReportWhoIsCarryingAnObject_Return if the object is not an animal.
38743 JR Z,Turn_ReportWhoIsCarryingAnObject_Return
38745 LD A,(49442) Jump to Turn_ReportWhoIsCarryingAnObject_Return if the player is not visible.
38748 BIT 7,A
38750 JR Z,Turn_ReportWhoIsCarryingAnObject_Return
38752 LD L,(IY+8) Read the name token from IY.
38755 LD H,(IY+9) Read the name token's high byte from IY.
38758 PUSH HL Read the name token from the object record.
38759 LD L,(IX+8)
38762 LD H,(IX+9) Read the name token's high byte from the object record.
38765 PUSH HL Point at the message "[0x04] is carrying[0x04][0x15]".
38766 LD HL,45028
38769 CALL PrintMessage Call PrintMessage to print message.
38772 OR 1 Clear the zero flag.
Turn_ReportWhoIsCarryingAnObject_Return 38774 POP BC Restore BC, IY and IX from the stack.
38775 POP IY
38777 POP IX
38779 RET Return.
Prev: 38579 Up: Map Next: 38780