Routines |
Prev: 63D2 | Up: Map | Next: 6438 |
The address of this interruptible subcommand routine is placed into bytes 0x09 and 0x0A of the character's buffer by the routines at 6464, 6D00, 7CAB and F100. It is used to make a character go straight to a destination (or intermediate destination) that is reachable without negotiating any staircases.
|
||||||||
63ED | LD L,$0C | Point HL at byte 0x0C of the character's buffer | ||||||
63EF | LD (HL),$08 | Initialise this to 8 | ||||||
Byte 0x0C is used to count the number of paces the character has taken while under the control of this routine. It is decremented on each pass (at 6412 below). If it reaches 0, the address of this routine is removed from bytes 0x09 and 0x0A of the character's buffer. This has the effect of allowing the character-moving routine at 62D0 the chance to check whether a command list restart (bit 0 of byte 0x1D set) has been requested in the meantime. This ensures that the character does not proceed all the way to the (intermediate) destination before responding to some important event, such as the start of a new lesson (important for every character), ERIC playing truant (important for MR WACKER), or ERIC being present in the girls' skool when it's not playtime (important for MISS TAKE). If no command list restart has been requested in the meantime, the address of this routine will be placed into bytes 0x09 and 0x0A of the character's buffer again by the routine at 6464, and the character will continue towards his destination.
|
||||||||
63F1 | NOP | |||||||
63F2 | NOP | |||||||
63F3 | LD L,$09 | Replace the address of this routine in bytes 0x09 and 0x0A of the character's buffer with 63F7 (below) | ||||||
63F5 | LD (HL),$F7 | |||||||
The second and subsequent calls to this routine (from 62D0) enter here:
|
||||||||
63F7 | LD L,$00 | Point HL at byte 0x00 of the character's buffer | ||||||
63F9 | BIT 0,(HL) | Is the character midstride? | ||||||
63FB | JR Z,$6412 | Jump if not | ||||||
63FD | CALL $61B4 | Update the SRB for the character's current animatory state and location | ||||||
6400 | INC E | E=1 + character's x-coordinate | ||||||
6401 | BIT 7,A | A=character's animatory state | ||||||
6403 | JR NZ,$6407 | Jump if the character is facing right | ||||||
6405 | DEC E | |||||||
6406 | DEC E | E=character's x-coordinate - 1 | ||||||
6407 | AND $FC | Set B to the base animatory state of the character by discarding bits 0 and 1 | ||||||
6409 | LD B,A | |||||||
640A | LD A,E | A=character's new x-coordinate (after finishing his stride) | ||||||
640B | AND $01 | A=0 if the x-coordinate is even, 2 if it's odd | ||||||
640D | ADD A,A | |||||||
640E | OR B | A=character's new animatory state (standing/walking phase 1 for even x-coordinates, phase 3 for odd) | ||||||
640F | JP $6130 | Update the character's animatory state and location and update the SRB | ||||||
The character is not midstride. If he hasn't reached his destination yet, make him put one foot forward (if he's facing the right way), or turn him round.
|
||||||||
6412 | LD L,$0C | Point HL at byte 0x0C of the character's buffer | ||||||
6414 | DEC (HL) | Is it time to give the character-moving routine at 62D0 a chance to check whether a command list restart has been requested? | ||||||
6415 | JP Z,$6390 | Terminate this interruptible subcommand if so | ||||||
6418 | DEC L | L=0x0B | ||||||
6419 | LD A,(HL) | A=character's destination x-coordinate | ||||||
641A | LD L,$01 | Byte 1 of the character's buffer holds his current x-coordinate | ||||||
641C | CP (HL) | Has the character reached his destination? | ||||||
641D | JP Z,$6390 | Terminate this interruptible subcommand if so | ||||||
This entry point is used by the routine at F939.
|
||||||||
6420 | DEC HL | Point HL at byte 0x00 of the character's buffer | ||||||
6421 | BIT 7,(HL) | Is the character facing left? | ||||||
6423 | JR Z,$642E | Jump if so | ||||||
6425 | JR C,$6430 | Jump if the character will have to turn round first | ||||||
This entry point is used by the routine at 644D.
|
||||||||
6427 | CALL $708E | Check for closed doors in the character's path | ||||||
642A | INC A | A=character's new (midstride) animatory state | ||||||
642B | JP $6130 | Update the character's animatory state and update the SRB | ||||||
This entry point is used by the routine at 6697.
|
||||||||
642E | JR C,$6427 | Jump if the character is facing the right way | ||||||
6430 | CALL $61B4 | Update the SRB for the character's current animatory state and location | ||||||
6433 | XOR $80 | Flip bit 7 of the character's animatory state, thus turning him round | ||||||
6435 | JP $6130 | Update the character's animatory state and update the SRB |
Prev: 63D2 | Up: Map | Next: 6438 |