Prev: 98D3 Up: Map Next: 9924
990C: Turn Entity
Used by the routines at UpdateFoamEntity and UpdateSaucerEntity.
Turns an entity by a step towards the heading in field 20 by changing bits 1-5 of the current heading in field 11.
Input
B The size of the step
IX The entity
TurnEntity 990C LD A,(IX+$11) Fetch the current heading of the entity.
990F AND %00111110 Use bits 1-5.
9911 LD L,A Copy it into L.
9912 SUB (IX+$20) Subtract the wanted heading of the entity.
9915 RET Z Return if the entity is already heading that way.
9916 BIT 5,A Test bit 5 of the difference.
9918 LD A,B Fetch the size of the step.
9919 JR NZ,TurnEntity_Apply Jump to TurnEntity_Apply if the step is to be added.
991B NEG Negate the step.
TurnEntity_Apply 991D ADD A,L Add the step to the current heading.
991E AND %00111110 Use bits 1-5.
9920 LD (IX+$11),A Store the new heading of the entity.
9923 RET Return.
Prev: 98D3 Up: Map Next: 9924