![]() |
Routines |
| Prev: 9B79 | Up: Map | Next: 9BB9 |
|
Updates an entity of the type 0A which is made from the first kind of creature at CreatureTemplates. Roughly once in every 20 frames it flips bits of field 1D and once in every 40 frames it chooses a new direction towards the player.
|
||||||||
| UpdateFoamEntity | 9B89 | LD A,($5F9B) | Fetch the random number from 5F9B. | |||||
| 9B8C | AND %00011111 | Use bits 0-4. | ||||||
| 9B8E | JR NZ,UpdateFoamEntity_Test | Jump to UpdateFoamEntity_Test unless they are all zero. | ||||||
| 9B90 | LD A,(IX+$1D) | Read field 1D of the entity. | ||||||
| 9B93 | XOR %11000100 | Flip bits 2, 6 and 7. | ||||||
| 9B95 | LD (IX+$1D),A | Store it in field 1D of the entity. | ||||||
| UpdateFoamEntity_Test | 9B98 | CALL TestEntityRemoval | Call TestEntityRemoval to test whether the entity should be removed. | |||||
| 9B9B | CALL IncreaseEntityCounter | Call IncreaseEntityCounter. | ||||||
| 9B9E | BIT 7,(IX+$23) | Test bit 7 of field 23 of the entity. | ||||||
| 9BA2 | CALL NZ,ResetEntityMovement | Call ResetEntityMovement if it is set. | ||||||
| 9BA5 | LD A,($5F9A) | Fetch the low byte of the seed from RandomNumber_Seed. | ||||||
| 9BA8 | AND %00111111 | Use bits 0-5. | ||||||
| 9BAA | CALL Z,FacePlayer | Call FacePlayer to choose the direction towards the player if they are all zero. | ||||||
| 9BAD | LD B,$01 | Set the size of the step to 01. | ||||||
| 9BAF | CALL TurnEntity | Call TurnEntity to turn the entity towards the wanted heading. | ||||||
| 9BB2 | SET 7,(IX+$11) | Set bit 7 of the heading of the entity. | ||||||
| 9BB6 | JP UpdateEntity_Move | Jump to UpdateEntity_Move to carry on updating the entity. | ||||||
| Prev: 9B79 | Up: Map | Next: 9BB9 |