![]() |
Routines |
| Prev: 9BB9 | Up: Map | Next: 9C78 |
|
Updates an entity of the type 0B which is made from the second kind of creature at CreatureTemplates. Field 23 is a countdown which is set from the random number when the entity is stopped.
|
||||||||
| UpdateBatEntity | 9C1A | CALL TestEntityRemoval | Call TestEntityRemoval to test whether the entity should be removed. | |||||
| 9C1D | CALL IncreaseEntityCounter | Call IncreaseEntityCounter. | ||||||
| 9C20 | BIT 7,(IX+$23) | Test bit 7 of field 23 of the entity. | ||||||
| 9C24 | CALL NZ,ResetEntityMovement | Call ResetEntityMovement if it is set. | ||||||
| 9C27 | BIT 7,(IX+$1E) | Jump to UpdateEntity_Move to carry on updating the entity if bit 7 of the flags is not set. | ||||||
| 9C2B | JP Z,UpdateEntity_Move | |||||||
| 9C2E | LD (IX+$01),$01 | Set the frame of the entity to 01. | ||||||
| 9C32 | LD (IX+$10),$00 | Set the speed to 00. | ||||||
| 9C36 | LD (IX+$11),$00 | Set the heading of the entity to 00. | ||||||
| 9C3A | LD A,(IX+$23) | Read field 23 of the entity. | ||||||
| 9C3D | AND A | Test it. | ||||||
| 9C3E | JR Z,UpdateBatEntity_Delay | Jump to UpdateBatEntity_Delay if it is zero. | ||||||
| 9C40 | DEC A | Decrease the countdown by one. | ||||||
| 9C41 | LD (IX+$23),A | Store it in field 23 of the entity. | ||||||
| 9C44 | JP NZ,UpdateEntity_Move | Jump to UpdateEntity_Move to carry on updating the entity unless it is zero. | ||||||
| 9C47 | CALL FacePlayer | Call FacePlayer to choose the direction towards the player. | ||||||
| 9C4A | LD A,(IX+$20) | Read field 20 of the entity. | ||||||
| 9C4D | OR %10000000 | Set bit 7. | ||||||
| 9C4F | LD (IX+$11),A | Set the heading. | ||||||
| 9C52 | LD A,($5F9B) | Fetch the random number from 5F9B and keep it in B. | ||||||
| 9C55 | LD B,A | |||||||
| 9C56 | AND %00010000 | Keep bit 4. | ||||||
| 9C58 | ADD A,$10 | Add 10. | ||||||
| 9C5A | LD (IX+$10),A | Set the speed. | ||||||
| 9C5D | LD A,B | Fetch the random number. | ||||||
| 9C5E | AND %00000011 | Use bits 0-1. | ||||||
| 9C60 | ADD A,$03 | Add 03. | ||||||
| 9C62 | LD (IX+$12),A | Store it in field 12 of the entity. | ||||||
| 9C65 | LD (IX+$13),$00 | Set field 13 of the entity to 00. | ||||||
| 9C69 | JP UpdateEntity_Move | Jump to UpdateEntity_Move to carry on updating the entity. | ||||||
| UpdateBatEntity_Delay | 9C6C | LD A,($5F9B) | Fetch the random number from 5F9B. | |||||
| 9C6F | AND %00011110 | Use bits 1-4. | ||||||
| 9C71 | INC A | Add one. | ||||||
| 9C72 | LD (IX+$23),A | Store it as the countdown in field 23 of the entity. | ||||||
| 9C75 | JP UpdateEntity_Move | Jump to UpdateEntity_Move to carry on updating the entity. | ||||||
| Prev: 9BB9 | Up: Map | Next: 9C78 |