![]() |
Routines |
| Prev: 42349 | Up: Map | Next: 42407 |
|
Checks whether the entity overlaps any of the ten entities that are enemies (entities 4 to 13), apart from itself.
|
||||||||||||||||||
| CheckEnemyOverlap | 42358 | PUSH BC | Save the register. | |||||||||||||||
| 42359 | LD B,10 | There are ten enemies to check. | ||||||||||||||||
| 42361 | LD IY,38608 | Point IY at EnemyEntities. | ||||||||||||||||
|
This entry point is used by the routine at CheckEntityOverlap.
|
||||||||||||||||||
| CheckEnemyOverlap_Next | 42365 | PUSH BC | Save the counter. | |||||||||||||||
| 42366 | LD A,(IY+0) | Fetch the type of the entity. | ||||||||||||||||
| 42369 | AND A | Jump if the entity is not in use. | ||||||||||||||||
| 42370 | JR Z,CheckEnemyOverlap_Skip | |||||||||||||||||
| 42372 | PUSH HL | Save the Y position. | ||||||||||||||||
| 42373 | PUSH IX | Copy the address of the entity being moved into HL... | ||||||||||||||||
| 42375 | POP HL | |||||||||||||||||
| 42376 | PUSH IY | ...and the address of the entity that is being checked into BC. | ||||||||||||||||
| 42378 | POP BC | |||||||||||||||||
| 42379 | AND A | Subtract one from the other... | ||||||||||||||||
| 42380 | SBC HL,BC | |||||||||||||||||
| 42382 | POP HL | ...restoring the Y position... | ||||||||||||||||
| 42383 | JR Z,CheckEnemyOverlap_Skip | ...and jump if they are the same entity. | ||||||||||||||||
| 42385 | LD BC,61680 | Use 240 as the distance in both directions. | ||||||||||||||||
| 42388 | CALL ComparePositions | Compare the positions using ComparePositions. | ||||||||||||||||
| 42391 | JR C,CheckEnemyOverlap_Hit | Jump if they overlap. | ||||||||||||||||
| CheckEnemyOverlap_Skip | 42393 | LD BC,16 | Each entity is 16 bytes long. | |||||||||||||||
| 42396 | ADD IY,BC | Move on to the next one. | ||||||||||||||||
| 42398 | POP BC | Restore the counter. | ||||||||||||||||
| 42399 | DJNZ CheckEnemyOverlap_Next | Loop back until every entity has been checked. | ||||||||||||||||
| 42401 | AND A | Clear the carry flag... | ||||||||||||||||
| 42402 | POP BC | ...restore the register... | ||||||||||||||||
| 42403 | RET | ...and return. | ||||||||||||||||
| CheckEnemyOverlap_Hit | 42404 | POP BC | Discard the counter... | |||||||||||||||
| 42405 | POP BC | ...and restore the register. | ||||||||||||||||
| 42406 | RET | Return with the carry flag set. | ||||||||||||||||
| Prev: 42349 | Up: Map | Next: 42407 |