Routines
 Prev: 28380 Up: Map Next: 28442
28416: Check whether a character was or can be punched by ERIC or ANGELFACE
Used by the routines at 28446 and 28569. On entry, E holds the x-coordinate of the spot three spaces in front of ANGELFACE to check whether it's worth raising his fist (28446), or the x-coordinate of the spot two spaces in front of ERIC or ANGELFACE when he has already raised his fist (28569). Returns with the carry flag set if the potential victim is at the target coordinates and is facing the right way.
Input
C Punching character's animatory state
D Punching character's y-coordinate
E Target x-coordinate (2 or 3 spaces in front of the punching character)
H Character number of the potential victim (152-172)
28416 LD L,98 Byte 98 of a character's buffer holds his x-coordinate
28418 LD A,(HL) Pick this up in A
28419 CP E Is this character at the target x-coordinate?
28420 JR Z,28424 Jump if so
28422 AND A Reset the carry flag to indicate absence of character
28423 RET
28424 DEC L Byte 97 holds the character's y-coordinate
28425 LD A,(HL) Pick this up in A
28426 CP D Is this character at the target y-coordinate?
28427 JR NZ,28422 Jump if not
The character being checked has been found at the target coordinates. But is he facing the right way?
28429 DEC L Byte 96 holds the character's animatory state
28430 LD A,(HL) Pick this up in A
28431 XOR C Now A=128 if the character and puncher are facing each other, and 0 otherwise
28432 AND 128
28434 RET Z Return if the character's not facing the puncher
28435 LD L,112 Is there an uninterruptible subcommand routine address in bytes 111 and 112 of the potential victim's buffer (i.e. is he not in a punchable state at the moment)?
28437 LD A,(HL)
28438 AND A
28439 RET NZ Return with the carry flag reset if so
28440 SCF Set the carry flag to indicate the presence of a ripe target
28441 RET
 Prev: 28380 Up: Map Next: 28442