Prev: 6AA1 Up: Map Next: 6AD7
6AA7: Deal with ERIC when he's been knocked over
Used by the routine at 6AD9 when bit 4 of ERIC's status flags at 7FFB is set (by the routine at 6F99, 6D1C or 6B97).
6AA7 LD HL,$7FF5 7FF5 holds the delay counter used when ERIC has been knocked over; pick up its value (0x00-0x28) in A
6AAA LD A,(HL)
6AAB AND A Has ERIC just been struck (A=0x00)?
6AAC JR Z,$6AB7 Adjust his animatory state if so (and initialise the delay counter to 0x28)
6AAE DEC (HL) Decrement the knockout delay counter
6AAF JP NZ,$FE57 Make a knocked-out sound effect if ERIC's just been struck
The knockout delay counter at 7FF5 has reached zero, so ERIC can get up any time now.
6AB2 LD L,$FB HL=7FFB (ERIC's status flags)
6AB4 LD (HL),$80 Set bit 7 (indicating that ERIC is sitting or lying down) and reset bit 4 (so that we don't visit this routine again)
6AB6 RET
ERIC has just been struck; decide whether he should be sitting on the floor or lying on his back, and adjust his animatory state accordingly.
6AB7 LD (HL),$28 Initialise the knockout delay counter at 7FF5
6AB9 LD L,$E9 Set 7FE9 to 0, indicating that ERIC is not midstride
6ABB LD (HL),A
6ABC LD L,$FB HL=7FFB (ERIC's status flags)
6ABE LD (HL),$90 Set bit 7 (indicating that ERIC is sitting or lying down) and keep bit 4 set (so that we visit this routine again)
6AC0 LD H,$AC 0xAC=ERIC
6AC2 CALL $6214 Update the SRB for ERIC's current location
6AC5 CP $05 0x05=animatory state of ERIC sitting on a chair
6AC7 JR Z,$6ACD Jump if ERIC's sitting on a chair
6AC9 AND $80
6ACB ADD A,$06
6ACD INC A A=0x06 (ERIC sitting on the floor) or 0x07/0x87 (ERIC lying on his back)
6ACE LD B,A Store ERIC's new animatory state in B temporarily
6ACF LD A,D A=ERIC's y-coordinate
6AD0 CALL $7A0A Get the y-coordinate of the floor ERIC's on in D
6AD3 LD A,B Restore ERIC's new animatory state to A
6AD4 JP $61B0 Update ERIC's animatory state and update the SRB
Prev: 6AA1 Up: Map Next: 6AD7