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:
186 subSoundFXZonk(); // play the zonk sound,'cause zonk hits something "hard"
188 if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM))
189 return subAnimateZonks;
191 // loc_g_0EAE: ' Zonk rolls somewhere
192 ax = PlayField16[si + FieldWidth - 1];
193 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll left
196 ax = PlayField16[si + FieldWidth + 1];
197 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll right
200 return subAnimateZonks;
202 loc_g_0EDD: // go on falling down?
203 PlayField16[si] = 0x7001; // go into intermediate waitstate
204 PlayField16[si + FieldWidth] = 0x9999; // mark as "zonk waiting to access"
205 return subAnimateZonks;
207 loc_g_0EEA: // test if zonk may roll left
208 // This if(if true) jumps up far above
209 // to the according rountine for fixed zonks!
210 if (PlayField16[si - 1] != 0) // Remarkable!!! ' loc_g_0EF4:
213 MovHighByte(&PlayField16[si], 0x50); // zonk rolls left
214 Mov(&PlayField16[si - 1], 0x8888); // mark as zonk accessing?
215 return subAnimateZonks;
217 loc_g_0F00: // test if zonk may roll right
218 if (PlayField16[si + 1] != 0) // loc_g_0F08:
219 return subAnimateZonks;
221 MovHighByte(&PlayField16[si], 0x60); // zonk rolls right
222 Mov(&PlayField16[si + 1], 0x8888); // mark as zonk accessing?
223 return subAnimateZonks;
225 loc_g_0F14: // Murphy dies, but not in any case
226 bl = HighByte(PlayField16[si + FieldWidth]);
227 if (bl == 0xE || bl == 0xF || bl == 0x28)
228 return subAnimateZonks;
230 if (bl == 0x29 || bl == 0x25 || bl == 0x26)
231 return subAnimateZonks;
234 ax = LowByte(PlayField16[si + FieldWidth - 1]);
235 if (ax == fiElectron) // loc_g_0F43:
236 PlayField16[si + FieldWidth] = fiElectron;
239 PlayField16[si + FieldWidth - 1] = 0;
244 ax = LowByte(PlayField16[si + FieldWidth + 1]);
245 if (ax == fiElectron) // loc_g_0F5F:
246 PlayField16[si + FieldWidth] = fiElectron;
249 PlayField16[si + FieldWidth + 1] = 0;
253 loc_g_0F6E: // someone dies/explodes
254 si = si + FieldWidth; // 1 field down
255 ExplodeFieldSP(si); // Explode
256 return subAnimateZonks;
258 loc_g_0F75: // OrangeDisk explodes next cycle
259 si = si + FieldWidth; // 1 field down
260 PlayField8[si] = fiHardWare;
261 return subAnimateZonks;
263 loc_g_0F83: // zonk comes rolling from right to left
264 // To Do: draw zonk rolling from right
265 // according to position in (bl And &H07)
266 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
267 X = GetStretchX(si + 1);
271 StretchedSprites.BltImg(X, Y, aniSpace, 0);
272 StretchedSprites.BltImg(X - (TwoPixels * dx), Y, aniZonkRollLeft, dx - 1);
274 StretchedSprites.BltEx(X, Y, 0);
275 StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniFramesZonkRollLeft[dx - 1]);
277 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
278 bl = HighByte(PlayField16[si]) + 1; // get and increment sequence#
280 PlayField16[si + 1] = 0xAAAA;
284 MovHighByte(&PlayField16[si], bl);
285 subCleanUpForZonksAbove(si + 1);
289 MovHighByte(&PlayField16[si], bl);
293 PlayField16[si] = 0xFFFF;
294 si = si + FieldWidth; // 1 field down
295 PlayField16[si] = 0x1001; // convert rolling zonk to a falling zonk
298 return subAnimateZonks;
300 loc_g_0FE8: // zonk comes rolling from left to right
301 // To Do: draw zonk rolling from left
302 // according to position in (bl And &H07)
303 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
304 X = GetStretchX(si - 1);
308 StretchedSprites.BltImg(X, Y, aniSpace, 0);
309 StretchedSprites.BltImg(X + (TwoPixels * dx), Y, aniZonkRollRight, dx - 1);
311 StretchedSprites.BltEx(X, Y, 0);
312 StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniFramesZonkRollRight[dx - 1]);
314 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
315 bl = HighByte(PlayField16[si]) + 1;
317 PlayField16[si - 1] = 0xAAAA;
321 MovHighByte(&PlayField16[si], bl);
322 subCleanUpForZonksAbove(si - 1);
326 MovHighByte(&PlayField16[si], bl);
330 PlayField16[si] = 0xFFFF;
331 si = si + FieldWidth; // 1 field down
332 PlayField16[si] = 0x1001; // convert rolling zonk to a falling zonk
335 return subAnimateZonks;
337 loc_g_104D: // zonk falls straight down
341 MovHighByte(&PlayField16[si], bl);
343 else if (PlayField16[si + FieldWidth] != 0)
345 bl = bl - 1; // stay waiting
346 MovHighByte(&PlayField16[si], bl);
350 PlayField16[si] = 0xFFFF; // mark as "zonk leaving"
351 si = si + FieldWidth; // 1 field down
352 PlayField16[si] = 0x1001; // go falling
355 return subAnimateZonks;
357 loc_g_107B: // zonk rolls left
358 // To Do: draw zonk rolling to left
359 // according to position in (bl And &H0F)
360 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
365 StretchedSprites.BltImg(X, Y, aniSpace, 0);
366 StretchedSprites.BltImg(X - (TwoPixels * dx), Y, aniZonkRollLeft, dx - 1);
368 StretchedSprites.BltEx(X, Y, 0);
369 StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniFramesZonkRollLeft[dx - 1]);
371 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
372 bl = HighByte(PlayField16[si]) + 1; // retrieve and increment sequence#
375 MovHighByte(&PlayField16[si], bl);
376 return subAnimateZonks;
379 if (PlayField16[si + FieldWidth - 1] != 0)
382 if (PlayField16[si - 1] != 0)
384 if (PlayField16[si - 1] != 0x8888)
388 PlayField16[si] = 0xFFFF;
389 si = si - 1; // 1 field left
390 PlayField16[si] = 0x2201;
391 PlayField16[si + FieldWidth] = 0xFFFF;
392 return subAnimateZonks;
394 loc_g_10E2: // stay waiting
396 MovHighByte(&PlayField16[si], bl);
397 return subAnimateZonks;
399 loc_g_10E9: // zonk rolls right
400 // To Do: draw zonk rolling to right
401 // according to position in (bl And &H07)
402 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
407 StretchedSprites.BltImg(X, Y, aniSpace, 0);
408 StretchedSprites.BltImg(X + (TwoPixels * dx), Y, aniZonkRollRight, dx - 1);
410 StretchedSprites.BltEx(X, Y, 0);
411 StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniFramesZonkRollRight[dx - 1]);
413 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
414 bl = HighByte(PlayField16[si]) + 1;
417 MovHighByte(&PlayField16[si], bl);
418 return subAnimateZonks;
421 if (PlayField16[si + FieldWidth + 1] != 0)
424 if (PlayField16[si + 1] != 0)
426 if (PlayField16[si + 1] != 0x8888)
430 PlayField16[si] = 0xFFFF;
432 PlayField16[si] = 0x3201;
433 PlayField16[si + FieldWidth] = 0xFFFF;
434 return subAnimateZonks;
436 loc_g_1150: // stay waiting
438 MovHighByte(&PlayField16[si], bl);
439 return subAnimateZonks;
441 loc_g_1157: // intermediate state
442 ax = PlayField16[si + FieldWidth];
443 if (ax == 0 || ax == 0x9999)
445 PlayField16[si] = 0xFFFF;
446 si = si + FieldWidth; // 1 field down
447 PlayField16[si] = 0x1001; // start falling down
451 return subAnimateZonks;
452 } // subAnimateZonks endp
454 int subCleanUpForZonksAbove(int si)
456 int subCleanUpForZonksAbove;
460 if (LowByte(PlayField16[si]) != fiExplosion)
463 if (PlayField16[si - FieldWidth] != 0)
465 if (PlayField16[si - FieldWidth] != 0x9999)
466 return subCleanUpForZonksAbove;
468 if (LowByte(PlayField16[si - 2 * FieldWidth]) != fiInfotron)
469 return subCleanUpForZonksAbove;
472 if (PlayField16[si - FieldWidth - 1] != fiZonk)
474 if (PlayField16[si - FieldWidth + 1] != fiZonk)
475 return subCleanUpForZonksAbove;
480 ax = PlayField16[si - 1];
481 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
483 PlayField16[si - FieldWidth - 1] = 0x6001;
484 PlayField16[si - FieldWidth] = 0x8888;
485 return subCleanUpForZonksAbove;
488 if (PlayField16[si - FieldWidth + 1] != fiZonk)
489 return subCleanUpForZonksAbove;
492 ax = PlayField16[si + 1];
493 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
495 PlayField16[si - FieldWidth + 1] = 0x5001;
496 PlayField16[si - FieldWidth] = 0x8888;
499 return subCleanUpForZonksAbove;
500 } // subCleanUpForZonksAbove