Prev: 39123 Up: Map Next: 39204
39180: Turn Entity
Used by the routines at UpdateFoamEntity and UpdateSaucerEntity.
Turns an entity by a step towards the heading in field 32 by changing bits 1-5 of the current heading in field 17.
Input
B The size of the step
IX The entity
TurnEntity 39180 LD A,(IX+17) Fetch the current heading of the entity.
39183 AND %00111110 Use bits 1-5.
39185 LD L,A Copy it into L.
39186 SUB (IX+32) Subtract the wanted heading of the entity.
39189 RET Z Return if the entity is already heading that way.
39190 BIT 5,A Test bit 5 of the difference.
39192 LD A,B Fetch the size of the step.
39193 JR NZ,TurnEntity_Apply Jump to TurnEntity_Apply if the step is to be added.
39195 NEG Negate the step.
TurnEntity_Apply 39197 ADD A,L Add the step to the current heading.
39198 AND %00111110 Use bits 1-5.
39200 LD (IX+17),A Store the new heading of the entity.
39203 RET Return.
Prev: 39123 Up: Map Next: 39204