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
47 // ExplosionShakeMurphy = 0; // nothing explodes
49 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
50 GfxGraphic[GetX(si)][GetY(si)] = aniSpace;
51 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56 loc_g_28D0: // explosion produces infotron
60 PlayField16[si] = fiInfotron;
61 MovLowByte(&ExplosionShake, 0); // nothing explodes
62 // MovLowByte(&ExplosionShakeMurphy, 0); // nothing explodes
64 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
65 GfxGraphic[GetX(si)][GetY(si)] = aniInfotron;
66 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
71 MovHighByte(&PlayField16[si], bl);
73 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
76 GfxGraphic[GetX(si)][GetY(si)] = aniElectronExplosion;
77 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
80 // ==========================================================================
83 // ==========================================================================
85 void ExplodeFieldSP(int si)
89 ax = LowByte(PlayField16[si]);
93 ExplosionShake = 1; // something explodes
98 printf("::: Explosions.c: ExplodeFieldSP(): killing murphy\n");
104 ExplosionShakeMurphy = 30; // Murphy explodes
108 if (ax == fiElectron)
110 cx = 0x801F; // produce infotrons
115 cx = 0x1F; // normal explosion
119 LetExplodeFieldSP(si - FieldWidth - 1, cx, dl);
120 LetExplodeFieldSP(si - FieldWidth, cx, dl);
121 LetExplodeFieldSP(si - FieldWidth + 1, cx, dl);
122 LetExplodeFieldSP(si - 1, cx, dl);
123 PlayField16[si] = cx;
124 LetExplodeFieldSP(si + 1, cx, dl);
125 LetExplodeFieldSP(si + FieldWidth - 1, cx, dl);
126 LetExplodeFieldSP(si + FieldWidth, cx, dl);
127 LetExplodeFieldSP(si + FieldWidth + 1, cx, dl);
129 GfxGraphic[GetX(si)][GetY(si)] = -1; // restart for chain-explosions
132 subSoundFX(si, ax, actExploding);
135 static void LetExplodeFieldSP(int tsi, int cx, int dh)
139 if (tsi < -FieldWidth)
142 al = LowByte(PlayField16[tsi]);
153 PlayField8[tsi] = dh;
154 PlayField16[tsi] = cx;
158 subExplodeZonk(tsi, cx);
162 subExplodeInfotron(tsi, cx);
166 PlayField8[tsi] = (-dh) & 0xFF;
167 PlayField16[tsi] = 0x801F;
172 printf("::: Explosions.c: LetExplodeFieldSP(): killing murphy [%d]\n",
177 PlayField8[tsi] = dh;
178 PlayField16[tsi] = cx;
182 PlayField16[tsi] = cx;
186 GfxGraphic[GetX(tsi)][GetY(tsi)] = -1; // restart for chain-explosions
189 static void subExplodeZonk(int tsi, int cx)
193 ah = HighByte(PlayField16[tsi]) & 0xF0;
194 PlayField16[tsi] = cx;
199 subClearFieldDueToExplosion(tsi - FieldWidth);
200 tsi = tsi + FieldWidth;
201 if (PlayField16[tsi] == 0x9999)
202 subClearFieldDueToExplosion(tsi);
207 subClearFieldDueToExplosion(tsi + 1);
208 subClearFieldDueToExplosion(tsi + FieldWidth);
212 subClearFieldDueToExplosion(tsi - 1);
213 subClearFieldDueToExplosion(tsi + FieldWidth);
217 subClearFieldDueToExplosion(tsi - 1);
221 subClearFieldDueToExplosion(tsi + 1);
224 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
225 subClearFieldDueToExplosion(tsi + FieldWidth);
230 static void subExplodeInfotron(int tsi, int cx)
234 ah = HighByte(PlayField16[tsi]) & 0xF0;
235 PlayField16[tsi] = cx;
240 subClearFieldDueToExplosion(tsi - FieldWidth);
241 tsi = tsi + FieldWidth;
242 if (PlayField16[tsi] == 0x9999)
243 subClearFieldDueToExplosion(tsi);
248 subClearFieldDueToExplosion(tsi + 1);
249 tsi = tsi + FieldWidth; // differnt from zonk version
250 if (PlayField16[tsi] == 0x9999)
251 subClearFieldDueToExplosion(tsi);
256 subClearFieldDueToExplosion(tsi - 1);
257 tsi = tsi + FieldWidth; // differnt from zonk version
258 if (PlayField16[tsi] == 0x9999)
259 subClearFieldDueToExplosion(tsi);
264 subClearFieldDueToExplosion(tsi - 1);
268 subClearFieldDueToExplosion(tsi + 1);
271 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
272 subClearFieldDueToExplosion(tsi + FieldWidth);
277 void subClearFieldDueToExplosion(int si)
281 if (LowByte(PlayField16[si]) == fiExplosion)
285 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
288 GfxGraphic[GetX(si)][GetY(si)] = aniSpace;
289 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
292 void subRedDiskReleaseExplosion()
296 al = RedDiskReleasePhase; // Red disk release phase
300 si = RedDiskReleaseMurphyPos;
301 if (PlayField16[si] == 0) // Release red disk
302 PlayField16[si] = fiRedDisk;
304 // +++++++++++++++++++++++++++++++++++++++++
308 // !!! causes flicker -- fix in Murphy.c !!!
309 GfxGraphic[GetX(si)][GetY(si)] = aniRedDisk;
311 DDSpriteBuffer_BltImg(X, Y, aniRedDisk, 0);
313 // +++++++++++++++++++++++++++++++++++++++++
315 RedDiskReleasePhase = RedDiskReleasePhase + 1;
316 if (RedDiskReleasePhase >= 0x28)
318 // si = RedDiskReleaseMurphyPos ' Red disk was released here
319 ExplodeFieldSP(si); // Explode
320 RedDiskReleasePhase = 0;
324 void subFollowUpExplosions()
329 for (si = 0; si <= LevelMax; si++)
331 ax = ByteToInt(PlayField8[si]);
337 PlayField8[si] = ax & 0xFF;
340 PlayField16[si] = 0xFF18;
341 ExplodeFieldSP(si); // Explode