Prev: 748C Up: Map Next: 74C7
74A0: Check whether any adults were hit by the pellet, water, sherry or conker
Used by the routine at 74C8. Returns with the zero flag set if a character was hit, and the stricken character's number in B.
Input
DE Pellet/water/sherry/conker's coordinates
H Pellet/water/sherry/conker's character number (0xD5 or 0xD6)
74A0 LD B,$06 There are six adult characters
This entry point is used by the routine at 76AC with B=5 (only five of the adults are pelletable) and H=0xD5/0xD6 (BOY WANDER's or ERIC's pellet).
74A2 LD C,H Save the projectile's character number in C
74A3 LD H,$C8 0xC8=MR WACKER
74A5 LD L,$02 Point HL at byte 0x02 of the potential target's character buffer
74A7 LD A,D A=projectile's y-coordinate
74A8 CP (HL) Does it match the y-coordinate of the character?
74A9 JR NZ,$74C1 Jump if not
74AB LD L,$00
74AD LD A,(HL) A=character's animatory state
74AE AND $87 Is the character sitting on the floor facing left (already struck)?
74B0 CP $06
74B2 JR Z,$74B9 Jump if so
74B4 DEC L L=-1
74B5 CP $86 Is the character sitting on the floor facing right (already struck)?
74B7 JR Z,$74BA Jump if so
74B9 INC L
74BA LD A,L A=-1 if the character is sitting on the floor facing right, 0 if he's standing, or 1 if he's sitting on the floor facing left
74BB LD L,$01 Byte 0x01 of the character's buffer holds his x-coordinate
74BD ADD A,(HL) Now A=x-coordinate of the character's head
74BE CP E Does it match the x-coordinate of the projectile?
74BF JR Z,$74C4 Jump if so
74C1 INC H Next potential target
74C2 DJNZ $74A5 Jump back to consider any remaining characters
74C4 LD B,H B=number of the character who was hit by the projectile (if any)
74C5 LD H,C Restore the projectile's character number to H
74C6 RET Return with the zero flag set if a character was hit
Prev: 748C Up: Map Next: 74C7