![]() |
Routines |
| Prev: 42358 | Up: Map | Next: 42474 |
|
Checks whether an entity (a shot, or the robot) has run into an enemy. If it has, then both are turned into smoke and the player is awarded some points.
|
||||||||||||
| CheckShotHit | 42407 | LD B,10 | There are ten enemies to check. | |||||||||
| 42409 | LD IY,38608 | Point IY at EnemyEntities. | ||||||||||
| CheckShotHit_Next | 42413 | PUSH BC | Save the counter. | |||||||||
| 42414 | LD A,(IY+0) | Fetch the type of the enemy. | ||||||||||
| 42417 | AND A | Jump if the entity is not in use. | ||||||||||
| 42418 | JR Z,CheckShotHit_Skip | |||||||||||
| 42420 | SUB 56 | Jump if it is smoke or a sprite of a materialising enemy (types 56 to 79). | ||||||||||
| 42422 | CP 24 | |||||||||||
| 42424 | JR C,CheckShotHit_Skip | |||||||||||
| 42426 | LD BC,49344 | Use 192 as the distance in both directions. | ||||||||||
| 42429 | CALL ComparePositions | Compare the positions using ComparePositions. | ||||||||||
| 42432 | JR C,CheckShotHit_Hit | Jump if they overlap. | ||||||||||
| CheckShotHit_Skip | 42434 | LD BC,16 | Each entity is 16 bytes long. | |||||||||
| 42437 | ADD IY,BC | Move on to the next one. | ||||||||||
| 42439 | POP BC | Restore the counter. | ||||||||||
| 42440 | DJNZ CheckShotHit_Next | Loop back until every enemy has been checked. | ||||||||||
| 42442 | RET | Return. | ||||||||||
| CheckShotHit_Hit | 42443 | POP BC | Discard the counter. | |||||||||
| 42444 | LD A,(IX+0) | Fetch the type of the entity that has hit the enemy... | ||||||||||
| 42447 | LD (IX+5),A | ...and keep it. | ||||||||||
| 42450 | LD (38456),IY | Keep the address of the enemy that was hit. | ||||||||||
| 42454 | LD A,(IY+0) | Fetch the type of the enemy... | ||||||||||
| 42457 | LD (IY+5),A | ...and keep it. | ||||||||||
| 42460 | LD A,56 | Turn the shot into smoke... | ||||||||||
| 42462 | LD (IX+0),A | |||||||||||
| 42465 | LD (IY+0),A | ...and the enemy too. | ||||||||||
| 42468 | LD BC,291 | Add 291 points... | ||||||||||
| 42471 | JP AddPointsToScore | Jump to AddPointsToScore. | ||||||||||
| Prev: 42358 | Up: Map | Next: 42474 |