Prev: 77C6 Up: Map Next: 77F2
77C8: Check whether any characters were or can be punched by ERIC or ANGELFACE
Used by the routines at 77F2 and 7813. On entry, B holds 3 when checking whether it's worth ANGELFACE raising his fist (77F2), or 2 when ERIC or ANGELFACE has already raised his fist (7813). 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 0xCF (ANGELFACE) or 0xD2 (ERIC)
77C8 LD L,$00 Point HL at byte 0x00 of the punching character's buffer
77CA BIT 7,(HL) Set the zero flag if the character is facing left
77CC LD L,$01
77CE LD C,(HL) C=punching character's x-coordinate
77CF PUSH BC Save this x-coordinate for now
77D0 LD A,B A=2 (fist already raised) or 3
77D1 JR NZ,$77D5 Jump if the punching character is facing right
77D3 NEG
77D5 ADD A,(HL) A=x-coordinate of the spot 2 or 3 spaces in front of the punching character
77D6 LD (HL),A Set this as the character's x-coordinate temporarily
77D7 DEC L L=0x00
77D8 LD A,(HL) A=punching character's animatory state
77D9 CPL C=0x00 if the character's facing right, 0x80 if left
77DA AND $80
77DC LD C,A
77DD LD D,$CE 0xCE=BOY WANDER (first main kid)
77DF LD B,$05 There are 5 main kids
77E1 CALL $6C9C Were any of them hit?
77E4 JR NC,$77ED Jump if so
77E6 LD D,$B7 0xB7=little girl no. 1
77E8 LD B,$11 There are 17 little kids (10 boys, 7 girls)
77EA CALL $6C9C Reset the carry flag if any of them were hit
77ED POP BC Restore the punching character's x-coordinate
77EE LD L,$01
77F0 LD (HL),C
77F1 RET Return with the carry flag reset if someone was hit or found within hitting range, and D holding that character's number
Prev: 77C6 Up: Map Next: 77F2