Prev: 8D9D Up: Map Next: 8ED2
8E85: Can the actor go this way?
Used by the routines at MOVE and GO_THROUGH.
A way through an object is shut unless the object is open (flag bit 5) or broken (bit 3), and the window, with bit 7 of its byte 4, will never let the player through at all. The actor, with all it carries (ACTOR_SIZE), must fit the opening -- byte 2 of the object's record -- and then the room it goes into must have space for it: byte 1 of a room's record is how much it holds, and $FF, for nearly every room, is no limit.
Input
A The object the way goes through, or 0
Output
A 0 it can; 1 it is shut; 2 "the ... is too small for you to enter."; 3 "... is too full for you to enter."
CAN_PASS 8E85 AND A No object in the way: only the room to check
8E86 JR Z,CAN_PASS_1
8E88 CALL GET_OBJECT Shut
8E8B LD A,(IX+$07)
8E8E AND $28
8E90 JR Z,CAN_PASS_5
8E92 LD A,(ACTING) The window: never for the player
8E95 AND A
8E96 JR NZ,CAN_PASS_0
8E98 BIT 7,(IX+$04)
8E9C JR NZ,CAN_PASS_5
CAN_PASS_0 8E9E LD A,(ACTOR_SIZE) Too big for the opening
8EA1 LD B,(IX+$02)
8EA4 SUB B
8EA5 JR NC,CAN_PASS_4
CAN_PASS_1 8EA7 LD A,(DESTINATION) The room's capacity, less what is in it...
8EAA LD B,A
8EAB CALL GET_ROOM
8EAE LD (DESTINATION_ROOM),IX
8EB2 LD A,$FF
8EB4 CP (IX+$01)
8EB7 JR Z,CAN_PASS_2
8EB9 LD A,B
8EBA CALL ROOM_LEFT
8EBD LD C,A
8EBE LD A,(ACTOR_SIZE) ...against the actor's size
8EC1 SUB C
8EC2 JR NC,CAN_PASS_3
CAN_PASS_2 8EC4 XOR A It can
8EC5 RET
CAN_PASS_3 8EC6 LD A,$03 3: the room is full
8EC8 AND A
8EC9 RET
CAN_PASS_4 8ECA LD A,$02 2: too small
8ECC AND A
8ECD RET
CAN_PASS_5 8ECE LD A,$01 1: shut
8ED0 AND A
8ED1 RET
Prev: 8D9D Up: Map Next: 8ED2