Prev: AAA1 Up: Map Next: AB61
AB1F: 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 AB1F LD A,(IX+$09) Fetch the speed along the x axis.
AB22 AND A Jump to FaceDirectionOfTravel_SizeOfSpeedX if it is not negative.
AB23 JP P,FaceDirectionOfTravel_SizeOfSpeedX
AB26 NEG Make it positive.
FaceDirectionOfTravel_SizeOfSpeedX AB28 LD C,A Keep the size of the x speed in C.
AB29 LD A,(IX+$0A) Fetch the speed along the y axis.
AB2C AND A Jump to FaceDirectionOfTravel_CompareSpeeds if it is not negative.
AB2D JP P,FaceDirectionOfTravel_CompareSpeeds
AB30 NEG Make it positive.
FaceDirectionOfTravel_CompareSpeeds AB32 CP C Compare it with the size of the x speed.
AB33 JR C,FaceDirectionOfTravel_CheckSpeedY Jump to FaceDirectionOfTravel_CheckSpeedY if the y speed is smaller.
Face along the x axis.
AB35 LD A,(IX+$09) Fetch the speed along the x axis.
AB38 AND A Jump to FaceDirectionOfTravel_FaceForwards if it is not negative.
AB39 JP P,FaceDirectionOfTravel_FaceForwards
AB3C RES 1,(IX+$00) Reset bit 1 of the sprite number.
FaceDirectionOfTravel_Unflip AB40 RES 6,(IX+$07) Reset bit 6 of the flags.
AB44 RET Return.
FaceDirectionOfTravel_FaceForwards AB45 SET 1,(IX+$00) Set bit 1 of the sprite number.
AB49 JR FaceDirectionOfTravel_Unflip Jump to FaceDirectionOfTravel_Unflip.
Face along the y axis.
FaceDirectionOfTravel_CheckSpeedY AB4B LD A,(IX+$0A) Fetch the speed along the y axis.
AB4E AND A Jump to FaceDirectionOfTravel_FaceBackwards if it is not negative.
AB4F JP P,FaceDirectionOfTravel_FaceBackwards
AB52 SET 1,(IX+$00) Set bit 1 of the sprite number.
FaceDirectionOfTravel_Flip AB56 SET 6,(IX+$07) Set bit 6 of the flags.
AB5A RET Return.
FaceDirectionOfTravel_FaceBackwards AB5B RES 1,(IX+$00) Reset bit 1 of the sprite number.
AB5F JR FaceDirectionOfTravel_Flip Jump to FaceDirectionOfTravel_Flip.
Prev: AAA1 Up: Map Next: AB61