Prev: C1C5 Up: Map Next: C264
C206: Has the bolt hit either thing from the sky?
Used by the routine at BOLT.
Tests the two records for things from the sky (FLYERS and FLYER_SECOND) with HIT_TEST, the second half of this routine. BOLT_TOUCHING uses the test the other way round, for the two bolts against the well.
Input
IX the bolt
Output
D 0 if it has
IY the thing it hit, if D is 0
BOLT_HIT C206 LD D,$01 the first thing from the sky
C208 LD IY,FLYERS
C20C CALL HIT_TEST
C20F LD A,D hit: done
C210 AND A
C211 RET Z
C212 LD IY,FLYER_SECOND the second
This entry point is used by the routine at BOLT_TOUCHING.
Is the object at IY touching the one at IX? D is set to 0 if it is, and left alone if not. IY's graphic must be 8 or more and not a puff (64 to 71). Each axis in turn: the distance between them no more than the sum of their half-sizes, plus 2.
HIT_TEST C216 LD A,(IY+$00) graphic 0 to 7: nothing there
C219 AND $F8
C21B RET Z
C21C CP $40 graphic 64 to 71, a puff...
This entry point is used by the routine at BOLT_TOUCHING.
HIT_TEST_Z C21E RET Z ...no hit. BOLT_TOUCHING comes in here for the first bolt with Z from its own test for an empty record, which skips the test for a puff: that bolt's puff still counts as touching the well
C21F LD A,(IY+$01) U
C222 SUB (IX+$01)
C225 JP P,BOLT_HIT_0
C228 NEG
BOLT_HIT_0 C22A LD E,A
C22B LD A,(IY+$04)
C22E ADD A,(IX+$04)
C231 ADD A,$02
C233 CP E
C234 RET C
C235 LD A,(IX+$02) V
C238 SUB (IY+$02)
C23B JP P,BOLT_HIT_1
C23E NEG
BOLT_HIT_1 C240 LD E,A
C241 LD A,(IX+$05)
C244 ADD A,(IY+$05)
C247 ADD A,$02
C249 CP E
C24A RET C
C24B LD A,(IX+$03) Z
C24E SUB (IY+$03)
C251 JP P,BOLT_HIT_2
C254 NEG
BOLT_HIT_2 C256 LD E,A
C257 LD A,(IX+$06)
C25A ADD A,(IY+$06)
C25D ADD A,$02
C25F CP E
C260 RET C
C261 LD D,$00 touching
C263 RET
Prev: C1C5 Up: Map Next: C264