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(): kill 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(): kill murphy\n");
160 PlayField8[tsi] = dh;
161 PlayField16[tsi] = cx;
165 PlayField16[tsi] = cx;
170 static int subExplodeZonk(int tsi, int cx)
172 static int subExplodeZonk;
176 ah = HighByte(PlayField16[tsi]) & 0xF0;
177 PlayField16[tsi] = cx;
182 subClearFieldDueToExplosion(tsi - FieldWidth);
183 tsi = tsi + FieldWidth;
184 if (PlayField16[tsi] == 0x9999)
185 subClearFieldDueToExplosion(tsi);
190 subClearFieldDueToExplosion(tsi + 1);
191 subClearFieldDueToExplosion(tsi + FieldWidth);
195 subClearFieldDueToExplosion(tsi - 1);
196 subClearFieldDueToExplosion(tsi + FieldWidth);
200 subClearFieldDueToExplosion(tsi - 1);
204 subClearFieldDueToExplosion(tsi + 1);
207 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
208 subClearFieldDueToExplosion(tsi + FieldWidth);
212 return subExplodeZonk;
215 static int subExplodeInfotron(int tsi, int cx)
217 static int subExplodeInfotron;
221 ah = HighByte(PlayField16[tsi]) & 0xF0;
222 PlayField16[tsi] = cx;
227 subClearFieldDueToExplosion(tsi - FieldWidth);
228 tsi = tsi + FieldWidth;
229 if (PlayField16[tsi] == 0x9999)
230 subClearFieldDueToExplosion(tsi);
235 subClearFieldDueToExplosion(tsi + 1);
236 tsi = tsi + FieldWidth; // differnt from zonk version
237 if (PlayField16[tsi] == 0x9999)
238 subClearFieldDueToExplosion(tsi);
243 subClearFieldDueToExplosion(tsi - 1);
244 tsi = tsi + FieldWidth; // differnt from zonk version
245 if (PlayField16[tsi] == 0x9999)
246 subClearFieldDueToExplosion(tsi);
251 subClearFieldDueToExplosion(tsi - 1);
255 subClearFieldDueToExplosion(tsi + 1);
258 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
259 subClearFieldDueToExplosion(tsi + FieldWidth);
263 return subExplodeInfotron;
264 } // subExplodeInfotron
266 int subClearFieldDueToExplosion(int si)
268 int subClearFieldDueToExplosion;
272 if (LowByte(PlayField16[si]) == fiExplosion)
273 return subClearFieldDueToExplosion;
276 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
279 StretchedSprites.BltEx(X, Y, fiSpace);
280 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
282 return subClearFieldDueToExplosion;
283 } // subClearFieldDueToExplosion
285 int subRedDiskReleaseExplosion()
287 int subRedDiskReleaseExplosion;
291 al = RedDiskReleasePhase; // Red disk release phase
293 return subRedDiskReleaseExplosion;
295 si = RedDiskReleaseMurphyPos;
296 if (PlayField16[si] == 0) // Release red disk
297 PlayField16[si] = fiRedDisk;
299 // +++++++++++++++++++++++++++++++++++++++++
302 StretchedSprites.BltEx(X, Y, fiRedDisk);
303 // +++++++++++++++++++++++++++++++++++++++++
304 RedDiskReleasePhase = RedDiskReleasePhase + 1;
305 if (RedDiskReleasePhase >= 0x28)
307 // si = RedDiskReleaseMurphyPos ' Red disk was released here
308 ExplodeFieldSP(si); // Explode
309 RedDiskReleasePhase = 0;
312 return subRedDiskReleaseExplosion;
315 int subFollowUpExplosions()
317 int 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
348 return subFollowUpExplosions;
349 } // subFollowUpExplosions