Prev: 31905 Up: Map Next: 31952
31915: Check whether a character should continue walking up and down
Used by the routines at 31952 and 31969 after a character has reached a walkabout destination. It checks the signal for the event specified by byte 6 of the character's buffer, and returns with the carry flag reset if the signal has been raised and the character has returned to the walkabout origin.
Input
H Character number (183-209)
31915 LD L,6 Pick up the event identifier in A
31917 LD A,(HL)
31918 DEC L L=5
31919 CALL 31887 Has the signal been raised for this event?
31922 JR Z,31942 Jump if not
This entry point is used by the routine at 31969.
31924 LD A,(HL) A=x-coordinate of the location relative to which the character is performing his walkabout (the 'walkabout origin'), stored in byte 5
31925 LD L,1 Byte 1 of the character's buffer holds his current x-coordinate
31927 CP (HL) Is the character at the walkabout origin (and therefore ready to respond to the signal)?
31928 JR NZ,31934 Return him to the walkabout origin if not
31930 DEC L Point HL at byte 0 of the character's buffer
31931 BIT 0,(HL) Is the character midstride?
31933 RET Z Return with the carry flag reset if not
31934 SCF Signal: not ready to advance in the command list yet
31935 LD L,11 Fill in the new walkabout destination (either the origin or some location within 7 spaces to the left of the origin)
31937 LD (HL),A
31938 LD BC,25581 Return with BC holding the address of the routine at 25581
31941 RET
The time hasn't come or the event hasn't happened yet, so set the character off on another mini-jaunt.
31942 CALL 25233 A=random number
31945 AND 7 0<=A<=7
31947 SUB 7 -7<=A<=0
31949 ADD A,(HL) Add the x-coordinate of the walkabout origin to give the new walkabout destination
31950 JR 31934
Prev: 31905 Up: Map Next: 31952