Prev: 30662 Up: Map Next: 30706
30664: Check whether any characters were or can be punched by ERIC or ANGELFACE
Used by the routines at 30706 and 30739. On entry, B holds 3 when checking whether it's worth ANGELFACE raising his fist (30706), or 2 when ERIC or ANGELFACE has already raised his fist (30739). Returns with the carry flag reset if anyone was hit or is within hitting range, and D holding that unfortunate character's number.
Input
B 2 or 3
H 207 (ANGELFACE) or 210 (ERIC)
30664 LD L,0 Point HL at byte 0 of the punching character's buffer
30666 BIT 7,(HL) Set the zero flag if the character is facing left
30668 LD L,1
30670 LD C,(HL) C=punching character's x-coordinate
30671 PUSH BC Save this x-coordinate for now
30672 LD A,B A=2 (fist already raised) or 3
30673 JR NZ,30677 Jump if the punching character is facing right
30675 NEG
30677 ADD A,(HL) A=x-coordinate of the spot 2 or 3 spaces in front of the punching character
30678 LD (HL),A Set this as the character's x-coordinate temporarily
30679 DEC L L=0
30680 LD A,(HL) A=punching character's animatory state
30681 CPL C=0 if the character's facing right, 128 if left
30682 AND 128
30684 LD C,A
30685 LD D,206 206=BOY WANDER (first main kid)
30687 LD B,5 There are 5 main kids
30689 CALL 27804 Were any of them hit?
30692 JR NC,30701 Jump if so
30694 LD D,183 183=little girl no. 1
30696 LD B,17 There are 17 little kids (10 boys, 7 girls)
30698 CALL 27804 Reset the carry flag if any of them were hit
30701 POP BC Restore the punching character's x-coordinate
30702 LD L,1
30704 LD (HL),C
30705 RET Return with the carry flag reset if someone was hit or found within hitting range, and D holding that character's number
Prev: 30662 Up: Map Next: 30706