Prev: EB79 Up: Map Next: EBC4
EB95: Pattern 0 AT OBJ(x) : Match if at an item
-
Input
HL : Points to the room's object ID to test for
EB95 LD B,(HL) Put the object to test for in B.
EB96 INC HL Ensure HL points to the next pattern.
EB97 PUSH HL Store this.
EB98 LD A,($EB54) Get the current ID of the item the player is next to, if any.
EB9B OR A Was there one?
EB9C JR NZ,$EBC0 Jump forward if not.
There's an item here, is it the right one.
EB9E LD (IY-$2D),B Put the ID of the object to test in the buffer at BC3A.
EBA1 CALL $AA8C Get the object's data.
EBA4 LD A,(IY+$05) Get the X co-ordinate.
EBA7 INC HL Point to the item's X co-ordinate.
EBA8 SUB (HL) Is is near enough?
EBA9 SUB $04
EBAB CP $F8
EBAD JR C,$EBC0 If it isn't, jump forward to set the pattern as not matched.
EBAF INC HL Point to the item's Y co-ordinate.
EBB0 LD A,(IY+$0A) Get the player's Y co-ordinate.
EBB3 ADD A,$10 Is it near enough?
EBB5 SUB (HL)
EBB6 SUB $04
EBB8 CP $F8
EBBA JR C,$EBC0 If not, jump forward to set the pattern as not matched.
There's the right object here, and the player is near enough to it.
EBBC POP HL Restore the address of the next pattern in HL.
EBBD JP $EACB Carry on looking at other patterns.
There's no item here, or it's not the right one.
EBC0 POP HL Restore the address of the next pattern in HL.
EBC1 JP $EAE3 Flag the pattern has having not matched.
Prev: EB79 Up: Map Next: EBC4