![]() |
Routines |
| Prev: 979F | Up: Map | Next: 9820 |
|
Used by the routine at UpdateSpawnPoints.
Makes an entity from a spawn point, provided that the random number is odd. When it is created the spawn point is made to wait for 07 frames before it may create another entity. The entity which is made depends on its type: the code for types 00 08 and 0E is different.
|
||||||||||
| CreateSpawnedEntity | 97AE | CALL GetRandomNumber | Call GetRandomNumber to get a random number. | |||||||
| 97B1 | LD A,($5F9A) | Fetch the low byte of the seed. | ||||||||
| 97B4 | AND %00000001 | Keep only bit 0. | ||||||||
| 97B6 | JP Z,UpdateSpawnPoints_Next | Jump to UpdateSpawnPoints_Next if it is zero, to leave this spawn point for now. | ||||||||
| 97B9 | CALL ClearEntity | Call ClearEntity to clear the entity. | ||||||||
| 97BC | LD A,(IY+$03) | Fetch the type from the kind. | ||||||||
| 97BF | LD (IX+$00),A | Set the type of the entity. | ||||||||
| 97C2 | LD A,(IY+$04) | Fetch the first size from the kind. | ||||||||
| 97C5 | LD (IX+$0B),A | Set the x extent. | ||||||||
| 97C8 | LD A,(IY+$05) | Fetch the second size from the kind. | ||||||||
| 97CB | LD (IX+$0C),A | Set the y extent. | ||||||||
| 97CE | LD A,(IY+$06) | Fetch the third size from the kind. | ||||||||
| 97D1 | LD (IX+$0D),A | Set the z extent. | ||||||||
| 97D4 | POP IY | Restore the address of the spawn point from the stack. | ||||||||
| 97D6 | LD (IY+$05),$07 | Set the delay of the spawn point to 07. | ||||||||
| 97DA | LD A,(IY+$00) | Fetch the first byte of the position from the spawn point. | ||||||||
| 97DD | LD (IX+$03),A | Set the low byte of the x coordinate. | ||||||||
| 97E0 | LD A,(IY+$01) | Fetch the second byte of the position from the spawn point. | ||||||||
| 97E3 | LD (IX+$02),A | Set the high byte of the x coordinate. | ||||||||
| 97E6 | LD A,(IY+$02) | Fetch the third byte of the position from the spawn point. | ||||||||
| 97E9 | LD (IX+$06),A | Set the low byte of the y coordinate. | ||||||||
| 97EC | LD A,(IY+$03) | Fetch the fourth byte of the position from the spawn point. | ||||||||
| 97EF | LD (IX+$05),A | Set the high byte of the y coordinate. | ||||||||
| 97F2 | LD A,(IY+$04) | Fetch the fifth byte of the position from the spawn point. | ||||||||
| 97F5 | LD (IX+$09),A | Set the middle byte of the z coordinate. | ||||||||
| 97F8 | LD (IX+$08),$01 | Set the top byte of the z coordinate to 01. | ||||||||
| 97FC | LD A,(IX+$00) | Fetch the type of the entity. | ||||||||
| 97FF | AND A | Test it. | ||||||||
| 9800 | JR Z,CreateSpawnedEntity_Creature | Jump to CreateSpawnedEntity_Creature if the type is 00. | ||||||||
| 9802 | CP $08 | Jump to CreateSpawnedEntity_GrowingBubble if the type is 08. | ||||||||
| 9804 | JR Z,CreateSpawnedEntity_GrowingBubble | |||||||||
| 9806 | CP $0E | Jump to CreateShot if the type is 0E. | ||||||||
| 9808 | JR Z,CreateShot | |||||||||
| 980A | LD (IX+$23),$00 | Set field 23 of the entity to 00. | ||||||||
| 980E | LD (IX+$1C),$04 | Set field 1C of the entity to 04. | ||||||||
| 9812 | LD (IX+$1D),$10 | Set field 1D of the entity to 10. | ||||||||
| 9816 | CALL SetEntitySize | Call SetEntitySize to set the sprite of the entity. | ||||||||
| 9819 | SET 4,(IX+$16) | Set bit 4 of field 16 of the entity. | ||||||||
| 981D | JP UpdateSpawnPoints_Advance | Jump to UpdateSpawnPoints_Advance to go on to the next spawn point. | ||||||||
| Prev: 979F | Up: Map | Next: 9820 |