![]() |
Routines |
Prev: 25554 | Up: Map | Next: 25656 |
H | Character number (183-214) |
25581 | LD L,12 | Point HL at byte 12 of the character's buffer |
25583 | LD (HL),8 | Initialise this to 8 |
Byte 12 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 25618 below). If it reaches 0, the address of this routine is removed from bytes 9 and 10 of the character's buffer. This has the effect of allowing the character-moving routine at 25296 the chance to check whether a command list restart (bit 0 of byte 29 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 9 and 10 of the character's buffer again by the routine at 25700, and the character will continue towards his destination.
|
||
25585 | NOP | |
25586 | NOP | |
25587 | LD L,9 | Replace the address of this routine in bytes 9 and 10 of the character's buffer with 25591 (below) |
25589 | LD (HL),247 | |
The second and subsequent calls to this routine (from 25296) enter here:
|
||
25591 | LD L,0 | Point HL at byte 0 of the character's buffer |
25593 | BIT 0,(HL) | Is the character midstride? |
25595 | JR Z,25618 | Jump if not |
25597 | CALL 25012 | Update SRB for the character's current animatory state and location |
25600 | INC E | E=1 + character's x-coordinate |
25601 | BIT 7,A | A=character's animatory state |
25603 | JR NZ,25607 | Jump if the character is facing right |
25605 | DEC E | |
25606 | DEC E | E=character's x-coordinate - 1 |
25607 | AND 252 | Set B to the base animatory state of the character by discarding bits 0 and 1 |
25609 | LD B,A | |
25610 | LD A,E | A=character's new x-coordinate (after finishing his stride) |
25611 | AND 1 | A=0 if the x-coordinate is even, 2 if it's odd |
25613 | ADD A,A | |
25614 | OR B | A=character's new animatory state (standing/walking phase 1 for even x-coordinates, phase 3 for odd) |
25615 | JP 24880 | Update SRB for the character's new animatory state and location |
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.
|
||
25618 | LD L,12 | Point HL at byte 12 of the character's buffer |
25620 | DEC (HL) | Is it time to give the character-moving routine at 25296 a chance to check whether a command list restart has been requested? |
25621 | JP Z,25488 | Blank out the address of this routine in bytes 9 and 10 of the character's buffer if so |
25624 | DEC L | L=11 |
25625 | LD A,(HL) | A=character's destination x-coordinate |
25626 | LD L,1 | Byte 1 of the character's buffer holds his current x-coordinate |
25628 | CP (HL) | Has the character reached his destination? |
25629 | JP Z,25488 | Blank out the address of this routine in bytes 9 and 10 of the character's buffer if so |
This entry point is used by the routine at 63801:
|
||
25632 | DEC HL | L=0 |
25633 | BIT 7,(HL) | Is the character facing left? |
25635 | JR Z,25646 | Jump if so |
25637 | JR C,25648 | Jump if character will have to turn round first |
This entry point is used by the routine at 25677:
|
||
25639 | CALL 28814 | Check for doors |
25642 | INC A | A=character's new (midstride) animatory state |
25643 | JP 24880 | Update SRB for the character's new animatory state |
This entry point is used by the routine at 26263:
|
||
25646 | JR C,25639 | Jump if the character is facing the right way |
25648 | CALL 25012 | Update SRB for the character's current animatory state and location |
25651 | XOR 128 | Flip bit 7 of the character's animatory state, thus turning him round |
25653 | JP 24880 | Update SRB for the character's new animatory state |
Prev: 25554 | Up: Map | Next: 25656 |