Prev: 25850 Up: Map Next: 26242
26103: Animate Explosion
Input
IX Explosion animation object
AnimateExplosion 26103 LD HL,24086 HL=CurrentBug_ID.
26106 INC (HL) Increment CurrentBug_ID by one.
26107 LD C,(IX+4) C=explosion animation frame.
26110 LD B,(IX+5) B=explosion animation state.
26113 LD A,(24087) A=GameTimer.
26116 AND B Increment frame if timer & state are both zero.
26117 JR NZ,ExplosionFetchSpriteFrame
26119 INC (IX+4)
ExplosionFetchSpriteFrame 26122 LD A,C A=current explosion animation frame.
26123 SLA C Create an offset using the animation frame ID.
26125 LD B,0
26127 LD HL,26242 HL=ExplosionLookupTable.
26130 ADD HL,BC HL=HL + offset.
26131 LD E,(HL) DE=fetch sprite frame address from HL.
26132 INC HL
26133 LD D,(HL)
26134 LD L,(IX+1) HL=X/Y co-ordinates of the exploding actor.
26137 LD H,(IX+2)
26140 CP 6 If the current frame >= 6 then the animation has finished.
26142 JR NC,AnimateExplosion_End
26144 CP 3 If the current frame >= 3 then we're halfway done.
26146 JR NC,AnimateExplosion_2
26148 CALL 29980 Call 29980.
26151 LD A,(24089) A=RandomNumber.
26154 AND %00000111 Keep only bits 0-2.
26156 OR %01000010 Set bits 1 and 6 (BRIGHT).
26158 LD (IX+3),A Update with a random colour
26161 JP ColouriseSprite Jump to ColouriseSprite.
After an explosion, we check if it was the player that died!
AnimateExplosion_End 26164 LD A,(IX+6) Update anim object so "animating" = "direction".
26167 LD (IX+0),A
26170 CALL StoreEntity Call StoreEntity.
26173 CALL 29990 Call 29990.
26176 LD (IX+0),0
26180 LD A,(IX+6)
26183 AND %00111111 Keep only bits 0-5.
26185 CP 3
26187 RET NC
26188 CP 2
26190 JP NZ,PlayerTurnEnds
26193 LD HL,24099 HL=24099.
26196 LD BC,24109 BC=24109.
26199 LD A,(24089) A=RandomNumber.
26202 AND %00000111 Keep only bits 0-2.
26204 LD E,A
26205 LD D,0
26207 ADD HL,DE
AnimateExplosion_0 26208 LD A,(HL)
26209 AND A
26210 JR Z,AnimateExplosion_1
26212 INC HL
26213 PUSH HL
26214 AND A
26215 SBC HL,BC
26217 POP HL
26218 JR NZ,AnimateExplosion_0
26220 LD HL,24099 HL=24099.
26223 JR AnimateExplosion_0 Jump to AnimateExplosion_0.
AnimateExplosion_1 26225 LD A,(24183) A=24183.
26228 AND %00000111 Keep only bits 0-2.
26230 OR %00001000 Set bit 3.
26232 LD (HL),A Stash the result at the address held by HL.
26233 JP PlayerTurnEnds Jump to PlayerTurnEnds.
AnimateExplosion_2 26236 CALL 29867 Call 29867.
26239 JP 29993 Jump to 29993.
Prev: 25850 Up: Map Next: 26242