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;
24 if (LowByte(PlayField16[si]) != fiExplosion)
25 return subAnimateExplosion;
29 return subAnimateExplosion;
31 bl = HighByte(PlayField16[si]);
32 if ((bl & 0x80) != 0) // infotron explosion!
36 MovHighByte(&PlayField16[si], bl);
37 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
40 StretchedSprites.BltEx(X, Y, aniExplosion[bl]);
41 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
45 ExplosionShake = 0; // nothing explodes
48 return subAnimateExplosion;
50 loc_g_28D0: // explosion produces infotron
54 PlayField16[si] = fiInfotron;
55 MovLowByte(&ExplosionShake, 0); // nothing explodes
56 return subAnimateExplosion;
59 MovHighByte(&PlayField16[si], bl);
60 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
63 StretchedSprites.BltEx(X, Y, aniExplosionInfo + bl - 0x80);
64 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
66 return subAnimateExplosion;
67 } // subAnimateExplosion
69 // ==========================================================================
72 // ==========================================================================
74 void ExplodeFieldSP(int si)
76 int ax, al, cx, dl, dh;
78 ax = LowByte(PlayField16[si]);
82 ExplosionShake = 1; // something explodes
88 cx = 0x801F; // produce infotrons
93 cx = 0x1F; // normal explosion
97 LetExplodeFieldSP(si - FieldWidth - 1, cx, dl);
98 LetExplodeFieldSP(si - FieldWidth, cx, dl);
99 LetExplodeFieldSP(si - FieldWidth + 1, cx, dl);
100 LetExplodeFieldSP(si - 1, cx, dl);
101 PlayField16[si] = cx;
102 LetExplodeFieldSP(si + 1, cx, dl);
103 LetExplodeFieldSP(si + FieldWidth - 1, cx, dl);
104 LetExplodeFieldSP(si + FieldWidth, cx, dl);
105 LetExplodeFieldSP(si + FieldWidth + 1, cx, dl);
108 subSoundFXExplosion();
111 static void LetExplodeFieldSP(int tsi, int cx, int dh)
115 if (tsi < (-FieldWidth))
118 al = LowByte(PlayField16[tsi]);
129 PlayField8[tsi] = dh;
130 PlayField16[tsi] = cx;
134 subExplodeZonk(tsi, cx);
138 subExplodeInfotron(tsi, cx);
142 PlayField8[tsi] = (-dh) & 0xFF;
143 PlayField16[tsi] = 0x801F;
148 PlayField8[tsi] = dh;
149 PlayField16[tsi] = cx;
153 PlayField16[tsi] = cx;
158 static int subExplodeZonk(int tsi, int cx)
160 static int subExplodeZonk;
164 ah = HighByte(PlayField16[tsi]) & 0xF0;
165 PlayField16[tsi] = cx;
170 subClearFieldDueToExplosion(tsi - FieldWidth);
171 tsi = tsi + FieldWidth;
172 if (PlayField16[tsi] == 0x9999)
173 subClearFieldDueToExplosion(tsi);
178 subClearFieldDueToExplosion(tsi + 1);
179 subClearFieldDueToExplosion(tsi + FieldWidth);
183 subClearFieldDueToExplosion(tsi - 1);
184 subClearFieldDueToExplosion(tsi + FieldWidth);
188 subClearFieldDueToExplosion(tsi - 1);
192 subClearFieldDueToExplosion(tsi + 1);
195 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
196 subClearFieldDueToExplosion(tsi + FieldWidth);
200 return subExplodeZonk;
203 static int subExplodeInfotron(int tsi, int cx)
205 static int subExplodeInfotron;
209 ah = HighByte(PlayField16[tsi]) & 0xF0;
210 PlayField16[tsi] = cx;
215 subClearFieldDueToExplosion(tsi - FieldWidth);
216 tsi = tsi + FieldWidth;
217 if (PlayField16[tsi] == 0x9999)
218 subClearFieldDueToExplosion(tsi);
223 subClearFieldDueToExplosion(tsi + 1);
224 tsi = tsi + FieldWidth; // differnt from zonk version
225 if (PlayField16[tsi] == 0x9999)
226 subClearFieldDueToExplosion(tsi);
231 subClearFieldDueToExplosion(tsi - 1);
232 tsi = tsi + FieldWidth; // differnt from zonk version
233 if (PlayField16[tsi] == 0x9999)
234 subClearFieldDueToExplosion(tsi);
239 subClearFieldDueToExplosion(tsi - 1);
243 subClearFieldDueToExplosion(tsi + 1);
246 case 0xFF000070: // !!! 0x70; this will never be reached! ...??
247 subClearFieldDueToExplosion(tsi + FieldWidth);
251 return subExplodeInfotron;
252 } // subExplodeInfotron
254 int subClearFieldDueToExplosion(int si)
256 int subClearFieldDueToExplosion;
260 if (LowByte(PlayField16[si]) == fiExplosion)
261 return subClearFieldDueToExplosion;
264 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
267 StretchedSprites.BltEx(X, Y, fiSpace);
268 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
270 return subClearFieldDueToExplosion;
271 } // subClearFieldDueToExplosion
273 int subRedDiskReleaseExplosion()
275 int subRedDiskReleaseExplosion;
279 al = RedDiskReleasePhase; // Red disk release phase
281 return subRedDiskReleaseExplosion;
283 si = RedDiskReleaseMurphyPos;
284 if (PlayField16[si] == 0) // Release red disk
285 PlayField16[si] = fiRedDisk;
287 // +++++++++++++++++++++++++++++++++++++++++
290 StretchedSprites.BltEx(X, Y, fiRedDisk);
291 // +++++++++++++++++++++++++++++++++++++++++
292 RedDiskReleasePhase = RedDiskReleasePhase + 1;
293 if (RedDiskReleasePhase >= 0x28)
295 // si = RedDiskReleaseMurphyPos ' Red disk was released here
296 ExplodeFieldSP(si); // Explode
297 RedDiskReleasePhase = 0;
300 return subRedDiskReleaseExplosion;
303 int subFollowUpExplosions()
305 int subFollowUpExplosions;
310 for (si = 0; si <= LevelMax; si++)
312 ax = ByteToInt(PlayField8[si]);
318 PlayField8[si] = ax & 0xFF;
321 PlayField16[si] = 0xFF18;
322 ExplodeFieldSP(si); // Explode
336 return subFollowUpExplosions;
337 } // subFollowUpExplosions