Prev: A8F5 Up: Map Next: A951
A922: 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+02 is reset. Otherwise, if IX+02 is zero, it is set to 01 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 A922 LD A,($9703) Fetch the room of the player from 9703.
A925 AND %11110000 Keep only bits 4-7.
A927 LD C,A Stash the row of the player in C.
A928 LD A,(IX+$01) Fetch the room of the Wulf.
A92B AND %11110000 Keep only bits 4-7.
A92D CP C Jump to ChooseWulfDirection_SameRow if the Wulf is in the same row as the player.
A92E JR Z,ChooseWulfDirection_SameRow
A930 LD (IX+$02),$00 Clear the direction chosen flag of the Wulf.
A934 RET Return.
ChooseWulfDirection_SameRow A935 LD A,(IX+$02) Fetch the direction chosen flag of the Wulf.
A938 AND A Return if the direction has already been chosen.
A939 RET NZ
A93A LD (IX+$02),$01 Set the direction chosen flag of the Wulf.
A93E LD A,($9703) Fetch the room of the player from 9703.
A941 CP (IX+$01) Jump to CompareWulfPosition if the Wulf is in the same room as the player.
A944 JR Z,CompareWulfPosition
A946 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 A948 LD (IX+$06),$C0 Set the X velocity of the Wulf to C0 (moving left).
A94C RES 2,(IX+$00) Reset bit 2 of the sprite ID so that the Wulf faces left.
A950 RET Return.
Prev: A8F5 Up: Map Next: A951