![]() |
Routines |
| Prev: C0ED | Up: Map | Next: C152 |
|
Splits the creature in two. The shot turns into a burst, and a copy of the creature is made in the first of the short-lived objects that is free. The two creatures go in opposite directions, and 15 hundred points are added to the score. If there is no room for the copy, the player scores only a small number of points.
|
||||
|
Find a short-lived object that is free, or far from the player.
|
||||
| HitOutcome_Split | C101 | LD (IY+$00),$0C | Turn the shot into a burst. | |
| C105 | PUSH IX | Stash the address of the creature on the stack. | ||
| C107 | LD IX,$BD9E | Start with the first short-lived object. | ||
| C10B | LD DE,$0010 | Set the distance between one object and the next (10 bytes). | ||
| C10E | LD B,$06 | Set a counter for the six objects. | ||
| HitOutcome_Split_Loop | C110 | LD A,(IY+$00) | Jump to HitOutcome_Split_Copy to use this object if it is empty. | |
| C113 | AND A | |||
| C114 | JR Z,HitOutcome_Split_Copy | |||
| C116 | LD C,$02 | Set the distance to 02 cells. | ||
| C118 | CALL CheckPlayerClose | Check whether the creature is close to the player. | ||
| C11B | JR NC,HitOutcome_Split_Copy | Jump to HitOutcome_Split_Copy to use this object if the creature is not close to the player. | ||
| C11D | ADD IY,DE | Move on to the next object. | ||
| C11F | DJNZ HitOutcome_Split_Loop | Loop back until all six objects have been tried. | ||
|
There is no free slot, so add a small score and return.
|
||||
| C121 | POP IX | Restore the creature from the stack. | ||
| C123 | LD BC,$0015 | Set the points for failing to split the creature. | ||
| C126 | JP AddToScore | Jump to AddToScore to add the points to the score. | ||
|
Copy the creature and send the two in opposite directions.
|
||||
| HitOutcome_Split_Copy | C129 | PUSH IX | Copy the address of the free object to DE (using the stack). | |
| C12B | POP DE | |||
| C12C | PUSH DE | Point IY at the free object (using the stack). | ||
| C12D | POP IY | |||
| C12F | POP HL | Get the address of the creature back. | ||
| C130 | PUSH HL | Point IX at the creature (using the stack). | ||
| C131 | POP IX | |||
| C133 | LD BC,$0010 | Set the size of an object to 10 bytes. | ||
| C136 | LDIR | Copy the creature into the free object. | ||
| C138 | LD A,(IX+$06) | Fetch the direction timer of the original creature. | ||
| C13B | ADD A,$40 | Turn it a quarter on. | ||
| C13D | OR %00011111 | Set the lower five bits, to give it a new time to go in that direction. | ||
| C13F | LD (IX+$06),A | Store the direction timer of the original creature. | ||
| C142 | LD A,(IY+$06) | Fetch the direction timer of the copy. | ||
| C145 | SUB $40 | Turn it a quarter back. | ||
| C147 | OR %00011111 | Set the lower five bits, to give it a new time to go in that direction. | ||
| C149 | LD (IY+$06),A | Store the direction timer of the copy. | ||
| C14C | LD BC,$0015 | Set the points for splitting a creature. | ||
| C14F | JP AddToScore | Jump to AddToScore to add the points to the score. | ||
| Prev: C0ED | Up: Map | Next: C152 |