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)
25 if (LowByte(PlayField16[si]) != fiExplosion)
32 bl = HighByte(PlayField16[si]);
34 if ((bl & 0x80) != 0) // infotron explosion!
38 MovHighByte(&PlayField16[si], bl);
40 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
45 GfxGraphic[GetX(si)][GetY(si)] = aniDefaultExplosion;
46 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
51 ExplosionShake = 0; // nothing explodes
52 // ExplosionShakeMurphy = 0; // nothing explodes
54 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
55 GfxGraphic[GetX(si)][GetY(si)] = aniSpace;
56 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
61 loc_g_28D0: // explosion produces infotron
65 PlayField16[si] = fiInfotron;
66 MovLowByte(&ExplosionShake, 0); // nothing explodes
67 // MovLowByte(&ExplosionShakeMurphy, 0); // nothing explodes
69 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
70 GfxGraphic[GetX(si)][GetY(si)] = aniInfotron;
71 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
76 MovHighByte(&PlayField16[si], bl);
78 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
83 GfxGraphic[GetX(si)][GetY(si)] = aniElectronExplosion;
84 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
87 // ==========================================================================
90 // ==========================================================================
92 void ExplodeFieldSP(int si)
96 ax = LowByte(PlayField16[si]);
100 ExplosionShake = 1; // something explodes
105 printf("::: Explosions.c: ExplodeFieldSP(): killing murphy\n");
111 ExplosionShakeMurphy = 30; // Murphy explodes
115 if (ax == fiElectron)
117 cx = 0x801F; // produce infotrons
122 cx = 0x1F; // normal explosion
126 LetExplodeFieldSP(si - FieldWidth - 1, cx, dl);
127 LetExplodeFieldSP(si - FieldWidth, cx, dl);
128 LetExplodeFieldSP(si - FieldWidth + 1, cx, dl);
129 LetExplodeFieldSP(si - 1, cx, dl);
130 PlayField16[si] = cx;
131 LetExplodeFieldSP(si + 1, cx, dl);
132 LetExplodeFieldSP(si + FieldWidth - 1, cx, dl);
133 LetExplodeFieldSP(si + FieldWidth, cx, dl);
134 LetExplodeFieldSP(si + FieldWidth + 1, cx, dl);
136 GfxGraphic[GetX(si)][GetY(si)] = -1; // restart for chain-explosions
139 subSoundFX(si, ax, actExploding);
142 static void LetExplodeFieldSP(int tsi, int cx, int dh)
146 if (tsi < -FieldWidth)
149 al = LowByte(PlayField16[tsi]);
160 PlayField8[tsi] = dh;
161 PlayField16[tsi] = cx;
165 subExplodeZonk(tsi, cx);
169 subExplodeInfotron(tsi, cx);
173 PlayField8[tsi] = (-dh) & 0xFF;
174 PlayField16[tsi] = 0x801F;
179 printf("::: Explosions.c: LetExplodeFieldSP(): killing murphy [%d]\n",
184 PlayField8[tsi] = dh;
185 PlayField16[tsi] = cx;
189 PlayField16[tsi] = cx;
193 GfxGraphic[GetX(tsi)][GetY(tsi)] = -1; // restart for chain-explosions
196 static void subExplodeZonk(int tsi, int cx)
200 ah = HighByte(PlayField16[tsi]) & 0xF0;
201 PlayField16[tsi] = cx;
206 subClearFieldDueToExplosion(tsi - FieldWidth);
207 tsi = tsi + FieldWidth;
208 if (PlayField16[tsi] == 0x9999)
209 subClearFieldDueToExplosion(tsi);
214 subClearFieldDueToExplosion(tsi + 1);
215 subClearFieldDueToExplosion(tsi + FieldWidth);
219 subClearFieldDueToExplosion(tsi - 1);
220 subClearFieldDueToExplosion(tsi + FieldWidth);
224 subClearFieldDueToExplosion(tsi - 1);
228 subClearFieldDueToExplosion(tsi + 1);
231 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
232 subClearFieldDueToExplosion(tsi + FieldWidth);
237 static void subExplodeInfotron(int tsi, int cx)
241 ah = HighByte(PlayField16[tsi]) & 0xF0;
242 PlayField16[tsi] = cx;
247 subClearFieldDueToExplosion(tsi - FieldWidth);
248 tsi = tsi + FieldWidth;
249 if (PlayField16[tsi] == 0x9999)
250 subClearFieldDueToExplosion(tsi);
255 subClearFieldDueToExplosion(tsi + 1);
256 tsi = tsi + FieldWidth; // differnt from zonk version
257 if (PlayField16[tsi] == 0x9999)
258 subClearFieldDueToExplosion(tsi);
263 subClearFieldDueToExplosion(tsi - 1);
264 tsi = tsi + FieldWidth; // differnt from zonk version
265 if (PlayField16[tsi] == 0x9999)
266 subClearFieldDueToExplosion(tsi);
271 subClearFieldDueToExplosion(tsi - 1);
275 subClearFieldDueToExplosion(tsi + 1);
278 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
279 subClearFieldDueToExplosion(tsi + FieldWidth);
284 void subClearFieldDueToExplosion(int si)
290 if (LowByte(PlayField16[si]) == fiExplosion)
294 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
299 GfxGraphic[GetX(si)][GetY(si)] = aniSpace;
300 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
303 void subRedDiskReleaseExplosion()
307 al = RedDiskReleasePhase; // Red disk release phase
311 si = RedDiskReleaseMurphyPos;
312 if (PlayField16[si] == 0) // Release red disk
313 PlayField16[si] = fiRedDisk;
315 // +++++++++++++++++++++++++++++++++++++++++
319 // !!! causes flicker -- fix in Murphy.c !!!
320 GfxGraphic[GetX(si)][GetY(si)] = aniRedDisk;
322 DDSpriteBuffer_BltImg(X, Y, aniRedDisk, 0);
324 // +++++++++++++++++++++++++++++++++++++++++
326 RedDiskReleasePhase = RedDiskReleasePhase + 1;
327 if (RedDiskReleasePhase >= 0x28)
329 // si = RedDiskReleaseMurphyPos ' Red disk was released here
330 ExplodeFieldSP(si); // Explode
331 RedDiskReleasePhase = 0;
335 void subFollowUpExplosions()
340 for (si = 0; si <= LevelMax; si++)
342 ax = ByteToInt(PlayField8[si]);
348 PlayField8[si] = ax & 0xFF;
351 PlayField16[si] = 0xFF18;
352 ExplodeFieldSP(si); // Explode