Prev: 845F Up: Map Next: 8598
8566: Has the player's shot hit this monster?
The mirror image of CHECK_HIT. Same test, same 12-pixel box, but reading $EA98 onwards -- the upper half of the player's record, where a weapon in flight lives -- so this asks whether the player has hit the monster rather than the other way round. The two are called back to back from the same place.
This pair was previously written up as two entries of an 8-byte "object table". That was wrong. $EA90 is one 16-byte record laid out exactly like a monster's, and $EA98 is its second half, not a neighbouring record; the giveaway is that ACTOR_TO_WORKSPACE is called with $EA90 and with the monster records but never with $EA98.
Input
IX The monster to test
E 1 if the shot has hit it, 0 if not
CHECK_SHOT_HIT 8566 LD A,($EA99) +$09 is the weapon's room, +$08 its type, +$0B and +$0C its position.
8569 LD E,$00
856B CP (IX+$01)
856E RET NZ
856F LD A,($EA98)
8572 AND A
8573 RET Z
8574 LD A,($EA9B)
8577 SUB (IX+$03)
857A JP P,CHECK_SHOT_HIT_0
857D NEG
CHECK_SHOT_HIT_0 857F CP $0C
8581 RET NC
8582 LD A,($EA9C)
8585 SUB (IX+$04)
8588 JP P,CHECK_SHOT_HIT_1
858B NEG
CHECK_SHOT_HIT_1 858D CP $0C
858F RET NC
8590 LD A,$01
8592 LD ($EA9A),A
8595 LD E,$01
8597 RET
Prev: 845F Up: Map Next: 8598