![]() |
Routines |
| Prev: 42274 | Up: Map | Next: 42361 |
|
Used by the routine at Handler_AlienBasePlasma.
If the next actor slot is free, write type 200 into it and copy a speed and thrust pair from Handler_PlayerShot_Table.
|
||||||||
|
Write type 200 into the next slot if it is free.
|
||||||||
| SpawnLinkedObject | 42298 | PUSH IX | Copy the slot pointer into HL (using the stack). | |||||
| 42300 | POP HL | |||||||
| 42301 | LD DE,24 | DE=0024. | ||||||
| 42304 | ADD HL,DE | Move onto the next slot. | ||||||
| 42305 | LD A,(HL) | Return if that slot is already in use. | ||||||
| 42306 | AND A | |||||||
| 42307 | RET NZ | |||||||
| 42308 | LD (HL),200 | Write type 200. | ||||||
| 42310 | INC HL | Move onto the new world X. | ||||||
| 42311 | INC HL | |||||||
| 42312 | EX DE,HL | Switch the destination into DE. | ||||||
|
Select a speed and thrust pair from Handler_PlayerShot_Table for the new slot.
|
||||||||
| 42313 | LD A,(24130) | Fetch GameTimer. | ||||||
| 42316 | LD C,A | Stash it in C. | ||||||
| 42317 | LD A,(24128) | Fetch RandomNumber. | ||||||
| 42320 | ADD A,C | Add the timer. | ||||||
| 42321 | LD (24128),A | Write it back to RandomNumber. | ||||||
|
Use bits 2-5 of the timer to index the table.
|
||||||||
| 42324 | LD A,(24128) | Fetch RandomNumber. | ||||||
| 42327 | AND %00111100 | Keep only bits 2-5. | ||||||
| 42329 | LD C,A | Create an offset in BC. | ||||||
| 42330 | LD B,0 | |||||||
| 42332 | LD HL,42635 | HL=Handler_PlayerShot_Table. | ||||||
| 42335 | ADD HL,BC | Add the offset. | ||||||
| 42336 | INC HL | Skip the X and Y offsets to reach the speed in the table. | ||||||
| 42337 | INC HL | |||||||
|
Place the new object beside and above this one.
|
||||||||
| 42338 | LD A,(IX+2) | Fetch the actor world X. | ||||||
| 42341 | ADD A,8 | Add 8. | ||||||
| 42343 | LD (DE),A | Write it as the new world X. | ||||||
|
Carry the addition into the high byte of the new world X.
|
||||||||
| 42344 | INC DE | Move onto the high byte. | ||||||
| 42345 | LD A,(IX+3) | Fetch the actor world X high byte. | ||||||
| 42348 | ADC A,0 | Add the carry. | ||||||
| 42350 | AND %00011111 | Keep only bits 0-4. | ||||||
| 42352 | LD (DE),A | Write the high byte. | ||||||
|
Put the new Y 16 above the actor Y.
|
||||||||
| 42353 | INC DE | Move onto the new Y. | ||||||
| 42354 | LD A,(IX+4) | Fetch the actor Y. | ||||||
| 42357 | SUB 16 | Subtract 16. | ||||||
| 42359 | JR Handler_PlayerShot_WriteFields | Jump to Handler_PlayerShot_WriteFields. | ||||||
| Prev: 42274 | Up: Map | Next: 42361 |