Prev: DDFC Up: Map Next: DE59
DE0D: Trim a two-way step at the walls, one axis at a time
Used by the routines at CREATURE_UPDATE, WANDERING_MONSTER and FIND_WANDER.
The clipping routines (MOVE_TABLE) handle a step along the facing only, so a wanderer's step, which can go both ways at once, is taken in two: the U part, facing +U or -U by its sign, with the V part set aside; then the V part, facing +V or -V, with the U part set aside. The facing ends as the V part's, if there is one. The second clip does not clear the wall flag, so it says whether either part met a wall.
Input
IX The record
MOVE_SPLIT DE0D LD A,(IX+$0A) Any U step?
DE10 AND A
DE11 JR Z,MOVE_SPLIT_1
DE13 LD A,$40 Face +U, or -U if it is negative
DE15 JP P,MOVE_SPLIT_0
DE18 OR $80
MOVE_SPLIT_0 DE1A LD C,A
DE1B LD A,(IX+$06)
DE1E AND $3F
DE20 OR C
DE21 LD (IX+$06),A
DE24 LD A,(IX+$0B) Trim the U step, with the V step put aside
DE27 PUSH AF
DE28 LD (IX+$0B),$00
DE2C CALL MOVE_CLIPPED
DE2F POP AF
DE30 LD (IX+$0B),A
MOVE_SPLIT_1 DE33 LD A,(IX+$0B) Any V step?
DE36 AND A
DE37 RET Z
DE38 LD A,$00 Face +V, or -V if it is negative
DE3A JP P,MOVE_SPLIT_2
DE3D OR $80
MOVE_SPLIT_2 DE3F LD C,A
DE40 LD A,(IX+$06)
DE43 AND $3F
DE45 OR C
DE46 LD (IX+$06),A
DE49 LD A,(IX+$0A) Trim the V step, with the U step put aside, keeping the wall flag
DE4C PUSH AF
DE4D LD (IX+$0A),$00
DE51 CALL MOVE_CLIPPED_AGAIN
DE54 POP AF
DE55 LD (IX+$0A),A
DE58 RET
Prev: DDFC Up: Map Next: DE59