| Routines

29052: Make a character open or close a door

Used by command lists 22, 24, 26, 28, 76 and 78. This routine works on two parameters. First the door identifier:
ID | Door | Command lists
--- | --- | ---
8 | Boys' skool door | 76, 78
16 | Skool gate | 76, 78
32 | Drinks cabinet door | 22, 24, 26, 28
And then the action identifier:
0 | Close it
1 | Open it
Input
H | 204 (MISS TAKE) or 205 (ALBERT)
29052 | LD L,3 | Replace the address of this routine in bytes 3 and 4 of the character's buffer with 29061 (below)
29054 | LD (HL),133
29056 | LD L,19 | Copy the door identifier and open/close parameter from the command list into bytes 19 and 20 of the character's buffer
29058 | CALL 25188
29061 | LD L,19 |
29063 | LD A,(HL) | A=door identifier
29064 | CP 8 | Is it the boys' skool door?
29066 | JR NZ,29101 | Jump if not
29068 | LD A,(54017) | A=x-coordinate of the bike
29071 | CP 94 | Is the bike in the boys' skool?
29073 | JR C,29087 | Jump if so
29075 | LD DE,4448 | (E,D)=(96,17)
This entry point is used by the routine at 29101 with (E,D)=(136,17):
29078 | CP E | Set the carry flag if the bike is blocking the way
29079 | LD A,(54016) | A=bike's animatory state
29082 | CALL C,26496 | Move the bike to the location in DE if it's blocking the boys' skool door or the skool gate
29085 | LD H,205 | 205=ALBERT
This entry point is used by the routine at 29101.
29087 | LD L,4 | Remove the address of this routine from bytes 3 and 4 of the character's buffer
29089 | LD (HL),0
29091 | JP 28840 | Open or close the door