Prev: 26056 Up: Map Next: 26119
26088: Handle Explosion
The handler for the explosion (IDs 38 and 39) which is shown when a flour shot ends. The sprite is chosen by the lowest bit of a counter in byte 7 of the actor, which starts at 3 and counts down to zero.
The sprite is drawn each time without the previous one being erased. As the sprites are drawn using exclusive OR, drawing the two frames in turn leaves the screen blank after the fourth time, so the explosion is removed when the counter reaches zero.
Input
IX Actor
HandleExplosion 26088 LD A,(IX+7) Fetch the explosion counter.
26091 AND %00000001 Keep only bit 0 (which of the two frames of the explosion to show).
26093 ADD A,38 Add 38 to get the ID of the frame.
26095 LD (IX+0),A Set the actor ID to the ID of the frame.
26098 CALL DrawEntity Draw the explosion using DrawEntity.
26101 CALL ColourSprite Colour the sprite using ColourSprite.
26104 LD A,(IX+7) Fetch the explosion counter.
26107 AND A Has the explosion finished (is the counter zero)?
26108 JR Z,HandleExplosion_Remove Jump to HandleExplosion_Remove if it has.
26110 DEC (IX+7) Decrease the explosion counter by one.
26113 RET Return.
HandleExplosion_Remove 26114 LD (IX+0),0 Remove the explosion by writing 0 to the actor ID.
26118 RET Return.
Prev: 26056 Up: Map Next: 26119