Prev: 25562 Up: Map Next: 25947
25886: Redraw the tiles behind Horace and the guards if they've moved
Called from the main loop at 25129.
25886 LD HL,(31853) Pick up Horace's new location.
25889 LD DE,(31851) Pick up Horace's current location.
25893 XOR A Clear the carry flag.
25894 SBC HL,DE Subtract Horace's current location from his new location.
25896 LD A,H Has Horace moved?
25897 OR L
25898 JR Z,25914 Jump if not.
25900 LD HL,(31851) Pick up Horace's current location.
25903 LD DE,32647 Point DE at the graphic data for the blank sprite.
25906 CALL 27663 Set HL' to the attribute file address for Horace's location.
25909 LD C,62 This is the attribute byte for the blank sprite (INK 6: PAPER 7).
25911 CALL 27606 Draw the blank sprite over Horace's current location.
Now consider the guards.
25914 LD HL,28076 Point HL at the last of the guard countdown timers.
25917 LD B,1 B will count the guards: 1, 2, 3 and 4.
25919 PUSH BC Save the guard counter.
25920 LD A,(HL) Set the zero flag if this guard is in play.
25921 INC HL
25922 OR (HL)
25923 DEC HL Point HL at the next guard's countdown timer.
25924 DEC HL
25925 DEC HL
25926 PUSH HL Save the guard countdown timer pointer briefly.
25927 JR NZ,25938 Jump if this guard is not in play yet.
25929 CALL 27199 Copy the guard's buffer to the temporary location (28088).
25932 CALL 25947 Redraw the tiles behind the guard if he's moved.
25935 CALL 27242 Copy the guard's buffer back to its original location.
25938 POP HL Restore the guard countdown timer pointer to HL.
25939 POP BC Restore the guard counter to B.
25940 INC B Next guard.
25941 LD A,B Copy the guard counter to A.
25942 CP 5 Have we done all four guards yet?
25944 JR NZ,25919 If not, jump back to do the next one.
25946 RET
Prev: 25562 Up: Map Next: 25947