1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
5 #include "Explosions.h"
7 static void LetExplodeFieldSP(int tsi, int cx, int dh);
8 static int subExplodeInfotron(int tsi, int cx);
9 static int subExplodeZonk(int tsi, int cx);
11 // static char *VB_Name = "modExplosions";
12 // --- Option Explicit
14 // ==========================================================================
17 // ==========================================================================
18 int subAnimateExplosion(int si)
20 int subAnimateExplosion;
22 // int ax, bx, bl, X, Y;
25 if (LowByte(PlayField16[si]) != fiExplosion)
26 return subAnimateExplosion;
30 return subAnimateExplosion;
32 bl = HighByte(PlayField16[si]);
33 if ((bl & 0x80) != 0) // infotron explosion!
37 MovHighByte(&PlayField16[si], bl);
38 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
41 StretchedSprites.BltEx(X, Y, aniExplosion[bl]);
42 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
46 ExplosionShake = 0; // nothing explodes
49 return subAnimateExplosion;
51 loc_g_28D0: // explosion produces infotron
55 PlayField16[si] = fiInfotron;
56 MovLowByte(&ExplosionShake, 0); // nothing explodes
57 return subAnimateExplosion;
60 MovHighByte(&PlayField16[si], bl);
61 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
64 StretchedSprites.BltEx(X, Y, aniExplosionInfo + bl - 0x80);
65 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
67 return subAnimateExplosion;
68 } // subAnimateExplosion
70 // ==========================================================================
73 // ==========================================================================
75 void ExplodeFieldSP(int si)
77 // int ax, al, cx, dl, dh;
80 ax = LowByte(PlayField16[si]);
84 ExplosionShake = 1; // something explodes
88 printf("::: Explosions.c: ExplodeFieldSP(): killing murphy\n");
96 cx = 0x801F; // produce infotrons
101 cx = 0x1F; // normal explosion
105 LetExplodeFieldSP(si - FieldWidth - 1, cx, dl);
106 LetExplodeFieldSP(si - FieldWidth, cx, dl);
107 LetExplodeFieldSP(si - FieldWidth + 1, cx, dl);
108 LetExplodeFieldSP(si - 1, cx, dl);
109 PlayField16[si] = cx;
110 LetExplodeFieldSP(si + 1, cx, dl);
111 LetExplodeFieldSP(si + FieldWidth - 1, cx, dl);
112 LetExplodeFieldSP(si + FieldWidth, cx, dl);
113 LetExplodeFieldSP(si + FieldWidth + 1, cx, dl);
116 subSoundFXExplosion();
119 static void LetExplodeFieldSP(int tsi, int cx, int dh)
123 if (tsi < (-FieldWidth))
126 al = LowByte(PlayField16[tsi]);
137 PlayField8[tsi] = dh;
138 PlayField16[tsi] = cx;
142 subExplodeZonk(tsi, cx);
146 subExplodeInfotron(tsi, cx);
150 PlayField8[tsi] = (-dh) & 0xFF;
151 PlayField16[tsi] = 0x801F;
156 printf("::: Explosions.c: LetExplodeFieldSP(): killing murphy [%d]\n",
161 PlayField8[tsi] = dh;
162 PlayField16[tsi] = cx;
166 PlayField16[tsi] = cx;
171 static int subExplodeZonk(int tsi, int cx)
173 static int subExplodeZonk;
177 ah = HighByte(PlayField16[tsi]) & 0xF0;
178 PlayField16[tsi] = cx;
183 subClearFieldDueToExplosion(tsi - FieldWidth);
184 tsi = tsi + FieldWidth;
185 if (PlayField16[tsi] == 0x9999)
186 subClearFieldDueToExplosion(tsi);
191 subClearFieldDueToExplosion(tsi + 1);
192 subClearFieldDueToExplosion(tsi + FieldWidth);
196 subClearFieldDueToExplosion(tsi - 1);
197 subClearFieldDueToExplosion(tsi + FieldWidth);
201 subClearFieldDueToExplosion(tsi - 1);
205 subClearFieldDueToExplosion(tsi + 1);
208 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
209 subClearFieldDueToExplosion(tsi + FieldWidth);
213 return subExplodeZonk;
216 static int subExplodeInfotron(int tsi, int cx)
218 static int subExplodeInfotron;
222 ah = HighByte(PlayField16[tsi]) & 0xF0;
223 PlayField16[tsi] = cx;
228 subClearFieldDueToExplosion(tsi - FieldWidth);
229 tsi = tsi + FieldWidth;
230 if (PlayField16[tsi] == 0x9999)
231 subClearFieldDueToExplosion(tsi);
236 subClearFieldDueToExplosion(tsi + 1);
237 tsi = tsi + FieldWidth; // differnt from zonk version
238 if (PlayField16[tsi] == 0x9999)
239 subClearFieldDueToExplosion(tsi);
244 subClearFieldDueToExplosion(tsi - 1);
245 tsi = tsi + FieldWidth; // differnt from zonk version
246 if (PlayField16[tsi] == 0x9999)
247 subClearFieldDueToExplosion(tsi);
252 subClearFieldDueToExplosion(tsi - 1);
256 subClearFieldDueToExplosion(tsi + 1);
259 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
260 subClearFieldDueToExplosion(tsi + FieldWidth);
264 return subExplodeInfotron;
265 } // subExplodeInfotron
267 int subClearFieldDueToExplosion(int si)
269 int subClearFieldDueToExplosion;
273 if (LowByte(PlayField16[si]) == fiExplosion)
274 return subClearFieldDueToExplosion;
277 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
280 StretchedSprites.BltEx(X, Y, fiSpace);
281 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
283 return subClearFieldDueToExplosion;
284 } // subClearFieldDueToExplosion
286 int subRedDiskReleaseExplosion()
288 int subRedDiskReleaseExplosion;
292 al = RedDiskReleasePhase; // Red disk release phase
294 return subRedDiskReleaseExplosion;
296 si = RedDiskReleaseMurphyPos;
297 if (PlayField16[si] == 0) // Release red disk
298 PlayField16[si] = fiRedDisk;
300 // +++++++++++++++++++++++++++++++++++++++++
303 StretchedSprites.BltEx(X, Y, fiRedDisk);
304 // +++++++++++++++++++++++++++++++++++++++++
305 RedDiskReleasePhase = RedDiskReleasePhase + 1;
306 if (RedDiskReleasePhase >= 0x28)
308 // si = RedDiskReleaseMurphyPos ' Red disk was released here
309 ExplodeFieldSP(si); // Explode
310 RedDiskReleasePhase = 0;
313 return subRedDiskReleaseExplosion;
316 int subFollowUpExplosions()
318 int subFollowUpExplosions;
323 for (si = 0; si <= LevelMax; si++)
325 ax = ByteToInt(PlayField8[si]);
331 PlayField8[si] = ax & 0xFF;
334 PlayField16[si] = 0xFF18;
335 ExplodeFieldSP(si); // Explode
349 return subFollowUpExplosions;
350 } // subFollowUpExplosions