Routines

29856: Check if teachers were hit by pellet/water/sherry/conker


Used by routine at 29896. Returns with the zero flag set if a character was hit, and the stricken character's number in B.

DE Coordinates of pellet/water/sherry/conker
H Pellet/water/sherry/conker's character number

29856 0606 LD B,6 There are six adult characters

This entry point is used by the routine at 30380:
29858 4C LD C,H
29859 26C8 LD H,200 200=MR WACKER
29861 2E02 LD L,2
29863 7A LD A,D A=projectile's y-coordinate
29864 BE CP (HL) Does it match that of the character?
29865 2016 JR NZ,29889 Jump if not
29867 2E00 LD L,0
29869 7E LD A,(HL) A=character's animatory state
29870 E687 AND 135
29872 FE06 CP 6 Is the character sitting on the floor facing left (already struck)?
29874 2805 JR Z,29881 Jump if so
29876 2D DEC L
29877 FE86 CP 134 Is the character sitting on the floor facing right (already struck)?
29879 2801 JR Z,29882 Jump if so
29881 2C INC L
29882 7D LD A,L
29883 2E01 LD L,1
29885 86 ADD A,(HL) A=x-coordinate of character's head
29886 BB CP E Does this match that of the projectile?
29887 2803 JR Z,29892 Jump if so
29889 24 INC H Next character
29890 10E1 DJNZ 29861 Jump back to consider remaining characters
29892 44 LD B,H B=number of character hit by projectile (if any)
29893 61 LD H,C Restore projectile's character number to H
29894 C9 RET Return with the zero flag set if a character was hit