Skool Daze Routines
25303: Make character move about until a certain time
Used by command lists 136, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 186, 188, 198, 200, 202, 206, 208, 210, 212, 214, 216, 218 and 222.
H Character number (152-169)
L 122
25303 LD A,(HL) Reset bits 5 and 6 of byte 122 of the character's buffer, indicating that he should no longer walk fast or slow continuously (if he was doing so)
25304 AND 159
25306 LD (HL),A
25307 CALL 24972 Collect the signal byte from the command list
25310 LD L,101 Place the signal byte in byte 101 of the character's buffer
25312 LD (HL),A
25313 LD L,99 Change the address in bytes 99 and 100 of the character's buffer from 25303 to 25317 (below)
25315 LD (HL),229
This entry point is used by the routines at 27442 and 27453.
25317 LD L,101 Collect the signal byte from byte 101 of the character's buffer
25319 LD A,(HL)
25320 CALL 25374 Has this signal been raised?
25323 JR Z,25356 Jump if not
The time has come to stop moving about. However, before we move on in the command list, the character needs to return to the walkabout origin.
25325 INC L Collect the x-coordinate of the walkabout origin from byte 102 of the character's buffer
25326 LD A,(HL)
25327 LD L,98 Byte 98 holds the character's x-coordinate
25329 CP (HL) Is the character at the walkabout origin?
25330 JR NZ,25339 Jump if not
25332 LD L,96 Byte 96 holds the character's animatory state
25334 BIT 0,(HL) Is the character midstride?
25336 JP Z,25256 Jump if not (time to move on in the command list)
25339 LD L,107 Set the character's next destination x-coordinate
25341 LD (HL),A
25342 INC L Initialise the counter at byte 108 to 30, which will give the character enough time to get to the destination
25343 LD (HL),30
25345 LD BC,25404 Place the address of the routine at 25404 (guide character to destination) into bytes 105 and 106 of the character's buffer
25348 LD L,105
25350 LD (HL),C
25351 INC L
25352 LD (HL),B
25353 INC L
25354 PUSH BC
25355 RET Make an indirect jump to 25404
The signal has not been raised yet, so it's time for another mini-walkabout.
25356 INC L Point HL at the x-coordinate of the walkabout origin
25357 CALL 24993 A=random number
25360 AND 7 -7<=A<=0
25362 SUB 7
25364 ADD A,(HL) Add the x-coordinate of the walkabout origin
25365 JR 25339 Make this the new walkabout destination