1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
5 #include "Explosions.h"
8 static void LetExplodeFieldSP(int tsi, int cx, int dh);
9 static void subExplodeInfotron(int tsi, int cx);
10 static void subExplodeZonk(int tsi, int cx);
13 // ==========================================================================
16 // ==========================================================================
18 void subAnimateExplosion(int si)
22 if (LowByte(PlayField16[si]) != fiExplosion)
29 bl = HighByte(PlayField16[si]);
31 if ((bl & 0x80) != 0) // infotron explosion!
35 MovHighByte(&PlayField16[si], bl);
37 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
38 GfxGraphic[GetX(si)][GetY(si)] = aniDefaultExplosion;
39 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
44 ExplosionShake = 0; // nothing explodes
45 // ExplosionShakeMurphy = 0; // nothing explodes
47 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
48 GfxGraphic[GetX(si)][GetY(si)] = aniSpace;
49 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
54 loc_g_28D0: // explosion produces infotron
58 PlayField16[si] = fiInfotron;
59 MovLowByte(&ExplosionShake, 0); // nothing explodes
60 // MovLowByte(&ExplosionShakeMurphy, 0); // nothing explodes
62 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
63 GfxGraphic[GetX(si)][GetY(si)] = aniInfotron;
64 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
69 MovHighByte(&PlayField16[si], bl);
71 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
72 GfxGraphic[GetX(si)][GetY(si)] = aniElectronExplosion;
73 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
76 // ==========================================================================
79 // ==========================================================================
81 void ExplodeFieldSP(int si)
85 ax = LowByte(PlayField16[si]);
89 ExplosionShake = 1; // something explodes
95 ExplosionShakeMurphy = 30; // Murphy explodes
100 cx = 0x801F; // produce infotrons
105 cx = 0x1F; // normal explosion
109 LetExplodeFieldSP(si - FieldWidth - 1, cx, dl);
110 LetExplodeFieldSP(si - FieldWidth, cx, dl);
111 LetExplodeFieldSP(si - FieldWidth + 1, cx, dl);
112 LetExplodeFieldSP(si - 1, cx, dl);
113 PlayField16[si] = cx;
114 LetExplodeFieldSP(si + 1, cx, dl);
115 LetExplodeFieldSP(si + FieldWidth - 1, cx, dl);
116 LetExplodeFieldSP(si + FieldWidth, cx, dl);
117 LetExplodeFieldSP(si + FieldWidth + 1, cx, dl);
119 GfxGraphic[GetX(si)][GetY(si)] = -1; // restart for chain-explosions
122 subSoundFX(si, ax, actExploding);
125 static void LetExplodeFieldSP(int tsi, int cx, int dh)
129 if (tsi < -FieldWidth)
132 al = LowByte(PlayField16[tsi]);
143 PlayField8[tsi] = dh;
144 PlayField16[tsi] = cx;
148 subExplodeZonk(tsi, cx);
152 subExplodeInfotron(tsi, cx);
156 PlayField8[tsi] = (-dh) & 0xFF;
157 PlayField16[tsi] = 0x801F;
162 PlayField8[tsi] = dh;
163 PlayField16[tsi] = cx;
167 PlayField16[tsi] = cx;
171 GfxGraphic[GetX(tsi)][GetY(tsi)] = -1; // restart for chain-explosions
174 static void subExplodeZonk(int tsi, int cx)
178 ah = HighByte(PlayField16[tsi]) & 0xF0;
179 PlayField16[tsi] = cx;
184 subClearFieldDueToExplosion(tsi - FieldWidth);
185 tsi = tsi + FieldWidth;
186 if (PlayField16[tsi] == 0x9999)
187 subClearFieldDueToExplosion(tsi);
192 subClearFieldDueToExplosion(tsi + 1);
193 subClearFieldDueToExplosion(tsi + FieldWidth);
197 subClearFieldDueToExplosion(tsi - 1);
198 subClearFieldDueToExplosion(tsi + FieldWidth);
202 subClearFieldDueToExplosion(tsi - 1);
206 subClearFieldDueToExplosion(tsi + 1);
209 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
210 subClearFieldDueToExplosion(tsi + FieldWidth);
215 static void subExplodeInfotron(int tsi, int cx)
219 ah = HighByte(PlayField16[tsi]) & 0xF0;
220 PlayField16[tsi] = cx;
225 subClearFieldDueToExplosion(tsi - FieldWidth);
226 tsi = tsi + FieldWidth;
227 if (PlayField16[tsi] == 0x9999)
228 subClearFieldDueToExplosion(tsi);
233 subClearFieldDueToExplosion(tsi + 1);
234 tsi = tsi + FieldWidth; // differnt from zonk version
235 if (PlayField16[tsi] == 0x9999)
236 subClearFieldDueToExplosion(tsi);
241 subClearFieldDueToExplosion(tsi - 1);
242 tsi = tsi + FieldWidth; // differnt from zonk version
243 if (PlayField16[tsi] == 0x9999)
244 subClearFieldDueToExplosion(tsi);
249 subClearFieldDueToExplosion(tsi - 1);
253 subClearFieldDueToExplosion(tsi + 1);
256 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
257 subClearFieldDueToExplosion(tsi + FieldWidth);
262 void subClearFieldDueToExplosion(int si)
264 if (LowByte(PlayField16[si]) == fiExplosion)
268 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
269 GfxGraphic[GetX(si)][GetY(si)] = aniSpace;
270 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
273 void subRedDiskReleaseExplosion()
277 al = RedDiskReleasePhase; // Red disk release phase
281 si = RedDiskReleaseMurphyPos;
282 if (PlayField16[si] == 0) // Release red disk
283 PlayField16[si] = fiRedDisk;
285 // +++++++++++++++++++++++++++++++++++++++++
288 DDSpriteBuffer_BltImg(X, Y, aniRedDisk, 0);
289 // +++++++++++++++++++++++++++++++++++++++++
291 RedDiskReleasePhase = RedDiskReleasePhase + 1;
292 if (RedDiskReleasePhase >= 0x28)
294 // si = RedDiskReleaseMurphyPos ' Red disk was released here
295 ExplodeFieldSP(si); // Explode
296 RedDiskReleasePhase = 0;
300 void subFollowUpExplosions()
305 for (si = 0; si <= LevelMax; si++)
307 ax = ByteToInt(PlayField8[si]);
313 PlayField8[si] = ax & 0xFF;
316 PlayField16[si] = 0xFF18;
317 ExplodeFieldSP(si); // Explode