![]() |
Routines |
| Prev: C1C5 | Up: Map | Next: C264 |
|
Used by the routine at RunProjectile.
Tests if an object touches either of the two creatures that wander about the room, which are in the object records ObjectsTable_Creatures and ObjectsTable_SecondCreature. The touching is tested with a margin of 02.
|
||||||||||||
| TestCreatureHit | C206 | LD D,$01 | Set the result to 01, as nothing has been hit. | |||||||||
| C208 | LD IY,$A7EF | Start with the first of the creatures, ObjectsTable_Creatures. | ||||||||||
| C20C | CALL TestCreatureHit_Test | Call TestCreatureHit_Test to test it. | ||||||||||
| C20F | LD A,D | Fetch the result. | ||||||||||
| C210 | AND A | Return if the creature was hit. | ||||||||||
| C211 | RET Z | |||||||||||
| C212 | LD IY,$A80F | Move on to the second of the creatures, ObjectsTable_SecondCreature. | ||||||||||
|
This entry point is used by the routine at TestProjectileHit.
Ignore objects that are free, are of a type below 08, or are explosions.
|
||||||||||||
| TestCreatureHit_Test | C216 | LD A,(IY+$00) | Fetch the type of the creature. | |||||||||
| C219 | AND %11111000 | Keep only the bits of the type that tell the kinds of object apart. | ||||||||||
| C21B | RET Z | Return if the object is free or of a type that is below 08. | ||||||||||
| C21C | CP $40 | Compare the kind of the object with 40, which is an explosion. | ||||||||||
|
This entry point is used by the routine at TestProjectileHit.
|
||||||||||||
| TestCreatureHit_Projectile | C21E | RET Z | Return if it is an explosion. | |||||||||
|
Test along x.
|
||||||||||||
| C21F | LD A,(IY+$01) | Fetch the x position of the creature. | ||||||||||
| C222 | SUB (IX+$01) | Take away the x position of the object. | ||||||||||
| C225 | JP P,TestCreatureHit_PositiveX | |||||||||||
| C228 | NEG | Make the distance positive. | ||||||||||
| TestCreatureHit_PositiveX | C22A | LD E,A | Stash the distance along x in E. | |||||||||
| C22B | LD A,(IY+$04) | Add the half sizes along x of the two objects, and the margin. | ||||||||||
| C22E | ADD A,(IX+$04) | |||||||||||
| C231 | ADD A,$02 | |||||||||||
| C233 | CP E | Return with the carry flag set if the distance is more than that. | ||||||||||
| C234 | RET C | |||||||||||
|
Test along y.
|
||||||||||||
| C235 | LD A,(IX+$02) | Fetch the y position of the object. | ||||||||||
| C238 | SUB (IY+$02) | Take away the y position of the creature. | ||||||||||
| C23B | JP P,TestCreatureHit_PositiveY | |||||||||||
| C23E | NEG | Make the distance positive. | ||||||||||
| TestCreatureHit_PositiveY | C240 | LD E,A | Stash the distance along y in E. | |||||||||
| C241 | LD A,(IX+$05) | Add the half sizes along y of the two objects, and the margin. | ||||||||||
| C244 | ADD A,(IY+$05) | |||||||||||
| C247 | ADD A,$02 | |||||||||||
| C249 | CP E | Return with the carry flag set if the distance is more than that. | ||||||||||
| C24A | RET C | |||||||||||
|
Test along z.
|
||||||||||||
| C24B | LD A,(IX+$03) | Fetch the z position of the object. | ||||||||||
| C24E | SUB (IY+$03) | Take away the z position of the creature. | ||||||||||
| C251 | JP P,TestCreatureHit_PositiveZ | |||||||||||
| C254 | NEG | Make the distance positive. | ||||||||||
| TestCreatureHit_PositiveZ | C256 | LD E,A | Stash the distance along z in E. | |||||||||
| C257 | LD A,(IX+$06) | Add the sizes along z of the two objects, and the margin. | ||||||||||
| C25A | ADD A,(IY+$06) | |||||||||||
| C25D | ADD A,$02 | |||||||||||
| C25F | CP E | Return with the carry flag set if the distance is more than that. | ||||||||||
| C260 | RET C | |||||||||||
| C261 | LD D,$00 | Set the result to 00, as the creature has been hit. | ||||||||||
| C263 | RET | Return. | ||||||||||
| Prev: C1C5 | Up: Map | Next: C264 |