![]() |
Routines |
| Prev: 37130 | Up: Map | Next: 37244 |
|
Used by the routines at UpdateEnemies and CheckObjectHitByShot.
Works out the screen position of the object that was hit, and sets up the hit data used by CheckShotCollisions. Does nothing if the collision flag at 41432 is clear.
|
||||
| FindHitPosition | 37187 | LD IY,(44358) | Fetch the address of the object from CurrentObject. | |
| 37191 | LD L,(IY+17) | Fetch its screen position into HL. | ||
| 37194 | LD H,(IY+18) | |||
| 37197 | LD A,(23593) | Fetch the value from 23593 into E. | ||
| 37200 | LD E,A | |||
| 37201 | LD A,(41432) | Fetch the collision flag from 41432 into D. | ||
| 37204 | LD D,A | |||
| 37205 | LD A,D | Copy it into A. | ||
| 37206 | DEC A | Subtract one. | ||
| 37207 | RET M | Return if it was zero. | ||
| 37208 | LD A,(41722) | Fetch the flag from SpriteVariables_RightEdge. | ||
| 37211 | AND A | Test it. | ||
| 37212 | LD A,L | Fetch the horizontal screen position. | ||
| 37213 | JR Z,FindHitPosition_Clear | Jump to FindHitPosition_Clear if the flag is clear. | ||
| 37215 | ADD A,E | Add the value from E. | ||
| 37216 | LD L,8 | Set the horizontal screen position to 8. | ||
| 37218 | SUB L | Subtract it. | ||
| 37219 | LD E,A | Keep the result in E. | ||
| 37220 | JR FindHitPosition_Store | Jump to FindHitPosition_Store. | ||
| FindHitPosition_Clear | 37222 | ADD A,23 | Add 23 to the horizontal screen position. | |
| 37224 | ADD A,E | Add the value from E. | ||
| 37225 | JR NC,FindHitPosition_Store | Jump to FindHitPosition_Store if there is no carry. | ||
| 37227 | LD A,238 | Otherwise use 238... | ||
| 37229 | SUB L | ...less the horizontal screen position. | ||
| 37230 | LD E,A | Keep the result in E. | ||
| FindHitPosition_Store | 37231 | LD (43940),HL | Store the position in CollisionBox. | |
| 37234 | LD (43942),DE | Store the size in 43942. | ||
| 37238 | LD A,H | Fetch the vertical screen position. | ||
| 37239 | SUB D | Subtract the collision flag. | ||
| 37240 | LD (23582),A | Store the result in ScratchPair. | ||
| 37243 | RET | Return. | ||
| Prev: 37130 | Up: Map | Next: 37244 |