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:
185 // play the zonk sound, 'cause zonk hits something "hard"
186 subSoundFX(si, fiZonk, actImpact);
188 subSoundFXZonk(); // play the zonk sound,'cause zonk hits something "hard"
191 if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM))
194 // loc_g_0EAE: ' Zonk rolls somewhere
195 ax = PlayField16[si + FieldWidth - 1];
196 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll left
199 ax = PlayField16[si + FieldWidth + 1];
200 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll right
205 loc_g_0EDD: // go on falling down?
206 PlayField16[si] = 0x7001; // go into intermediate waitstate
207 PlayField16[si + FieldWidth] = 0x9999; // mark as "zonk waiting to access"
210 loc_g_0EEA: // test if zonk may roll left
211 // This if(if true) jumps up far above
212 // to the according rountine for fixed zonks!
213 if (PlayField16[si - 1] != 0) // Remarkable!!! ' loc_g_0EF4:
216 MovHighByte(&PlayField16[si], 0x50); // zonk rolls left
217 PlayField16[si - 1] = 0x8888; // mark as zonk accessing?
220 loc_g_0F00: // test if zonk may roll right
221 if (PlayField16[si + 1] != 0) // loc_g_0F08:
224 MovHighByte(&PlayField16[si], 0x60); // zonk rolls right
225 PlayField16[si + 1] = 0x8888; // mark as zonk accessing?
228 loc_g_0F14: // Murphy dies, but not in any case
229 bl = HighByte(PlayField16[si + FieldWidth]);
230 if (bl == 0xE || bl == 0xF || bl == 0x28)
233 if (bl == 0x29 || bl == 0x25 || bl == 0x26)
237 ax = LowByte(PlayField16[si + FieldWidth - 1]);
238 if (ax == fiElectron) // loc_g_0F43:
239 PlayField16[si + FieldWidth] = fiElectron;
242 PlayField16[si + FieldWidth - 1] = 0;
247 ax = LowByte(PlayField16[si + FieldWidth + 1]);
248 if (ax == fiElectron) // loc_g_0F5F:
249 PlayField16[si + FieldWidth] = fiElectron;
252 PlayField16[si + FieldWidth + 1] = 0;
256 loc_g_0F6E: // someone dies/explodes
257 si = si + FieldWidth; // 1 field down
258 ExplodeFieldSP(si); // Explode
261 loc_g_0F75: // OrangeDisk explodes next cycle
262 si = si + FieldWidth; // 1 field down
263 PlayField8[si] = fiHardWare;
266 loc_g_0F83: // zonk comes rolling from right to left
267 // To Do: draw zonk rolling from right
268 // according to position in (bl And &H07)
269 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
270 X = GetStretchX(si + 1);
273 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
274 DDSpriteBuffer_BltImg(X - (TwoPixels * dx), Y, aniZonkRollLeft, dx - 1);
275 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
277 bl = HighByte(PlayField16[si]) + 1; // get and increment sequence#
279 PlayField16[si + 1] = 0xAAAA;
283 MovHighByte(&PlayField16[si], bl);
284 subCleanUpForZonksAbove(si + 1);
288 MovHighByte(&PlayField16[si], bl);
292 PlayField16[si] = 0xFFFF;
293 si = si + FieldWidth; // 1 field down
294 PlayField16[si] = 0x1001; // convert rolling zonk to a falling zonk
299 loc_g_0FE8: // zonk comes rolling from left to right
300 // To Do: draw zonk rolling from left
301 // according to position in (bl And &H07)
302 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
303 X = GetStretchX(si - 1);
306 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
307 DDSpriteBuffer_BltImg(X + (TwoPixels * dx), Y, aniZonkRollRight, dx - 1);
308 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
310 bl = HighByte(PlayField16[si]) + 1;
312 PlayField16[si - 1] = 0xAAAA;
316 MovHighByte(&PlayField16[si], bl);
317 subCleanUpForZonksAbove(si - 1);
321 MovHighByte(&PlayField16[si], bl);
325 PlayField16[si] = 0xFFFF;
326 si = si + FieldWidth; // 1 field down
327 PlayField16[si] = 0x1001; // convert rolling zonk to a falling zonk
332 loc_g_104D: // zonk falls straight down
336 MovHighByte(&PlayField16[si], bl);
338 else if (PlayField16[si + FieldWidth] != 0)
340 bl = bl - 1; // stay waiting
341 MovHighByte(&PlayField16[si], bl);
345 PlayField16[si] = 0xFFFF; // mark as "zonk leaving"
346 si = si + FieldWidth; // 1 field down
347 PlayField16[si] = 0x1001; // go falling
352 loc_g_107B: // zonk rolls left
353 // To Do: draw zonk rolling to left
354 // according to position in (bl And &H0F)
355 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
359 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
360 DDSpriteBuffer_BltImg(X - (TwoPixels * dx), Y, aniZonkRollLeft, dx - 1);
361 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
363 bl = HighByte(PlayField16[si]) + 1; // retrieve and increment sequence#
366 MovHighByte(&PlayField16[si], bl);
370 if (PlayField16[si + FieldWidth - 1] != 0)
373 if (PlayField16[si - 1] != 0)
375 if (PlayField16[si - 1] != 0x8888)
379 PlayField16[si] = 0xFFFF;
380 si = si - 1; // 1 field left
381 PlayField16[si] = 0x2201;
382 PlayField16[si + FieldWidth] = 0xFFFF;
385 loc_g_10E2: // stay waiting
387 MovHighByte(&PlayField16[si], bl);
390 loc_g_10E9: // zonk rolls right
391 // To Do: draw zonk rolling to right
392 // according to position in (bl And &H07)
393 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
397 DDSpriteBuffer_BltImg(X, Y, aniSpace, 0);
398 DDSpriteBuffer_BltImg(X + (TwoPixels * dx), Y, aniZonkRollRight, dx - 1);
399 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
401 bl = HighByte(PlayField16[si]) + 1;
404 MovHighByte(&PlayField16[si], bl);
408 if (PlayField16[si + FieldWidth + 1] != 0)
411 if (PlayField16[si + 1] != 0)
413 if (PlayField16[si + 1] != 0x8888)
417 PlayField16[si] = 0xFFFF;
419 PlayField16[si] = 0x3201;
420 PlayField16[si + FieldWidth] = 0xFFFF;
423 loc_g_1150: // stay waiting
425 MovHighByte(&PlayField16[si], bl);
428 loc_g_1157: // intermediate state
429 ax = PlayField16[si + FieldWidth];
430 if (ax == 0 || ax == 0x9999)
432 PlayField16[si] = 0xFFFF;
433 si = si + FieldWidth; // 1 field down
434 PlayField16[si] = 0x1001; // start falling down
439 } // subAnimateZonks endp
441 void subCleanUpForZonksAbove(int si)
445 if (LowByte(PlayField16[si]) != fiExplosion)
448 if (PlayField16[si - FieldWidth] != 0)
450 if (PlayField16[si - FieldWidth] != 0x9999)
453 if (LowByte(PlayField16[si - 2 * FieldWidth]) != fiInfotron)
457 if (PlayField16[si - FieldWidth - 1] != fiZonk)
459 if (PlayField16[si - FieldWidth + 1] != fiZonk)
465 ax = PlayField16[si - 1];
466 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
468 PlayField16[si - FieldWidth - 1] = 0x6001;
469 PlayField16[si - FieldWidth] = 0x8888;
473 if (PlayField16[si - FieldWidth + 1] != fiZonk)
477 ax = PlayField16[si + 1];
478 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
480 PlayField16[si - FieldWidth + 1] = 0x5001;
481 PlayField16[si - FieldWidth] = 0x8888;
485 } // subCleanUpForZonksAbove