Prev: 6622 Up: Map Next: 66A4
663D: Draw a guard
Used by the routine at 6622.
663D LD A,($6DBE) Pick up the guard's return delay counter.
6640 AND A Has this guard been thrown out of the park?
6641 JR Z,$6648 Jump if not.
6643 DEC A Decrement the guard's return delay counter.
6644 LD ($6DBE),A
6647 RET NZ Return unless it's zero now.
6648 LD HL,($6DBC) Update the guard's current location.
664B LD ($6DB8),HL
664E LD BC,($6DAE) Pick up the guard panic timer.
6652 LD A,B Are the guards panicking?
6653 OR C
6654 JR Z,$6673 Jump if not.
6656 DEC BC Decrement the guard panic timer.
6657 LD ($6DAE),BC
665B LD DE,$7EC7 Point HL at the graphic data for a panicked guard (frame 0).
665E EX DE,HL
665F LD A,($6DBB) Increment the guard's animation frame timer.
6662 INC A
6663 LD ($6DBB),A
6666 AND $08 Is bit 3 set now?
6668 CP $00
666A JR Z,$6670 Jump if not.
666C LD BC,$0020 Point DE at the graphic data for a panicked guard (frame 1), and restore the guard's location to HL.
666F ADD HL,BC
6670 EX DE,HL
6671 JR $669B Jump forward to draw the guard now.
6673 EX DE,HL Transfer the guard's location to DE.
6674 LD A,($6DBB) Increment the guard's animation frame timer.
6677 INC A
6678 LD ($6DBB),A
667B AND $20 Is bit 5 set now?
667D CP $00
667F JR NZ,$6686 Jump if so.
6681 LD HL,$7E47 Point HL at the graphic data for a regular guard (frame 4).
6684 JR $6689
6686 LD HL,$7DC7 Point HL at the graphic data for a regular guard (frame 0).
6689 LD A,($6DBA) Pick up the guard's animation frame.
668C RLC A Point DE at the corresponding graphic data for the guard sprite, and restore the guard's location to HL.
668E RLC A
6690 RLC A
6692 RLC A
6694 RLC A
6696 LD B,$00
6698 LD C,A
6699 ADD HL,BC
669A EX DE,HL
669B CALL $6C0F Set HL' to the attribute file address of the guard's location.
669E LD C,$3B This is the guard's attribute byte (INK 3: PAPER 7).
66A0 CALL $6BD6 Draw the guard.
66A3 RET
Prev: 6622 Up: Map Next: 66A4