1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
7 // static char *VB_Name = "modZonk";
10 // ==========================================================================
12 // Animate Zonks (falling)
13 // ==========================================================================
15 int subAnimateZonks(int si)
22 // int ax, bx, cx, dx, di, X, Y;
24 // int ah, bh, ch, dh, al, bl, cl, dl;
27 tFld = PlayField16[si];
28 if ((tFld & 0xFF) != fiZonk)
29 return subAnimateZonks;
33 if (FreezeZonks == 2) // Do Zonks fall? (debug)
34 return subAnimateZonks;
36 ax = PlayField16[si + FieldWidth]; // select case playfield16(si+60)
49 return subAnimateZonks;
51 loc_g_0D35: // Case fiZonk, fiInfotron, fiRAM
52 ax = PlayField16[si + FieldWidth - 1];
53 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA)
57 ax = PlayField16[si + FieldWidth + 1];
58 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA)
61 return subAnimateZonks;
63 loc_g_0D64: // Case fiSpace
64 MovHighByte(&PlayField16[si], 0x40);
67 loc_g_0D6B: // roll left?
68 if (PlayField16[si - 1] == 0)
74 MovHighByte(&PlayField16[si], 0x50);
75 PlayField16[si - 1] = 0x8888;
78 loc_g_0D81: // roll right?
79 if (PlayField16[si + 1] == 0)
82 if (PlayField16[si + 1] != 0x9999) // wow right is different from left!
83 return subAnimateZonks;
85 if (LowByte(PlayField16[si - FieldWidth + 1]) != 1)
86 return subAnimateZonks;
89 MovHighByte(&PlayField16[si], 0x60);
90 PlayField16[si + 1] = 0x8888;
94 // from now on the zonk is definitely moving,
95 // maybe the sequence is in an advanced frame
96 // or just beeing initialized due to the code above
97 bl = HighByte(PlayField16[si]);
101 if (al == 0x10) // zonk comes falling from above
104 if (al == 0x20) // zonk comes rolling from right to left
107 if (al == 0x30) // zonk comes rolling from left to right
110 if (FreezeZonks == 2)
111 return subAnimateZonks;
113 if (al == 0x40) // zonk falls straight down
116 if (al == 0x50) // zonk rolls left
119 if (al == 0x60) // zonk rolls right
122 if (al == 0x70) // intermediate state
125 return subAnimateZonks;
127 loc_g_0DE8: // zonk comes falling from above
128 // To Do: draw zonk falling from above
129 // according to position in (bl And &H07)
130 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
132 Y = GetStretchY(si - FieldWidth);
135 StretchedSprites.BltImg(X, Y, aniSpace, 0);
136 StretchedSprites.BltImg(X, Y + TwoPixels * (dx + 1), aniZonk, dx);
138 StretchedSprites.BltEx(X, Y, 0);
139 StretchedSprites.BltEx(X, Y + TwoPixels * (dx + 1), fiZonk);
141 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
142 bl = HighByte(PlayField16[si]) + 1;
145 MovHighByte(&PlayField16[si], bl);
146 subCleanUpForZonksAbove(si - FieldWidth);
147 return subAnimateZonks;
152 MovHighByte(&PlayField16[si], bl);
153 return subAnimateZonks;
156 MovHighByte(&PlayField16[si], 0); // zonk arrived at the field
157 if ((FreezeZonks & 0xFF) == 2)
158 return subAnimateZonks;
160 // loc_g_0E42: // now check if the zonk may go on falling somehow
161 ax = PlayField16[si + FieldWidth];
162 if (ax == 0) // below is empty!-> go on falling 'loc_g_0E4C:
165 if (ax == 0x9999) // below is only temporarily used ' loc_g_0E57:
168 if ((ax & 0xFF) == fiMurphy) // Murphy dies 'loc_g_0E61:
171 if ((ax & 0xFF) == fiSnikSnak) // SnikSnak dies 'loc_g_0E6B:
174 if (ax == 0x2BB) // loc_g_0E76:
177 if (ax == 0x4BB) // loc_g_0E81:
180 if ((ax & 0xFF) == fiElectron) // Electron cracked! 'loc_g_0E8B:
183 if (ax == fiOrangeDisk) // OrangeDisk explodes 'loc_g_0E95:
187 // play the zonk sound, 'cause zonk hits something "hard"
188 subSoundFX(si, fiZonk, actImpact);
190 subSoundFXZonk(); // play the zonk sound,'cause zonk hits something "hard"
193 if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM))
194 return subAnimateZonks;
196 // loc_g_0EAE: ' Zonk rolls somewhere
197 ax = PlayField16[si + FieldWidth - 1];
198 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll left
201 ax = PlayField16[si + FieldWidth + 1];
202 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll right
205 return subAnimateZonks;
207 loc_g_0EDD: // go on falling down?
208 PlayField16[si] = 0x7001; // go into intermediate waitstate
209 PlayField16[si + FieldWidth] = 0x9999; // mark as "zonk waiting to access"
210 return subAnimateZonks;
212 loc_g_0EEA: // test if zonk may roll left
213 // This if(if true) jumps up far above
214 // to the according rountine for fixed zonks!
215 if (PlayField16[si - 1] != 0) // Remarkable!!! ' loc_g_0EF4:
218 MovHighByte(&PlayField16[si], 0x50); // zonk rolls left
219 Mov(&PlayField16[si - 1], 0x8888); // mark as zonk accessing?
220 return subAnimateZonks;
222 loc_g_0F00: // test if zonk may roll right
223 if (PlayField16[si + 1] != 0) // loc_g_0F08:
224 return subAnimateZonks;
226 MovHighByte(&PlayField16[si], 0x60); // zonk rolls right
227 Mov(&PlayField16[si + 1], 0x8888); // mark as zonk accessing?
228 return subAnimateZonks;
230 loc_g_0F14: // Murphy dies, but not in any case
231 bl = HighByte(PlayField16[si + FieldWidth]);
232 if (bl == 0xE || bl == 0xF || bl == 0x28)
233 return subAnimateZonks;
235 if (bl == 0x29 || bl == 0x25 || bl == 0x26)
236 return subAnimateZonks;
239 ax = LowByte(PlayField16[si + FieldWidth - 1]);
240 if (ax == fiElectron) // loc_g_0F43:
241 PlayField16[si + FieldWidth] = fiElectron;
244 PlayField16[si + FieldWidth - 1] = 0;
249 ax = LowByte(PlayField16[si + FieldWidth + 1]);
250 if (ax == fiElectron) // loc_g_0F5F:
251 PlayField16[si + FieldWidth] = fiElectron;
254 PlayField16[si + FieldWidth + 1] = 0;
258 loc_g_0F6E: // someone dies/explodes
259 si = si + FieldWidth; // 1 field down
260 ExplodeFieldSP(si); // Explode
261 return subAnimateZonks;
263 loc_g_0F75: // OrangeDisk explodes next cycle
264 si = si + FieldWidth; // 1 field down
265 PlayField8[si] = fiHardWare;
266 return subAnimateZonks;
268 loc_g_0F83: // zonk comes rolling from right to left
269 // To Do: draw zonk rolling from right
270 // according to position in (bl And &H07)
271 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
272 X = GetStretchX(si + 1);
276 StretchedSprites.BltImg(X, Y, aniSpace, 0);
277 StretchedSprites.BltImg(X - (TwoPixels * dx), Y, aniZonkRollLeft, dx - 1);
279 StretchedSprites.BltEx(X, Y, 0);
280 StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniFramesZonkRollLeft[dx - 1]);
282 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
283 bl = HighByte(PlayField16[si]) + 1; // get and increment sequence#
285 PlayField16[si + 1] = 0xAAAA;
289 MovHighByte(&PlayField16[si], bl);
290 subCleanUpForZonksAbove(si + 1);
294 MovHighByte(&PlayField16[si], bl);
298 PlayField16[si] = 0xFFFF;
299 si = si + FieldWidth; // 1 field down
300 PlayField16[si] = 0x1001; // convert rolling zonk to a falling zonk
303 return subAnimateZonks;
305 loc_g_0FE8: // zonk comes rolling from left to right
306 // To Do: draw zonk rolling from left
307 // according to position in (bl And &H07)
308 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
309 X = GetStretchX(si - 1);
313 StretchedSprites.BltImg(X, Y, aniSpace, 0);
314 StretchedSprites.BltImg(X + (TwoPixels * dx), Y, aniZonkRollRight, dx - 1);
316 StretchedSprites.BltEx(X, Y, 0);
317 StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniFramesZonkRollRight[dx - 1]);
319 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
320 bl = HighByte(PlayField16[si]) + 1;
322 PlayField16[si - 1] = 0xAAAA;
326 MovHighByte(&PlayField16[si], bl);
327 subCleanUpForZonksAbove(si - 1);
331 MovHighByte(&PlayField16[si], bl);
335 PlayField16[si] = 0xFFFF;
336 si = si + FieldWidth; // 1 field down
337 PlayField16[si] = 0x1001; // convert rolling zonk to a falling zonk
340 return subAnimateZonks;
342 loc_g_104D: // zonk falls straight down
346 MovHighByte(&PlayField16[si], bl);
348 else if (PlayField16[si + FieldWidth] != 0)
350 bl = bl - 1; // stay waiting
351 MovHighByte(&PlayField16[si], bl);
355 PlayField16[si] = 0xFFFF; // mark as "zonk leaving"
356 si = si + FieldWidth; // 1 field down
357 PlayField16[si] = 0x1001; // go falling
360 return subAnimateZonks;
362 loc_g_107B: // zonk rolls left
363 // To Do: draw zonk rolling to left
364 // according to position in (bl And &H0F)
365 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
370 StretchedSprites.BltImg(X, Y, aniSpace, 0);
371 StretchedSprites.BltImg(X - (TwoPixels * dx), Y, aniZonkRollLeft, dx - 1);
373 StretchedSprites.BltEx(X, Y, 0);
374 StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniFramesZonkRollLeft[dx - 1]);
376 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
377 bl = HighByte(PlayField16[si]) + 1; // retrieve and increment sequence#
380 MovHighByte(&PlayField16[si], bl);
381 return subAnimateZonks;
384 if (PlayField16[si + FieldWidth - 1] != 0)
387 if (PlayField16[si - 1] != 0)
389 if (PlayField16[si - 1] != 0x8888)
393 PlayField16[si] = 0xFFFF;
394 si = si - 1; // 1 field left
395 PlayField16[si] = 0x2201;
396 PlayField16[si + FieldWidth] = 0xFFFF;
397 return subAnimateZonks;
399 loc_g_10E2: // stay waiting
401 MovHighByte(&PlayField16[si], bl);
402 return subAnimateZonks;
404 loc_g_10E9: // zonk rolls right
405 // To Do: draw zonk rolling to right
406 // according to position in (bl And &H07)
407 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
412 StretchedSprites.BltImg(X, Y, aniSpace, 0);
413 StretchedSprites.BltImg(X + (TwoPixels * dx), Y, aniZonkRollRight, dx - 1);
415 StretchedSprites.BltEx(X, Y, 0);
416 StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniFramesZonkRollRight[dx - 1]);
418 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
419 bl = HighByte(PlayField16[si]) + 1;
422 MovHighByte(&PlayField16[si], bl);
423 return subAnimateZonks;
426 if (PlayField16[si + FieldWidth + 1] != 0)
429 if (PlayField16[si + 1] != 0)
431 if (PlayField16[si + 1] != 0x8888)
435 PlayField16[si] = 0xFFFF;
437 PlayField16[si] = 0x3201;
438 PlayField16[si + FieldWidth] = 0xFFFF;
439 return subAnimateZonks;
441 loc_g_1150: // stay waiting
443 MovHighByte(&PlayField16[si], bl);
444 return subAnimateZonks;
446 loc_g_1157: // intermediate state
447 ax = PlayField16[si + FieldWidth];
448 if (ax == 0 || ax == 0x9999)
450 PlayField16[si] = 0xFFFF;
451 si = si + FieldWidth; // 1 field down
452 PlayField16[si] = 0x1001; // start falling down
456 return subAnimateZonks;
457 } // subAnimateZonks endp
459 int subCleanUpForZonksAbove(int si)
461 int subCleanUpForZonksAbove;
465 if (LowByte(PlayField16[si]) != fiExplosion)
468 if (PlayField16[si - FieldWidth] != 0)
470 if (PlayField16[si - FieldWidth] != 0x9999)
471 return subCleanUpForZonksAbove;
473 if (LowByte(PlayField16[si - 2 * FieldWidth]) != fiInfotron)
474 return subCleanUpForZonksAbove;
477 if (PlayField16[si - FieldWidth - 1] != fiZonk)
479 if (PlayField16[si - FieldWidth + 1] != fiZonk)
480 return subCleanUpForZonksAbove;
485 ax = PlayField16[si - 1];
486 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
488 PlayField16[si - FieldWidth - 1] = 0x6001;
489 PlayField16[si - FieldWidth] = 0x8888;
490 return subCleanUpForZonksAbove;
493 if (PlayField16[si - FieldWidth + 1] != fiZonk)
494 return subCleanUpForZonksAbove;
497 ax = PlayField16[si + 1];
498 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
500 PlayField16[si - FieldWidth + 1] = 0x5001;
501 PlayField16[si - FieldWidth] = 0x8888;
504 return subCleanUpForZonksAbove;
505 } // subCleanUpForZonksAbove