![]() |
Routines |
Prev: 63281 | Up: Map |
|
|||||||||
63304 | LD L,11 | Copy the door identifier (168, 172, 173 or 179) and walkabout duration indicator (0 or 255) from the command list into bytes 11 and 12 of the character's buffer | |||||||
63306 | CALL 61809 | ||||||||
This entry point is used by the routine at 63520.
|
|||||||||
63309 | CALL 61823 | Get a random number between 32 and 63 in A | |||||||
63312 | AND 31 | ||||||||
63314 | ADD A,32 | ||||||||
63316 | LD L,13 | Store this number in byte 13 of the character's buffer; it is the number of mini-walkabouts the character will perform (if the walkabout duration indicator in byte 12 is 255) | |||||||
63318 | LD (HL),A | ||||||||
63319 | LD L,1 | Point HL at byte 1 of the character's buffer | |||||||
63321 | LD A,(HL) | A=character's x-coordinate | |||||||
63322 | LD L,10 | Copy this into byte 10 of the character's buffer (it will be the walkabout origin) | |||||||
63324 | LD (HL),A | ||||||||
63325 | CALL 63409 | Change the character's primary command routine address to 63328 (below) | |||||||
63328 | LD BC,63209 | Point BC at the interruptible subcommand routine address at 63209 | |||||||
63331 | LD L,11 | Collect the door identifier (168, 172, 173, 175 or 179) from byte 11 of the character's buffer | |||||||
63333 | LD E,(HL) | ||||||||
63334 | LD D,127 | Point HL at 32680 (always 0) or the door knock status flags for the door in question (see 32682) | |||||||
63336 | EX DE,HL | ||||||||
63337 | BIT 7,(HL) | Has somebody knocked at the door? | |||||||
63339 | JR Z,63349 | Jump if not | |||||||
63341 | LD A,192 | Reset bit 7 and set bit 6 of the door knock status flags to indicate that someone is going to answer the door | |||||||
63343 | XOR (HL) | ||||||||
63344 | LD (HL),A | ||||||||
63345 | EX DE,HL | Restore the character number to H | |||||||
63346 | JP 62080 | Move to the next command in the command list (which will send the character to the door) | |||||||
Either nobody has knocked on the door, or the character is not on door duty.
|
|||||||||
63349 | EX DE,HL | Restore the character number to H | |||||||
63350 | LD L,12 | Collect the walkabout duration indicator (0 or 255) from byte 12 of the character's buffer | |||||||
63352 | LD A,(HL) | ||||||||
63353 | INC L | L=13 | |||||||
63354 | ADD A,(HL) | Decrement the walkabout counter in byte 13 of the character's buffer, or leave it unchanged | |||||||
63355 | LD (HL),A | ||||||||
63356 | LD L,10 | Point HL at byte 10 of the character's buffer | |||||||
63358 | JR NZ,63373 | Jump unless the walkabout counter is now 0 | |||||||
The character has finished walking up and down. If the character is not on door duty, we move to the next command in the command list; if the character is on door duty, we move six bytes ahead in the command list (past the door-opening commands).
|
|||||||||
63360 | INC L | Collect the door identifier (168, 172, 173, 175 or 179) from byte 11 of the character's buffer | |||||||
63361 | LD A,(HL) | ||||||||
63362 | ADD A,87 | Set the carry flag if it's > 168 (meaning the character was on door duty) | |||||||
63364 | SBC A,A | A=6 if the character was on door duty, 0 otherwise | |||||||
63365 | AND 6 | ||||||||
63367 | LD L,22 | Add 0 or 6 to the character's command list offset (in byte 22 of his buffer) | |||||||
63369 | ADD A,(HL) | ||||||||
63370 | LD (HL),A | ||||||||
63371 | JR 63346 | Terminate this primary command | |||||||
It's time to set another walkabout destination for this character.
|
|||||||||
63373 | CALL 61823 | Get a random number in A | |||||||
63376 | OR 249 | A=-6, -4, -2 or 0 | |||||||
63378 | INC A | ||||||||
63379 | ADD A,(HL) | Add the walkabout origin x-coordinate | |||||||
63380 | LD L,16 | Store this x-coordinate in byte 16 of the character's buffer | |||||||
63382 | LD (HL),A | ||||||||
63383 | JP 63403 | Copy the interruptible subcommand routine address (31319 or 63209) from BC into bytes 14 and 15 of the character's buffer, and then jump to it |
Prev: 63281 | Up: Map |