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]);
34 printf("::: subAnimateExplosion: %d [%d, %d] [%d]\n",
35 bl, PlayField16[si], si, FrameCounter);
37 if ((bl & 0x80) != 0) // infotron explosion!
41 MovHighByte(&PlayField16[si], bl);
42 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
45 StretchedSprites.BltEx(X, Y, aniFramesExplosion[bl]);
46 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
50 ExplosionShake = 0; // nothing explodes
53 return subAnimateExplosion;
55 loc_g_28D0: // explosion produces infotron
59 PlayField16[si] = fiInfotron;
60 MovLowByte(&ExplosionShake, 0); // nothing explodes
61 return subAnimateExplosion;
64 MovHighByte(&PlayField16[si], bl);
65 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
68 StretchedSprites.BltEx(X, Y, aniExplosionInfo + bl - 0x80);
69 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
71 return subAnimateExplosion;
72 } // subAnimateExplosion
74 // ==========================================================================
77 // ==========================================================================
79 void ExplodeFieldSP(int si)
81 // int ax, al, cx, dl, dh;
84 ax = LowByte(PlayField16[si]);
88 ExplosionShake = 1; // something explodes
92 printf("::: Explosions.c: ExplodeFieldSP(): killing murphy\n");
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);
120 subSoundFXExplosion();
123 static void LetExplodeFieldSP(int tsi, int cx, int dh)
127 if (tsi < (-FieldWidth))
130 al = LowByte(PlayField16[tsi]);
132 printf("::: LetExplodeFieldSP: got %d [%d, %d] [%d]\n",
133 al, PlayField16[tsi], tsi, FrameCounter);
145 PlayField8[tsi] = dh;
146 PlayField16[tsi] = cx;
150 subExplodeZonk(tsi, cx);
154 subExplodeInfotron(tsi, cx);
158 PlayField8[tsi] = (-dh) & 0xFF;
159 PlayField16[tsi] = 0x801F;
164 printf("::: Explosions.c: LetExplodeFieldSP(): killing murphy [%d]\n",
169 PlayField8[tsi] = dh;
170 PlayField16[tsi] = cx;
174 PlayField16[tsi] = cx;
178 GfxGraphic[GetX(tsi)][GetY(tsi)] = -1;
181 static int subExplodeZonk(int tsi, int cx)
183 static int subExplodeZonk;
187 ah = HighByte(PlayField16[tsi]) & 0xF0;
188 PlayField16[tsi] = cx;
193 subClearFieldDueToExplosion(tsi - FieldWidth);
194 tsi = tsi + FieldWidth;
195 if (PlayField16[tsi] == 0x9999)
196 subClearFieldDueToExplosion(tsi);
201 subClearFieldDueToExplosion(tsi + 1);
202 subClearFieldDueToExplosion(tsi + FieldWidth);
206 subClearFieldDueToExplosion(tsi - 1);
207 subClearFieldDueToExplosion(tsi + FieldWidth);
211 subClearFieldDueToExplosion(tsi - 1);
215 subClearFieldDueToExplosion(tsi + 1);
218 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
219 subClearFieldDueToExplosion(tsi + FieldWidth);
223 return subExplodeZonk;
226 static int subExplodeInfotron(int tsi, int cx)
228 static int subExplodeInfotron;
232 ah = HighByte(PlayField16[tsi]) & 0xF0;
233 PlayField16[tsi] = cx;
238 subClearFieldDueToExplosion(tsi - FieldWidth);
239 tsi = tsi + FieldWidth;
240 if (PlayField16[tsi] == 0x9999)
241 subClearFieldDueToExplosion(tsi);
246 subClearFieldDueToExplosion(tsi + 1);
247 tsi = tsi + FieldWidth; // differnt from zonk version
248 if (PlayField16[tsi] == 0x9999)
249 subClearFieldDueToExplosion(tsi);
254 subClearFieldDueToExplosion(tsi - 1);
255 tsi = tsi + FieldWidth; // differnt from zonk version
256 if (PlayField16[tsi] == 0x9999)
257 subClearFieldDueToExplosion(tsi);
262 subClearFieldDueToExplosion(tsi - 1);
266 subClearFieldDueToExplosion(tsi + 1);
269 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
270 subClearFieldDueToExplosion(tsi + FieldWidth);
274 return subExplodeInfotron;
275 } // subExplodeInfotron
277 int subClearFieldDueToExplosion(int si)
279 int subClearFieldDueToExplosion;
283 if (LowByte(PlayField16[si]) == fiExplosion)
284 return subClearFieldDueToExplosion;
287 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
290 StretchedSprites.BltEx(X, Y, fiSpace);
291 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
293 return subClearFieldDueToExplosion;
294 } // subClearFieldDueToExplosion
296 int subRedDiskReleaseExplosion()
298 int subRedDiskReleaseExplosion;
302 al = RedDiskReleasePhase; // Red disk release phase
304 return subRedDiskReleaseExplosion;
306 si = RedDiskReleaseMurphyPos;
307 if (PlayField16[si] == 0) // Release red disk
308 PlayField16[si] = fiRedDisk;
310 // +++++++++++++++++++++++++++++++++++++++++
313 StretchedSprites.BltEx(X, Y, fiRedDisk);
314 // +++++++++++++++++++++++++++++++++++++++++
315 RedDiskReleasePhase = RedDiskReleasePhase + 1;
316 if (RedDiskReleasePhase >= 0x28)
318 // si = RedDiskReleaseMurphyPos ' Red disk was released here
319 ExplodeFieldSP(si); // Explode
320 RedDiskReleasePhase = 0;
323 return subRedDiskReleaseExplosion;
326 int subFollowUpExplosions()
328 int subFollowUpExplosions;
333 for (si = 0; si <= LevelMax; si++)
335 ax = ByteToInt(PlayField8[si]);
341 PlayField8[si] = ax & 0xFF;
344 PlayField16[si] = 0xFF18;
345 ExplodeFieldSP(si); // Explode
359 return subFollowUpExplosions;
360 } // subFollowUpExplosions