![]() |
Routines |
| Prev: 9143 | Up: Map | Next: 9234 |
|
Used by the routine at UpdateEnemies.
Checks whether any of the four objects at ShotSlots has hit the object described by the hit data at CollisionBox. If one has, bit 7 of its flags is set and effects are applied to the object that was hit.
|
||||||||||
| CheckShotCollisions | 917C | LD A,D | Fetch the collision flag. | |||||||
| 917D | DEC A | Subtract one. | ||||||||
| 917E | RET M | Return if it was zero. | ||||||||
| 917F | PUSH IX | Save the address of the object. | ||||||||
| 9181 | LD IX,$ABA4 | Use the hit data at CollisionBox. | ||||||||
| 9185 | LD A,$04 | Set the counter for four objects. | ||||||||
| 9187 | LD IY,$B37A | Use the first object. | ||||||||
|
This entry point is used by the routine at CheckObjectAgainstShots.
|
||||||||||
| CheckShotCollisions_Loop | 918B | EX AF,AF' | Save the counter. | |||||||
| 918C | BIT 7,(IY+$16) | Jump to CheckShotCollisions_Position if bit 7 of the second set of flags of the object is set. | ||||||||
| 9190 | JR NZ,CheckShotCollisions_Position | |||||||||
| 9192 | LD L,(IY+$0B) | Fetch the first value of the object. | ||||||||
| 9195 | LD A,L | Test it. | ||||||||
| 9196 | AND A | Jump to CheckShotCollisions_Next if it is zero. | ||||||||
| 9197 | JR Z,CheckShotCollisions_Next | |||||||||
| 9199 | JR CheckShotCollisions_Offset | Jump to CheckShotCollisions_Offset. | ||||||||
| CheckShotCollisions_Position | 919B | BIT 7,(IY+$10) | Jump to CheckShotCollisions_Next if bit 7 of the flags of the object is clear. | |||||||
| 919F | JR Z,CheckShotCollisions_Next | |||||||||
| 91A1 | LD L,(IY+$11) | Fetch the screen position of the object. | ||||||||
| 91A4 | LD H,(IY+$12) | |||||||||
| 91A7 | JR CheckShotCollisions_Range | Jump to CheckShotCollisions_Range. | ||||||||
| CheckShotCollisions_Offset | 91A9 | LD H,(IY+$0C) | Fetch the value from the object. | |||||||
| 91AC | INC H | Add one. | ||||||||
| 91AD | BIT 7,(IY+$15) | Jump to CheckShotCollisions_Wide if bit 7 of the third set of flags of the object is set. | ||||||||
| 91B1 | JR NZ,CheckShotCollisions_Wide | |||||||||
| CheckShotCollisions_Range | 91B3 | LD A,($5C1E) | Fetch the value from ScratchPair. | |||||||
| 91B6 | INC H | Add one to the vertical position. | ||||||||
| 91B7 | CP H | Compare it with the vertical position. | ||||||||
| 91B8 | JR NC,CheckShotCollisions_Next | Jump to CheckShotCollisions_Next if it is lower. | ||||||||
| 91BA | DEC H | Subtract one again. | ||||||||
| 91BB | LD A,(IX+$01) | Fetch the vertical position of the hit data. | ||||||||
| 91BE | ADD A,$03 | Add three. | ||||||||
| 91C0 | CP H | Compare it with the vertical position. | ||||||||
| 91C1 | JR C,CheckShotCollisions_Next | Jump to CheckShotCollisions_Next if it is lower. | ||||||||
| 91C3 | LD E,$05 | Set the width to five. | ||||||||
| 91C5 | JR CheckShotCollisions_Height | Jump to CheckShotCollisions_Height. | ||||||||
| CheckShotCollisions_Wide | 91C7 | LD E,$08 | Set the width to eight. | |||||||
| CheckShotCollisions_Height | 91C9 | LD D,$08 | Set the height to eight. | |||||||
| 91CB | BIT 7,(IY+$16) | Jump to CheckShotCollisions_Check if bit 7 of the third set of flags of the object is set. | ||||||||
| 91CF | JR NZ,CheckShotCollisions_Check | |||||||||
| 91D1 | LD A,(IY+$0E) | Fetch the value from the object. | ||||||||
| 91D4 | ADD A,A | Multiply it by eight. | ||||||||
| 91D5 | ADD A,A | |||||||||
| 91D6 | ADD A,A | |||||||||
| 91D7 | JR Z,CheckShotCollisions_Next | Jump to CheckShotCollisions_Next if it is zero. | ||||||||
| 91D9 | LD D,A | Use it as the height. | ||||||||
| CheckShotCollisions_Check | 91DA | CALL TestBoxesOverlap | Check for a collision. | |||||||
| 91DD | LD A,($5C1C) | Fetch the value from ScratchValue. | ||||||||
| 91E0 | AND A | Test it. | ||||||||
| 91E1 | JR NZ,CheckShotCollisions_Hit | Jump to CheckShotCollisions_Hit if there has been a collision. | ||||||||
| CheckShotCollisions_Next | 91E3 | LD BC,$0018 | Set the length of an object. | |||||||
| 91E6 | ADD IY,BC | Move on to the next object. | ||||||||
| 91E8 | EX AF,AF' | Restore the counter. | ||||||||
| 91E9 | DEC A | Decrease the counter by one... | ||||||||
| 91EA | JR NZ,CheckShotCollisions_Loop | ...and loop back to CheckShotCollisions_Loop until none remain. | ||||||||
| 91EC | POP IX | Restore the address of the object. | ||||||||
| 91EE | RET | Return. | ||||||||
| CheckShotCollisions_Hit | 91EF | POP IX | Restore the address of the object. | |||||||
| 91F1 | BIT 7,(IY+$16) | Jump to CheckShotCollisions_Mark if bit 7 of the third set of flags of the shot is clear. | ||||||||
| 91F5 | JR Z,CheckShotCollisions_Mark | |||||||||
| 91F7 | SET 4,(IY+$10) | Set bit 4 of the flags of the shot. | ||||||||
| 91FB | LD A,(IX+$00) | Fetch the type of the object that was hit. | ||||||||
| 91FE | CP $19 | Jump to CheckShotCollisions_Mark if it is not 19. | ||||||||
| 9200 | JR NZ,CheckShotCollisions_Mark | |||||||||
| 9202 | INC (IX+$16) | Add one to the third state byte of the object. | ||||||||
| 9205 | CALL PlayHitSound | Play the explosion sound. | ||||||||
| 9208 | CALL ScoreDestroyedObject | Score the points for the object. | ||||||||
| CheckShotCollisions_Mark | 920B | SET 7,(IY+$10) | Set bit 7 of the flags of the shot. | |||||||
| 920F | SET 5,(IX+$10) | Set bit 5 of the flags of the object that was hit. | ||||||||
| 9213 | BIT 7,(IY+$15) | Test bit 7 of the second value of the shot. | ||||||||
| 9217 | RET Z | Return if it is clear. | ||||||||
| 9218 | SET 3,(IX+$17) | Set bit 3 of the second set of flags of the object. | ||||||||
| 921C | RES 5,(IX+$10) | Clear bit 5 of its flags. | ||||||||
| 9220 | LD A,(IX+$00) | Fetch the type of the object. | ||||||||
| 9223 | CP $19 | Jump to ScoreDestroyedObject if it is not 19. | ||||||||
| 9225 | JR NZ,ScoreDestroyedObject | |||||||||
| 9227 | LD A,(IX+$0D) | Fetch the attribute of the object. | ||||||||
| 922A | INC A | Increment it. | ||||||||
| 922B | RET NZ | Return if it was not FF. | ||||||||
| 922C | CALL ScoreDestroyedObject | Score the points for the object. | ||||||||
| 922F | LD A,R | Fetch a pseudo-random value from the refresh register. | ||||||||
| 9231 | JP AddToStack_Units | Jump to AddToStack_Units. | ||||||||
| Prev: 9143 | Up: Map | Next: 9234 |