![]() |
Routines |
| Prev: A56D | Up: Map | Next: A5A7 |
|
Checks whether the entity overlaps any of the ten entities that are enemies (entities 04 to 0D), apart from itself.
|
||||||||||||||||||
| CheckEnemyOverlap | A576 | PUSH BC | Save the register. | |||||||||||||||
| A577 | LD B,$0A | There are ten enemies to check. | ||||||||||||||||
| A579 | LD IY,$96D0 | Point IY at EnemyEntities. | ||||||||||||||||
|
This entry point is used by the routine at CheckEntityOverlap.
|
||||||||||||||||||
| CheckEnemyOverlap_Next | A57D | PUSH BC | Save the counter. | |||||||||||||||
| A57E | LD A,(IY+$00) | Fetch the type of the entity. | ||||||||||||||||
| A581 | AND A | Jump if the entity is not in use. | ||||||||||||||||
| A582 | JR Z,CheckEnemyOverlap_Skip | |||||||||||||||||
| A584 | PUSH HL | Save the Y position. | ||||||||||||||||
| A585 | PUSH IX | Copy the address of the entity being moved into HL... | ||||||||||||||||
| A587 | POP HL | |||||||||||||||||
| A588 | PUSH IY | ...and the address of the entity that is being checked into BC. | ||||||||||||||||
| A58A | POP BC | |||||||||||||||||
| A58B | AND A | Subtract one from the other... | ||||||||||||||||
| A58C | SBC HL,BC | |||||||||||||||||
| A58E | POP HL | ...restoring the Y position... | ||||||||||||||||
| A58F | JR Z,CheckEnemyOverlap_Skip | ...and jump if they are the same entity. | ||||||||||||||||
| A591 | LD BC,$F0F0 | Use F0 as the distance in both directions. | ||||||||||||||||
| A594 | CALL ComparePositions | Compare the positions using ComparePositions. | ||||||||||||||||
| A597 | JR C,CheckEnemyOverlap_Hit | Jump if they overlap. | ||||||||||||||||
| CheckEnemyOverlap_Skip | A599 | LD BC,$0010 | Each entity is 10 bytes long. | |||||||||||||||
| A59C | ADD IY,BC | Move on to the next one. | ||||||||||||||||
| A59E | POP BC | Restore the counter. | ||||||||||||||||
| A59F | DJNZ CheckEnemyOverlap_Next | Loop back until every entity has been checked. | ||||||||||||||||
| A5A1 | AND A | Clear the carry flag... | ||||||||||||||||
| A5A2 | POP BC | ...restore the register... | ||||||||||||||||
| A5A3 | RET | ...and return. | ||||||||||||||||
| CheckEnemyOverlap_Hit | A5A4 | POP BC | Discard the counter... | |||||||||||||||
| A5A5 | POP BC | ...and restore the register. | ||||||||||||||||
| A5A6 | RET | Return with the carry flag set. | ||||||||||||||||
| Prev: A56D | Up: Map | Next: A5A7 |