Prev: 26146 Up: Map Next: 26276
26173: Draw a guard
Used by the routine at 26146.
26173 LD A,(28094) Pick up the guard's return delay counter.
26176 AND A Has this guard been thrown out of the park?
26177 JR Z,26184 Jump if not.
26179 DEC A Decrement the guard's return delay counter.
26180 LD (28094),A
26183 RET NZ Return unless it's zero now.
26184 LD HL,(28092) Update the guard's current location.
26187 LD (28088),HL
26190 LD BC,(28078) Pick up the guard panic timer.
26194 LD A,B Are the guards panicking?
26195 OR C
26196 JR Z,26227 Jump if not.
26198 DEC BC Decrement the guard panic timer.
26199 LD (28078),BC
26203 LD DE,32455 Point HL at the graphic data for a panicked guard (frame 0).
26206 EX DE,HL
26207 LD A,(28091) Increment the guard's animation frame timer.
26210 INC A
26211 LD (28091),A
26214 AND 8 Is bit 3 set now?
26216 CP 0
26218 JR Z,26224 Jump if not.
26220 LD BC,32 Point DE at the graphic data for a panicked guard (frame 1), and restore the guard's location to HL.
26223 ADD HL,BC
26224 EX DE,HL
26225 JR 26267 Jump forward to draw the guard now.
26227 EX DE,HL Transfer the guard's location to DE.
26228 LD A,(28091) Increment the guard's animation frame timer.
26231 INC A
26232 LD (28091),A
26235 AND 32 Is bit 5 set now?
26237 CP 0
26239 JR NZ,26246 Jump if so.
26241 LD HL,32327 Point HL at the graphic data for a regular guard (frame 4).
26244 JR 26249
26246 LD HL,32199 Point HL at the graphic data for a regular guard (frame 0).
26249 LD A,(28090) Pick up the guard's animation frame.
26252 RLC A Point DE at the corresponding graphic data for the guard sprite, and restore the guard's location to HL.
26254 RLC A
26256 RLC A
26258 RLC A
26260 RLC A
26262 LD B,0
26264 LD C,A
26265 ADD HL,BC
26266 EX DE,HL
26267 CALL 27663 Set HL' to the attribute file address of the guard's location.
26270 LD C,59 This is the guard's attribute byte (INK 3: PAPER 7).
26272 CALL 27606 Draw the guard.
26275 RET
Prev: 26146 Up: Map Next: 26276