![]() |
Routines |
| Prev: 34288 | Up: Map | Next: 34350 |
|
The handler for the sparkle (sprite IDs 88 to 91) that appears when a creature is created by SpawnCreature. The counter at offset 14 of the entity starts at 32 and the sprite is chosen from its bottom two bits to animate the sparkle. When the counter reaches zero the sparkle turns into the creature that is held at offset 2.
|
||||||||
| HandlerSparkle | 34295 | CALL StoreEntity | Call StoreEntity to save the position of the sparkle. | |||||
| 34298 | LD A,(60049) | Fetch the room of the player from PlayerRoom. | ||||||
| 34301 | CP (IX+1) | Jump to CountDownCreature if the sparkle is not in the same room as the player. | ||||||
| 34304 | JP NZ,CountDownCreature | |||||||
| 34307 | LD HL,24101 | Point HL at the number of creatures at NumCreatures. | ||||||
| 34310 | INC (HL) | Increment the number of creatures by one. | ||||||
| 34311 | DEC (IX+14) | Decrease the counter at offset 14 by one. | ||||||
| 34314 | JR Z,HandlerSparkle_Finish | Jump to HandlerSparkle_Finish if it has reached zero. | ||||||
| 34316 | LD A,(IX+14) | Fetch the counter. | ||||||
| 34319 | AND %00000011 | Keep only bits 0-1. | ||||||
| 34321 | ADD A,88 | Add 88 to get the sprite ID of the sparkle. | ||||||
| 34323 | LD (IX+0),A | Update the sprite ID of the sparkle. | ||||||
| 34326 | LD (IX+15),128 | Write 128 to the counter at offset 15. | ||||||
| 34330 | LD A,(60048) | Fetch the sprite ID of the player from Player. | ||||||
| 34333 | CP 49 | Jump to PopCreature if the player sprite ID is 49 or more. | ||||||
| 34335 | JP NC,PopCreature | |||||||
| 34338 | JP HandlerCharacter_Display | Jump to HandlerCharacter_Display to display the sparkle. | ||||||
|
The sparkle is finished, so it turns into the creature.
|
||||||||
| HandlerSparkle_Finish | 34341 | LD A,(IX+2) | Fetch the type of the creature from offset 2. | |||||
| 34344 | LD (IX+0),A | Update the sprite ID of the entity. | ||||||
| 34347 | JP HandlerCharacter_Display | Jump to HandlerCharacter_Display to display the sparkle. | ||||||
| Prev: 34288 | Up: Map | Next: 34350 |