![]() |
Routines |
| Prev: 90FB | Up: Map | Next: 915F |
|
Takes the door record in IX, copies its destination into the player's room and position, and then rebuilds the screen: mark the room seen, blank the play area, draw the new room, recolour the panel.
The arrival position is not stored outright. +$02 packs both offsets into one byte, unpacked by rotating it in opposite directions and masking to $1E -- an even number 0 to 30 each way, the vertical one negated. Every door checked holds $34, which comes out as 8 to the right and 6 up, so the player lands just inside the room rather than on top of the doorway they arrived through.
Confirmed by setting IX to four different door records and running from ENTER_ROOM+3, past its first call: doors to rooms $07, $19, $01 and $00 produced exactly the destination and the offset position predicted from their bytes.
|
||||||||
| ENTER_ROOM | 9117 | CALL DOOR_OTHER_SIDE | Swap to the door's other side. The record the player touched describes this room; the one eight bytes away describes where they come out. That reassignment of IX is also why anything testing this routine has to enter below it. | |||||
| 911A | LD A,(IX+$01) | +$01 is the destination room. | ||||||
| 911D | LD ($EA91),A | |||||||
| 9120 | LD A,(IX+$02) | Rotate left and mask: the horizontal offset, added to the door's own x. | ||||||
| 9123 | RLCA | |||||||
| 9124 | AND $1E | |||||||
| 9126 | ADD A,(IX+$03) | |||||||
| 9129 | LD ($EA93),A | |||||||
| 912C | LD A,(IX+$02) | Rotate right three times for the vertical one, which is subtracted rather than added. | ||||||
| 912F | RRCA | |||||||
| 9130 | RRCA | |||||||
| 9131 | RRCA | |||||||
| 9132 | AND $1E | |||||||
| 9134 | NEG | |||||||
| 9136 | ADD A,(IX+$04) | |||||||
| 9139 | LD ($EA94),A | |||||||
| 913C | CALL SET_ARRIVAL_HEADING | Head the player into the room, away from the wall this door is in; with the nibble set below, STEER keeps them walking that way for fifteen frames. | ||||||
| 913F | LD A,($EA92) | Set the flag that stops PLAYER_AT_DOOR firing again on the way out. | ||||||
| 9142 | OR $0F | |||||||
| 9144 | LD ($EA92),A | |||||||
|
This entry point is used by the routine at START_GAME.
|
||||||||
| ARRIVE_IN_ROOM | 9147 | LD A,($EA91) | Record the new room as seen. | |||||
| 914A | CALL MARK_ROOM_VISITED | |||||||
| 914D | CALL CLEAR_PLAY_AREA | Blank the play area, draw the new room, colour the panel to match. | ||||||
| 9150 | CALL DRAW_ROOM | |||||||
| 9153 | CALL PAINT_PANEL | |||||||
| 9156 | CALL DRAW_INVENTORY | |||||||
| 9159 | CALL PLAY_SOUND_NEW_ROOM | |||||||
| 915C | JP MAIN_LOOP | |||||||
|
Each door is one sixteen-byte record whose two eight-byte halves are in the two rooms it joins (+$00 type, +$01 the room this half is in, +$02 the packed arrival offset, +$03 and +$04 the doorway's corner, +$05 orientation and flags, +$06 and +$07 its walk box). The doors tested are the ones in the player's room's list, dispatched by DISPATCH_FROM_LIST.
|
||||||||
| Prev: 90FB | Up: Map | Next: 915F |