1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
8 void subCleanUpForZonksAbove(int si);
11 // static char *VB_Name = "modZonk";
12 // --- Option Explicit
14 // ==========================================================================
16 // Animate Zonks (falling)
17 // ==========================================================================
19 void subAnimateZonks(int si)
24 // int ax, bx, cx, dx, di, X, Y;
26 // int ah, bh, ch, dh, al, bl, cl, dl;
29 tFld = PlayField16[si];
30 if ((tFld & 0xFF) != fiZonk)
35 if (FreezeZonks == 2) // Do Zonks fall? (debug)
38 ax = PlayField16[si + FieldWidth]; // select case playfield16(si+60)
53 loc_g_0D35: // Case fiZonk, fiInfotron, fiRAM
54 ax = PlayField16[si + FieldWidth - 1];
55 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA)
59 ax = PlayField16[si + FieldWidth + 1];
60 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA)
65 loc_g_0D64: // Case fiSpace
66 MovHighByte(&PlayField16[si], 0x40);
69 loc_g_0D6B: // roll left?
70 if (PlayField16[si - 1] == 0)
76 MovHighByte(&PlayField16[si], 0x50);
77 PlayField16[si - 1] = 0x8888;
80 loc_g_0D81: // roll right?
81 if (PlayField16[si + 1] == 0)
84 if (PlayField16[si + 1] != 0x9999) // wow right is different from left!
87 if (LowByte(PlayField16[si - FieldWidth + 1]) != 1)
91 MovHighByte(&PlayField16[si], 0x60);
92 PlayField16[si + 1] = 0x8888;
96 // from now on the zonk is definitely moving,
97 // maybe the sequence is in an advanced frame
98 // or just beeing initialized due to the code above
99 bl = HighByte(PlayField16[si]);
103 if (al == 0x10) // zonk comes falling from above
106 if (al == 0x20) // zonk comes rolling from right to left
109 if (al == 0x30) // zonk comes rolling from left to right
112 if (FreezeZonks == 2)
115 if (al == 0x40) // zonk falls straight down
118 if (al == 0x50) // zonk rolls left
121 if (al == 0x60) // zonk rolls right
124 if (al == 0x70) // intermediate state
129 loc_g_0DE8: // zonk comes falling from above
130 // To Do: draw zonk falling from above
131 // according to position in (bl And &H07)
132 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
134 Y = GetStretchY(si - FieldWidth);
136 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
137 DDSpriteBuffer_BltImg(X, Y + TwoPixels * (dx + 1), aniZonk, dx);
138 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
140 bl = HighByte(PlayField16[si]) + 1;
143 MovHighByte(&PlayField16[si], bl);
144 subCleanUpForZonksAbove(si - FieldWidth);
150 MovHighByte(&PlayField16[si], bl);
154 MovHighByte(&PlayField16[si], 0); // zonk arrived at the field
155 if ((FreezeZonks & 0xFF) == 2)
158 // loc_g_0E42: // now check if the zonk may go on falling somehow
159 ax = PlayField16[si + FieldWidth];
160 if (ax == 0) // below is empty!-> go on falling 'loc_g_0E4C:
163 if (ax == 0x9999) // below is only temporarily used ' loc_g_0E57:
166 if ((ax & 0xFF) == fiMurphy) // Murphy dies 'loc_g_0E61:
169 if ((ax & 0xFF) == fiSnikSnak) // SnikSnak dies 'loc_g_0E6B:
172 if (ax == 0x2BB) // loc_g_0E76:
175 if (ax == 0x4BB) // loc_g_0E81:
178 if ((ax & 0xFF) == fiElectron) // Electron cracked! 'loc_g_0E8B:
181 if (ax == fiOrangeDisk) // OrangeDisk explodes 'loc_g_0E95:
184 // play the zonk sound, 'cause zonk hits something "hard"
185 subSoundFX(si, fiZonk, actImpact);
187 if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM))
190 // loc_g_0EAE: ' Zonk rolls somewhere
191 ax = PlayField16[si + FieldWidth - 1];
192 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll left
195 ax = PlayField16[si + FieldWidth + 1];
196 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll right
201 loc_g_0EDD: // go on falling down?
202 PlayField16[si] = 0x7001; // go into intermediate waitstate
203 PlayField16[si + FieldWidth] = 0x9999; // mark as "zonk waiting to access"
206 loc_g_0EEA: // test if zonk may roll left
207 // This if(if true) jumps up far above
208 // to the according rountine for fixed zonks!
209 if (PlayField16[si - 1] != 0) // Remarkable!!! ' loc_g_0EF4:
212 MovHighByte(&PlayField16[si], 0x50); // zonk rolls left
213 PlayField16[si - 1] = 0x8888; // mark as zonk accessing?
216 loc_g_0F00: // test if zonk may roll right
217 if (PlayField16[si + 1] != 0) // loc_g_0F08:
220 MovHighByte(&PlayField16[si], 0x60); // zonk rolls right
221 PlayField16[si + 1] = 0x8888; // mark as zonk accessing?
224 loc_g_0F14: // Murphy dies, but not in any case
225 bl = HighByte(PlayField16[si + FieldWidth]);
226 if (bl == 0xE || bl == 0xF || bl == 0x28)
229 if (bl == 0x29 || bl == 0x25 || bl == 0x26)
233 ax = LowByte(PlayField16[si + FieldWidth - 1]);
234 if (ax == fiElectron) // loc_g_0F43:
235 PlayField16[si + FieldWidth] = fiElectron;
238 PlayField16[si + FieldWidth - 1] = 0;
243 ax = LowByte(PlayField16[si + FieldWidth + 1]);
244 if (ax == fiElectron) // loc_g_0F5F:
245 PlayField16[si + FieldWidth] = fiElectron;
248 PlayField16[si + FieldWidth + 1] = 0;
252 loc_g_0F6E: // someone dies/explodes
253 si = si + FieldWidth; // 1 field down
254 ExplodeFieldSP(si); // Explode
257 loc_g_0F75: // OrangeDisk explodes next cycle
258 si = si + FieldWidth; // 1 field down
259 PlayField8[si] = fiHardWare;
262 loc_g_0F83: // zonk comes rolling from right to left
263 // To Do: draw zonk rolling from right
264 // according to position in (bl And &H07)
265 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
266 X = GetStretchX(si + 1);
269 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
270 DDSpriteBuffer_BltImg(X - (TwoPixels * dx), Y, aniZonkRollLeft, dx - 1);
271 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
273 bl = HighByte(PlayField16[si]) + 1; // get and increment sequence#
275 PlayField16[si + 1] = 0xAAAA;
279 MovHighByte(&PlayField16[si], bl);
280 subCleanUpForZonksAbove(si + 1);
284 MovHighByte(&PlayField16[si], bl);
288 PlayField16[si] = 0xFFFF;
289 si = si + FieldWidth; // 1 field down
290 PlayField16[si] = 0x1001; // convert rolling zonk to a falling zonk
295 loc_g_0FE8: // zonk comes rolling from left to right
296 // To Do: draw zonk rolling from left
297 // according to position in (bl And &H07)
298 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
299 X = GetStretchX(si - 1);
302 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
303 DDSpriteBuffer_BltImg(X + (TwoPixels * dx), Y, aniZonkRollRight, dx - 1);
304 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
306 bl = HighByte(PlayField16[si]) + 1;
308 PlayField16[si - 1] = 0xAAAA;
312 MovHighByte(&PlayField16[si], bl);
313 subCleanUpForZonksAbove(si - 1);
317 MovHighByte(&PlayField16[si], bl);
321 PlayField16[si] = 0xFFFF;
322 si = si + FieldWidth; // 1 field down
323 PlayField16[si] = 0x1001; // convert rolling zonk to a falling zonk
328 loc_g_104D: // zonk falls straight down
332 MovHighByte(&PlayField16[si], bl);
334 else if (PlayField16[si + FieldWidth] != 0)
336 bl = bl - 1; // stay waiting
337 MovHighByte(&PlayField16[si], bl);
341 PlayField16[si] = 0xFFFF; // mark as "zonk leaving"
342 si = si + FieldWidth; // 1 field down
343 PlayField16[si] = 0x1001; // go falling
348 loc_g_107B: // zonk rolls left
349 // To Do: draw zonk rolling to left
350 // according to position in (bl And &H0F)
351 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
355 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
356 DDSpriteBuffer_BltImg(X - (TwoPixels * dx), Y, aniZonkRollLeft, dx - 1);
357 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
359 bl = HighByte(PlayField16[si]) + 1; // retrieve and increment sequence#
362 MovHighByte(&PlayField16[si], bl);
366 if (PlayField16[si + FieldWidth - 1] != 0)
369 if (PlayField16[si - 1] != 0)
371 if (PlayField16[si - 1] != 0x8888)
375 PlayField16[si] = 0xFFFF;
376 si = si - 1; // 1 field left
377 PlayField16[si] = 0x2201;
378 PlayField16[si + FieldWidth] = 0xFFFF;
381 loc_g_10E2: // stay waiting
383 MovHighByte(&PlayField16[si], bl);
386 loc_g_10E9: // zonk rolls right
387 // To Do: draw zonk rolling to right
388 // according to position in (bl And &H07)
389 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
393 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
394 DDSpriteBuffer_BltImg(X + (TwoPixels * dx), Y, aniZonkRollRight, dx - 1);
395 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
397 bl = HighByte(PlayField16[si]) + 1;
400 MovHighByte(&PlayField16[si], bl);
404 if (PlayField16[si + FieldWidth + 1] != 0)
407 if (PlayField16[si + 1] != 0)
409 if (PlayField16[si + 1] != 0x8888)
413 PlayField16[si] = 0xFFFF;
415 PlayField16[si] = 0x3201;
416 PlayField16[si + FieldWidth] = 0xFFFF;
419 loc_g_1150: // stay waiting
421 MovHighByte(&PlayField16[si], bl);
424 loc_g_1157: // intermediate state
425 ax = PlayField16[si + FieldWidth];
426 if (ax == 0 || ax == 0x9999)
428 PlayField16[si] = 0xFFFF;
429 si = si + FieldWidth; // 1 field down
430 PlayField16[si] = 0x1001; // start falling down
435 } // subAnimateZonks endp
437 void subCleanUpForZonksAbove(int si)
441 if (LowByte(PlayField16[si]) != fiExplosion)
444 if (PlayField16[si - FieldWidth] != 0)
446 if (PlayField16[si - FieldWidth] != 0x9999)
449 if (LowByte(PlayField16[si - 2 * FieldWidth]) != fiInfotron)
453 if (PlayField16[si - FieldWidth - 1] != fiZonk)
455 if (PlayField16[si - FieldWidth + 1] != fiZonk)
461 ax = PlayField16[si - 1];
462 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
464 PlayField16[si - FieldWidth - 1] = 0x6001;
465 PlayField16[si - FieldWidth] = 0x8888;
469 if (PlayField16[si - FieldWidth + 1] != fiZonk)
473 ax = PlayField16[si + 1];
474 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
476 PlayField16[si - FieldWidth + 1] = 0x5001;
477 PlayField16[si - FieldWidth] = 0x8888;
481 } // subCleanUpForZonksAbove