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 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
40 GfxGraphic[GetX(si)][GetY(si)] = aniDefaultExplosion;
41 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
46 ExplosionShake = 0; // nothing explodes
48 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
49 GfxGraphic[GetX(si)][GetY(si)] = aniSpace;
50 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
55 loc_g_28D0: // explosion produces infotron
59 PlayField16[si] = fiInfotron;
60 MovLowByte(&ExplosionShake, 0); // nothing explodes
62 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
63 GfxGraphic[GetX(si)][GetY(si)] = aniInfotron;
64 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
69 MovHighByte(&PlayField16[si], bl);
71 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
74 GfxGraphic[GetX(si)][GetY(si)] = aniElectronExplosion;
75 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
78 // ==========================================================================
81 // ==========================================================================
83 void ExplodeFieldSP(int si)
87 ax = LowByte(PlayField16[si]);
91 ExplosionShake = 1; // something explodes
95 printf("::: Explosions.c: ExplodeFieldSP(): killing murphy\n");
101 if (ax == fiElectron)
103 cx = 0x801F; // produce infotrons
108 cx = 0x1F; // normal explosion
112 LetExplodeFieldSP(si - FieldWidth - 1, cx, dl);
113 LetExplodeFieldSP(si - FieldWidth, cx, dl);
114 LetExplodeFieldSP(si - FieldWidth + 1, cx, dl);
115 LetExplodeFieldSP(si - 1, cx, dl);
116 PlayField16[si] = cx;
117 LetExplodeFieldSP(si + 1, cx, dl);
118 LetExplodeFieldSP(si + FieldWidth - 1, cx, dl);
119 LetExplodeFieldSP(si + FieldWidth, cx, dl);
120 LetExplodeFieldSP(si + FieldWidth + 1, cx, dl);
122 GfxGraphic[GetX(si)][GetY(si)] = -1; // restart for chain-explosions
125 subSoundFX(si, ax, actExploding);
128 static void LetExplodeFieldSP(int tsi, int cx, int dh)
132 if (tsi < (-FieldWidth))
135 al = LowByte(PlayField16[tsi]);
146 PlayField8[tsi] = dh;
147 PlayField16[tsi] = cx;
151 subExplodeZonk(tsi, cx);
155 subExplodeInfotron(tsi, cx);
159 PlayField8[tsi] = (-dh) & 0xFF;
160 PlayField16[tsi] = 0x801F;
165 printf("::: Explosions.c: LetExplodeFieldSP(): killing murphy [%d]\n",
170 PlayField8[tsi] = dh;
171 PlayField16[tsi] = cx;
175 PlayField16[tsi] = cx;
179 GfxGraphic[GetX(tsi)][GetY(tsi)] = -1; // restart for chain-explosions
182 static void subExplodeZonk(int tsi, int cx)
186 ah = HighByte(PlayField16[tsi]) & 0xF0;
187 PlayField16[tsi] = cx;
192 subClearFieldDueToExplosion(tsi - FieldWidth);
193 tsi = tsi + FieldWidth;
194 if (PlayField16[tsi] == 0x9999)
195 subClearFieldDueToExplosion(tsi);
200 subClearFieldDueToExplosion(tsi + 1);
201 subClearFieldDueToExplosion(tsi + FieldWidth);
205 subClearFieldDueToExplosion(tsi - 1);
206 subClearFieldDueToExplosion(tsi + FieldWidth);
210 subClearFieldDueToExplosion(tsi - 1);
214 subClearFieldDueToExplosion(tsi + 1);
217 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
218 subClearFieldDueToExplosion(tsi + FieldWidth);
223 static void subExplodeInfotron(int tsi, int cx)
227 ah = HighByte(PlayField16[tsi]) & 0xF0;
228 PlayField16[tsi] = cx;
233 subClearFieldDueToExplosion(tsi - FieldWidth);
234 tsi = tsi + FieldWidth;
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);
250 tsi = tsi + FieldWidth; // differnt from zonk version
251 if (PlayField16[tsi] == 0x9999)
252 subClearFieldDueToExplosion(tsi);
257 subClearFieldDueToExplosion(tsi - 1);
261 subClearFieldDueToExplosion(tsi + 1);
264 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
265 subClearFieldDueToExplosion(tsi + FieldWidth);
270 void subClearFieldDueToExplosion(int si)
274 if (LowByte(PlayField16[si]) == fiExplosion)
278 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
281 GfxGraphic[GetX(si)][GetY(si)] = aniSpace;
282 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
285 void subRedDiskReleaseExplosion()
289 al = RedDiskReleasePhase; // Red disk release phase
293 si = RedDiskReleaseMurphyPos;
294 if (PlayField16[si] == 0) // Release red disk
295 PlayField16[si] = fiRedDisk;
297 // +++++++++++++++++++++++++++++++++++++++++
301 // !!! causes flicker -- fix in Murphy.c !!!
302 GfxGraphic[GetX(si)][GetY(si)] = aniRedDisk;
304 DDSpriteBuffer_BltImg(X, Y, aniRedDisk, 0);
306 // +++++++++++++++++++++++++++++++++++++++++
308 RedDiskReleasePhase = RedDiskReleasePhase + 1;
309 if (RedDiskReleasePhase >= 0x28)
311 // si = RedDiskReleaseMurphyPos ' Red disk was released here
312 ExplodeFieldSP(si); // Explode
313 RedDiskReleasePhase = 0;
317 void subFollowUpExplosions()
322 for (si = 0; si <= LevelMax; si++)
324 ax = ByteToInt(PlayField8[si]);
330 PlayField8[si] = ax & 0xFF;
333 PlayField16[si] = 0xFF18;
334 ExplodeFieldSP(si); // Explode