Routines

27820: Check if any characters are in front of fist or pellet


Used by routines at 27804, 29896 and 30380

B Number of characters to check
D Number of first character to check
H Puncher's or pellet's character number

27820 EB EX DE,HL
27821 2E01 LD L,1
27823 5D LD E,L
27824 1A LD A,(DE) A=x-coordinate of pellet or puncher's fist
27825 BE CP (HL) Does this match the target character's x-coordinate?
27826 2806 JR Z,27834 Jump if so
27828 24 INC H Otherwise move to the next potential target
27829 10F6 DJNZ 27821
27831 EB EX DE,HL
27832 37 SCF Signal: no character was hit
27833 C9 RET
27834 2C INC L
27835 1C INC E
27836 1A LD A,(DE) A=y-coordinate of pellet or puncher's fist
27837 BE CP (HL) Does this match the target character's y-coordinate?
27838 20F4 JR NZ,27828 Jump back to consider next character if not
27840 7C LD A,H A=number of stricken character
27841 FED2 CP 210 Was ERIC hit?
27843 2808 JR Z,27853 Jump if so
27845 2E12 LD L,18 Bytes 17 and 18 of the character's buffer may hold the address of a controlling routine
27847 7E LD A,(HL) A=0 unless the character is engaged in some activity which would prevent him from being knocked over
27848 A7 AND A Can the stricken character actually be knocked over?
27849 20E9 JR NZ,27828 Jump back to consider next character if not
27851 EB EX DE,HL Transfer the stricken character's number to D
27852 C9 RET
27853 3AFB7F LD A,(32763) A=0 unless ERIC is engaged in some activity other than walking
27856 18F6 JR 27848