Prev: D7ED Up: Map Next: D847
D80C: The update routine for a thrown object (graphics 8-11)
An object the knight has thrown (KNIGHT_THROWS) flies straight on at speed 12, twice a turn like an antibody, until it strikes a villain or a wall. The only villain it can strike is the one in the record 64 bytes on from its own (OBJECT_STRIKE): the object in record n of OBJECTS and the villain in record n of VILLAINS are a pair, and the other three pass through each other. A wall leaves the object lying where it stopped (graphics 4-7, the same object), to be taken up again.
A strike turns the villain into graphic 132, dying (VILLAIN_DYING), and the object into the vanishing cloud; scores 250000 (BC = $2500, shown with the score's two dead zeros); lets out the four sparkles from the villain's place (VILLAIN_SPARKLES); and redraws the villains on the panel (DRAW_VILLAINS), where the dead one is now drawn as a picture in the colour of the object that killed it, not an outline (seen in the quest run: the skeleton in cyan after the first kill).
Input
IX The object's record (OBJECTS)
OBJECT_FLIGHT D80C LD A,(IX+$05) The step from the speed and the facing
D80F CALL SET_STEP
D812 CALL MOVE_CLIPPED Move twice, trimmed at a wall, the wall flag kept from the first
D815 CALL APPLY_STEP
D818 CALL MOVE_CLIPPED_AGAIN
D81B CALL APPLY_STEP
D81E CALL OBJECT_STRIKE Is it touching its own villain, four records on? (IY points to that record)
D821 JR C,OBJECT_FLIGHT_0
D823 BIT 0,(IX+$07) No: done unless it met a wall
D827 RET Z
D828 LD A,(IX+$00) At a wall it falls: graphic 8-11 becomes 4-7, the same object lying
D82B AND $03
D82D OR $04
D82F LD (IX+$00),A
D832 RET
OBJECT_FLIGHT_0 D833 LD (IY+$00),$84 Struck: the villain is dying
D837 LD (IX+$00),$0C The object vanishes
D83B LD BC,$2500 250000 points as shown
D83E CALL ADD_SCORE
D841 CALL VILLAIN_SPARKLES Four sparkles from where the villain was
D844 JP DRAW_VILLAINS Redraw the panel's villains, the dead one blanked
Prev: D7ED Up: Map Next: D847