Prev: 43681 Up: Map Next: 43873
43807: Face Direction Of Travel
Turns an object to face the direction it is moving in. Nothing in the game calls this routine.
Input
IX The address of the object
Compare the sizes of the two speeds.
FaceDirectionOfTravel 43807 LD A,(IX+9) Fetch the speed along the x axis.
43810 AND A Jump to FaceDirectionOfTravel_SizeOfSpeedX if it is not negative.
43811 JP P,FaceDirectionOfTravel_SizeOfSpeedX
43814 NEG Make it positive.
FaceDirectionOfTravel_SizeOfSpeedX 43816 LD C,A Keep the size of the x speed in C.
43817 LD A,(IX+10) Fetch the speed along the y axis.
43820 AND A Jump to FaceDirectionOfTravel_CompareSpeeds if it is not negative.
43821 JP P,FaceDirectionOfTravel_CompareSpeeds
43824 NEG Make it positive.
FaceDirectionOfTravel_CompareSpeeds 43826 CP C Compare it with the size of the x speed.
43827 JR C,FaceDirectionOfTravel_CheckSpeedY Jump to FaceDirectionOfTravel_CheckSpeedY if the y speed is smaller.
Face along the x axis.
43829 LD A,(IX+9) Fetch the speed along the x axis.
43832 AND A Jump to FaceDirectionOfTravel_FaceForwards if it is not negative.
43833 JP P,FaceDirectionOfTravel_FaceForwards
43836 RES 1,(IX+0) Reset bit 1 of the sprite number.
FaceDirectionOfTravel_Unflip 43840 RES 6,(IX+7) Reset bit 6 of the flags.
43844 RET Return.
FaceDirectionOfTravel_FaceForwards 43845 SET 1,(IX+0) Set bit 1 of the sprite number.
43849 JR FaceDirectionOfTravel_Unflip Jump to FaceDirectionOfTravel_Unflip.
Face along the y axis.
FaceDirectionOfTravel_CheckSpeedY 43851 LD A,(IX+10) Fetch the speed along the y axis.
43854 AND A Jump to FaceDirectionOfTravel_FaceBackwards if it is not negative.
43855 JP P,FaceDirectionOfTravel_FaceBackwards
43858 SET 1,(IX+0) Set bit 1 of the sprite number.
FaceDirectionOfTravel_Flip 43862 SET 6,(IX+7) Set bit 6 of the flags.
43866 RET Return.
FaceDirectionOfTravel_FaceBackwards 43867 RES 1,(IX+0) Reset bit 1 of the sprite number.
43871 JR FaceDirectionOfTravel_Flip Jump to FaceDirectionOfTravel_Flip.
Prev: 43681 Up: Map Next: 43873