Prev: 43253 Up: Map Next: 43345
43298: Choose Wulf Direction
Used by the routine at HandlerWulf.
Sets the direction of the Wulf. If the Wulf is not in the same row of rooms as the player then nothing happens, except that IX+2 is reset. Otherwise, if IX+2 is zero, it is set to 1 and the Wulf is sent to the left or the right depending on whether the player is in a room to its left or right. If they are in the same room then the X positions are used instead (see CompareWulfPosition).
Input
IX Actor record of the Wulf
ChooseWulfDirection 43298 LD A,(38659) Fetch the room of the player from 38659.
43301 AND %11110000 Keep only bits 4-7.
43303 LD C,A Stash the row of the player in C.
43304 LD A,(IX+1) Fetch the room of the Wulf.
43307 AND %11110000 Keep only bits 4-7.
43309 CP C Jump to ChooseWulfDirection_SameRow if the Wulf is in the same row as the player.
43310 JR Z,ChooseWulfDirection_SameRow
43312 LD (IX+2),0 Clear the direction chosen flag of the Wulf.
43316 RET Return.
ChooseWulfDirection_SameRow 43317 LD A,(IX+2) Fetch the direction chosen flag of the Wulf.
43320 AND A Return if the direction has already been chosen.
43321 RET NZ
43322 LD (IX+2),1 Set the direction chosen flag of the Wulf.
43326 LD A,(38659) Fetch the room of the player from 38659.
43329 CP (IX+1) Jump to CompareWulfPosition if the Wulf is in the same room as the player.
43332 JR Z,CompareWulfPosition
43334 JR NC,SendWulfRight Jump to SendWulfRight if the player is to the right of the Wulf.
This entry point is used by the routine at CompareWulfPosition.
ChooseWulfDirection_Left 43336 LD (IX+6),192 Set the X velocity of the Wulf to 192 (moving left).
43340 RES 2,(IX+0) Reset bit 2 of the sprite ID so that the Wulf faces left.
43344 RET Return.
Prev: 43253 Up: Map Next: 43345