![]() |
Routines |
| Prev: B8CC | Up: Map | Next: B90D |
|
Used by the routine at ADJ_FOR_OUT_OF_BOUNDS.
Keeps the object's whole footprint within the room: its U, after the move, no further from 128 than the room's U half-size (the first byte of ROOM_EXTENT, 64 or 32) less its own half-size. dU is shortened a unit at a time, and bit 0 of +$0C set if it had to be (measured: an object with half-size 4 at 90 from the centre of a room of half-size 96, asked to move 5, moved 1).
Two things switch the walls off, as in Knight Lore: a count in the top four bits of +$0C, which the player's routine (PLAYER_LEGS) runs down by one a turn, and bit 0 of +$07, which HANDLE_EXIT_SCREEN sets on the player near a doorway. That is how he walks through one at all.
|
||||||||||||||
| ADJ_DU_FOR_OUT_OF_BOUNDS | B8E2 | LD A,(IX+$0C) | not while the count in +$0C runs | |||||||||||
| B8E5 | AND $F0 | |||||||||||||
| B8E7 | RET NZ | |||||||||||||
| B8E8 | BIT 0,(IX+$07) | not near a doorway | ||||||||||||
| B8EC | RET NZ | |||||||||||||
| B8ED | LD A,(ROOM_EXTENT) | B = the room's U half-size | ||||||||||||
| B8F0 | LD B,A | |||||||||||||
| CLIP_DU_TO_WALLS | B8F1 | LD A,(IX+$01) | A = |U + dU - 128| | |||||||||||
| B8F4 | ADD A,C | |||||||||||||
| B8F5 | SUB $80 | |||||||||||||
| B8F7 | JR NC,ADJ_DU_FOR_OUT_OF_BOUNDS_0 | |||||||||||||
| B8F9 | NEG | |||||||||||||
| ADJ_DU_FOR_OUT_OF_BOUNDS_0 | B8FB | ADD A,(IX+$04) | inside if that plus the half-size is less than the room's: done | |||||||||||
| B8FE | CP B | |||||||||||||
| B8FF | JR C,ADJ_DU_FOR_OUT_OF_BOUNDS_1 | |||||||||||||
| B901 | SET 0,(IX+$0C) | stopped in U | ||||||||||||
| B905 | LD A,C | a unit shorter, and again unless nothing is left | ||||||||||||
| B906 | CALL SHORTEN_DELTA | |||||||||||||
| B909 | LD C,A | |||||||||||||
| B90A | JR NZ,CLIP_DU_TO_WALLS | |||||||||||||
| ADJ_DU_FOR_OUT_OF_BOUNDS_1 | B90C | RET | ||||||||||||
| Prev: B8CC | Up: Map | Next: B90D |