Prev: 8D9D Up: Map Next: 8ED2
8E85: Action: Check The Object Flags
Used by the routines at Action_Direction and Action_LeaveIfTheWayIsOpen.
Checks the object's attributes and volume against the move volume at ActionMoveVolume and the current location at ActionLocationID before a move is allowed.
Action_CheckTheObjectFlags 8E85 AND A Jump to Action_CheckTheObjectFlags_ReadTheLocation if A is zero.
8E86 JR Z,Action_CheckTheObjectFlags_ReadTheLocation
Find the object's record.
8E88 CALL LocateObject Call LocateObject to locate object.
8E8B LD A,(IX+$07) Read the attribute flags from the object record.
8E8E AND $28 Keep bits 3, 5.
8E90 JR Z,Action_CheckTheObjectFlags_ReturnFlagValueOne Jump to Action_CheckTheObjectFlags_ReturnFlagValueOne when the object is neither broken nor open.
Test whose turn it is.
8E92 LD A,($B6EA) Jump to Action_CheckTheObjectFlags_ReadTheMoveVolume if *CurrentCharacter is not zero.
8E95 AND A
8E96 JR NZ,Action_CheckTheObjectFlags_ReadTheMoveVolume
8E98 BIT 7,(IX+$04) Jump to Action_CheckTheObjectFlags_ReturnFlagValueOne if bit 7 of the object's second flag is set.
8E9C JR NZ,Action_CheckTheObjectFlags_ReturnFlagValueOne
Action_CheckTheObjectFlags_ReadTheMoveVolume 8E9E LD A,($8D9C) Read the move volume.
8EA1 LD B,(IX+$02) Read the volume from the object record.
8EA4 SUB B Jump to Action_CheckTheObjectFlags_ReturnFlagValueTwo if the move volume is not below the object's volume.
8EA5 JR NC,Action_CheckTheObjectFlags_ReturnFlagValueTwo
Action_CheckTheObjectFlags_ReadTheLocation 8EA7 LD A,($8D9B) Read the current location.
8EAA LD B,A Copy the result into B.
Find the location's record.
8EAB CALL LocateLocation Call LocateLocation to locate location.
8EAE LD ($8D99),IX Save the location record pointer at ActionLocationData, and jump to Action_CheckTheObjectFlags_ReturnZero if this location's volume byte is FF.
8EB2 LD A,$FF
8EB4 CP (IX+$01)
8EB7 JR Z,Action_CheckTheObjectFlags_ReturnZero
8EB9 LD A,B Use the current location again.
8EBA CALL TableFindAnExit Call TableFindAnExit to find an exit.
8EBD LD C,A Jump to Action_CheckTheObjectFlags_ReturnFlagValueThree if the move volume is not below the current location.
8EBE LD A,($8D9C)
8EC1 SUB C
8EC2 JR NC,Action_CheckTheObjectFlags_ReturnFlagValueThree
Action_CheckTheObjectFlags_ReturnZero 8EC4 XOR A Return zero.
8EC5 RET Return.
Action_CheckTheObjectFlags_ReturnFlagValueThree 8EC6 LD A,$03 The flag value to return is 03.
8EC8 AND A Set the flags from 03. The zero flag is clear.
8EC9 RET Return.
Action_CheckTheObjectFlags_ReturnFlagValueTwo 8ECA LD A,$02 The flag value to return is 02.
8ECC AND A Set the flags from 02. The zero flag is clear.
8ECD RET Return.
Action_CheckTheObjectFlags_ReturnFlagValueOne 8ECE LD A,$01 The flag value to return is 01.
8ED0 AND A Set the flags from 01. The zero flag is clear.
8ED1 RET Return.
Prev: 8D9D Up: Map Next: 8ED2