![]() |
Routines |
| Prev: 52868 | Up: Map | Next: 53040 |
|
Updates each of the entities that are not the player, or all of them if the player is not of type 1. An entity that is of type 12 or 16 is always kept. Any other entity is checked every eighth frame and is removed if it is a long way out of view. The entity is animated with AnimateEntity and then the routine for its type is run, using the table at EntityHandlers.
|
||||
| UpdateEntities | 52962 | LD IX,46438 | Point IX at the entity after the player. | |
| 52966 | LD B,11 | Set the number of entities to 11 leaving out the player. | ||
| 52968 | LD A,(46400) | Fetch the type of the player. | ||
| 52971 | DEC A | Compare it with the player type, 1. | ||
| 52972 | JR Z,UpdateEntities_Loop | Jump to UpdateEntities_Loop if the player is still a player. | ||
| 52974 | LD IX,46400 | Point IX at Entities. | ||
| 52978 | INC B | Include the player in the count. | ||
|
This entry point is used by the routine at UpdateNextEntity.
|
||||
| UpdateEntities_Loop | 52979 | PUSH BC | Save the entity count. | |
| 52980 | LD A,(IX+0) | Fetch the type of the entity. | ||
| 52983 | AND A | Test it. | ||
| 52984 | JR Z,UpdateNextEntity | Jump to UpdateNextEntity if the entity is not in use. | ||
| 52986 | PUSH AF | Save the type. | ||
| 52987 | CP 12 | Jump to UpdateEntities_Animate if the entity is a disc. | ||
| 52989 | JR Z,UpdateEntities_Animate | |||
| 52991 | CP 16 | Jump to UpdateEntities_Animate if the entity is a spider. | ||
| 52993 | JR Z,UpdateEntities_Animate | |||
| 52995 | LD A,(41693) | Fetch the frame counter. | ||
| 52998 | AND %00000111 | Keep the low three bits. | ||
| 53000 | JR NZ,UpdateEntities_Animate | Jump to UpdateEntities_Animate unless this is every eighth frame. | ||
| 53002 | LD BC,32 | Set the margin to 32. | ||
| 53005 | CALL TestEntityVisible | Test whether the entity is within the view. | ||
| 53008 | JR NZ,UpdateEntities_Animate | Jump to UpdateEntities_Animate if it is within the view. | ||
| 53010 | SET 7,(IX+1) | Hide the entity. | ||
| 53014 | LD (IX+0),0 | Remove the entity. | ||
| 53018 | POP AF | Restore the type. | ||
| 53019 | JR UpdateNextEntity | Jump to the next entity. | ||
| UpdateEntities_Animate | 53021 | CALL AnimateEntity | Animate the entity. | |
| 53024 | POP AF | Jump to the update routine for the type of the entity. | ||
| 53025 | PUSH IX | |||
| 53027 | ADD A,A | |||
| 53028 | LD C,A | |||
| 53029 | LD B,0 | |||
| 53031 | LD HL,39227 | |||
| 53034 | ADD HL,BC | |||
| 53035 | LD A,(HL) | |||
| 53036 | INC HL | |||
| 53037 | LD H,(HL) | |||
| 53038 | LD L,A | |||
| 53039 | JP (HL) | |||
| Prev: 52868 | Up: Map | Next: 53040 |