![]() |
Routines |
| Prev: 91F2 | Up: Map | Next: 9244 |
|
Used by the routines at DOOR_LOCKED_A and DOOR_LOCKED_B.
The coloured doors. Each carries its colour in the low two bits of its own sprite, which index four attribute bytes at DOOR_COLOURS, and the door opens only if the player is carrying a key -- sprite $81 -- of that same colour.
So the lock is not a flag anywhere. The door's colour is part of its sprite number, the key's colour is the drawing mode stored with it when it was picked up, and opening the door is a comparison of the two.
|
||||||||||
| DOOR_NEEDS_KEY | 9222 | LD A,(IX+$00) | The low two bits of the sprite are the colour. | |||||||
| 9225 | AND $03 | |||||||||
| 9227 | LD HL,DOOR_COLOURS | Look it up. | ||||||||
| 922A | CALL ADD_A_TO_HL | |||||||||
| 922D | LD D,(HL) | $81 is a key; D is the colour it has to be. | ||||||||
| 922E | LD E,$81 | |||||||||
| 9230 | CALL FIND_CARRIED | Not carrying it: the door stays shut. | ||||||||
| 9233 | JP NZ,DOOR_NEEDS_KEY_0 | |||||||||
| 9236 | CALL OPEN_DOOR | Carrying it: behave as an ordinary doorway from here on. | ||||||||
| 9239 | LD BC,$1111 | |||||||||
| 923C | JP PLAYER_AT_DOOR | |||||||||
| DOOR_NEEDS_KEY_0 | 923F | CALL SHUT_DOOR | Draw it shut and report no. | |||||||
| 9242 | AND A | |||||||||
| 9243 | RET | |||||||||
| Prev: 91F2 | Up: Map | Next: 9244 |