![]() |
Routines |
| Prev: 53170 | Up: Map | Next: 53361 |
|
The handler of the object type 120, which makes a helper (the object type 90, run by RunHelper) when it has been hit by enough of the projectiles of the player. Nothing happens while there is a helper in the game already. Otherwise, a count at 20 of its record goes up by one for each frame that a projectile is touching it, and the helper is made when the count gets to 32.
The helper is made by copying the record of this object into a free object slot, and changing it. It starts in front of the object, rising. The type and room of the helper are also written to the last entry of the object store, ObjectStore_Helper, so that it is remembered when the player leaves the room.
|
||||||||
|
Count frames while a projectile is touching the object.
|
||||||||
| RunHelperSource | 53202 | CALL SetSpriteOffset_Minus16_Minus8 | Call SetSpriteOffset_Minus16_Minus8 to set the offsets of the sprite. | |||||
| 53205 | CALL ApplyGravityAndMove_Move | Call ApplyGravityAndMove_Move to move the object, without gravity. | ||||||
| 53208 | LD A,(42766) | Fetch the helper flag. | ||||||
| 53211 | AND A | Return if there is a helper already. | ||||||
| 53212 | RET NZ | |||||||
| 53213 | CALL TestProjectileHit | Call TestProjectileHit to find out if a projectile touches the object. | ||||||
| 53216 | RET NZ | Return if none does. | ||||||
| 53217 | INC (IX+20) | Add one to the count of frames in which a projectile has touched the object. | ||||||
| 53220 | LD A,(IX+20) | Return if the count is less than 32. | ||||||
| 53223 | CP 32 | |||||||
| 53225 | RET C | |||||||
| 53226 | LD (IX+20),0 | Set the count back to zero. | ||||||
|
Return if a helper already exists.
|
||||||||
| 53230 | CALL PointAtObjects | Call PointAtObjects to point IY at the first ordinary object. | ||||||
| 53233 | LD A,90 | Set the type to look for to that of the helper. | ||||||
| RunHelperSource_Test | 53235 | CP (IY+0) | Return if the object is a helper. | |||||
| 53238 | RET Z | |||||||
| 53239 | ADD IY,DE | Move on to the next object, and jump to RunHelperSource_Test until all have been tested. | ||||||
| 53241 | DJNZ RunHelperSource_Test | |||||||
| 53243 | CALL PointAtObjects | Call PointAtObjects to point IY at the first ordinary object again. | ||||||
| 53246 | XOR A | Set the type to look for to zero, which is a free object. | ||||||
| RunHelperSource_Free | 53247 | CP (IY+0) | Jump to RunHelperSource_Make if the object is free. | |||||
| 53250 | JR Z,RunHelperSource_Make | |||||||
| 53252 | ADD IY,DE | Move on to the next object, and jump to RunHelperSource_Free until all have been tested. | ||||||
| 53254 | DJNZ RunHelperSource_Free | |||||||
| 53256 | RET | Return, as there is no room for a helper. | ||||||
|
Copy this object into a free slot and make the helper.
|
||||||||
| RunHelperSource_Make | 53257 | PUSH IX | Point HL at this object (using the stack). | |||||
| 53259 | POP HL | |||||||
| 53260 | PUSH IY | Point DE at the free object (using the stack). | ||||||
| 53262 | POP DE | |||||||
| 53263 | LD BC,32 | Set the number of bytes to copy, which is the size of an object. | ||||||
| 53266 | LDIR | Copy this object into the free object. | ||||||
| 53268 | LD (IY+0),90 | Set the type of the new object to 90. | ||||||
| 53272 | LD (IY+3),141 | Set the z position of the helper. | ||||||
| 53276 | LD A,8 | Set A to 8, for the half sizes along x and y. | ||||||
| 53278 | LD (IY+4),A | Set the half size along x. | ||||||
| 53281 | LD (IY+5),A | Set the half size along y. | ||||||
| 53284 | LD (IY+6),12 | Set the size along z. | ||||||
| 53288 | LD (IY+7),20 | Set the flags, which are for an object that can be pushed. | ||||||
| 53292 | LD (IY+11),1 | Set the speed along z to 1, which makes the helper rise. | ||||||
| 53296 | LD DE,54594 | Take the entry of the object store for the helper, ObjectStore_Helper. | ||||||
| 53299 | LD (IY+16),E | Write the low byte of the address as the pointer to the store. | ||||||
| 53302 | LD (IY+17),D | Write the high byte. | ||||||
| 53305 | LD A,(IX+1) | Put the x position of the helper at that of this object. | ||||||
| 53308 | LD (IY+1),A | |||||||
| 53311 | LD A,(IX+2) | Put the y position of the helper 8 further along than that of this object. | ||||||
| 53314 | ADD A,8 | |||||||
| 53316 | LD (IY+2),A | |||||||
| 53319 | LD A,1 | Set the helper flag. | ||||||
| 53321 | LD (42766),A | |||||||
| 53324 | PUSH IX | Save the object and make IX the helper. | ||||||
| 53326 | PUSH IY | |||||||
| 53328 | POP IX | |||||||
| 53330 | CALL SetSpriteOffset_Minus16_Minus8 | Call SetSpriteOffset_Minus16_Minus8 to set the offsets of the sprite. | ||||||
| 53333 | CALL CalculatePixelCoordinates | Call CalculatePixelCoordinates to work out where it is on the screen. | ||||||
| 53336 | CALL ApplyGravityAndMove | Call ApplyGravityAndMove to apply gravity to it and move it. | ||||||
| 53339 | CALL SetWipeAndDrawFlags | Call SetWipeAndDrawFlags to flag it as moved. | ||||||
| 53342 | POP IX | Get the object back. | ||||||
| 53344 | LD IY,54594 | Take the entry of the object store for the helper. | ||||||
| 53348 | LD (IY+0),90 | Set the type of the entry. | ||||||
| 53352 | LD A,(IX+8) | Set the room of the entry to the room of the object. | ||||||
| 53355 | LD (IY+8),A | |||||||
| 53358 | JP SetWipeAndDrawFlags | Jump to SetWipeAndDrawFlags to flag the object as moved. | ||||||
| Prev: 53170 | Up: Map | Next: 53361 |