1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
7 // static char *VB_Name = "modInfotron";
11 // ==========================================================================
13 // Animate Infotrons (falling)
14 // ==========================================================================
16 int subAnimateInfotrons(int si)
18 int subAnimateInfotrons;
23 // int ax, bx, cx, dx, di, X, Y;
24 // int ah, bh, ch, dh, al, bl, cl, dl;
28 tFld = PlayField16[si];
29 if ((tFld & 0xFF) != fiInfotron)
30 return subAnimateInfotrons;
32 if (tFld == fiInfotron)
34 ax = PlayField16[si + FieldWidth]; // select case playfield16(si+60)
47 return subAnimateInfotrons;
49 loc_g_11A6: // Case fiZonk, fiInfotron, fiRAM
50 ax = PlayField16[si + FieldWidth - 1];
51 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA)
55 ax = PlayField16[si + FieldWidth + 1];
56 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA)
59 return subAnimateInfotrons;
61 loc_g_11D5: // Case fiSpace
62 MovHighByte(&PlayField16[si], 0x40);
65 loc_g_11DC: // roll left?
66 if (PlayField16[si - 1] == 0)
72 MovHighByte(&PlayField16[si], 0x50);
73 PlayField16[si - 1] = 0x8888;
76 loc_g_11F2: // roll right?
77 if (PlayField16[si + 1] == 0)
80 return subAnimateInfotrons;
83 MovHighByte(&PlayField16[si], 0x60);
84 PlayField16[si + 1] = 0x8888;
85 } // tFld = fiInfotron
88 // from now on the infotron is definitely moving,
89 // maybe the sequence is in an advanced frame
90 // or just beeing initialized due to the code above
91 bl = HighByte(PlayField16[si]);
95 if (al == 0x10) // infotron comes falling from above
98 if (al == 0x20) // infotron comes rolling from right to left
101 if (al == 0x30) // infotron comes rolling from left to right
104 if (al == 0x40) // infotron falls straight down
107 if (al == 0x50) // infotron rolls left
110 if (al == 0x60) // infotron rolls right
113 if (al == 0x70) // intermediate state
116 return subAnimateInfotrons;
118 loc_g_1242: // infotron comes falling from above
119 // To Do: draw infotron falling from above
120 // according to position in (bl And &H07)
121 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
123 Y = GetStretchY(si - FieldWidth);
126 StretchedSprites.BltImg(X, Y, aniSpace, 0);
127 StretchedSprites.BltImg(X, Y + TwoPixels * (dx + 1), aniInfotron, dx);
129 StretchedSprites.BltEx(X, Y, 0);
130 StretchedSprites.BltEx(X, Y + TwoPixels * (dx + 1), fiInfotron);
132 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
133 bl = HighByte(PlayField16[si]) + 1;
136 MovHighByte(&PlayField16[si], bl);
137 subCleanUpForInfotronsAbove(si - FieldWidth);
138 return subAnimateInfotrons;
143 MovHighByte(&PlayField16[si], bl);
144 return subAnimateInfotrons;
147 MovHighByte(&PlayField16[si], 0); // infotron arrived at the field
149 // now check if the zonk may go on falling somehow
150 ax = PlayField16[si + FieldWidth];
151 if (ax == 0) // below is empty!-> go on falling
154 if (ax == 0x9999) // below is only temporarily used
157 if ((ax & 0xFF) == fiMurphy) // Murphy dies
160 if (ax == fiRedDisk) // red disk hit
163 if ((ax & 0xFF) == fiSnikSnak) // SnikSnak dies
167 if ((ax & 0xFF) == fiElectron) // Electron cracked!
170 if (ax == fiYellowDisk) // yellow disk hit
173 if (ax == fiOrangeDisk) // orange disk hit
179 // play the infotron sound, 'cause infotron hits something "hard"
180 subSoundFX(si, fiInfotron, actImpact);
182 // play the zonk sound, 'cause zonk hits something "hard"
183 subSoundFX(si, fiZonk, actImpact);
187 subSoundFXZonk(); // play the zonk sound,'cause zonk hits something "hard"
190 if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM))
191 return subAnimateInfotrons;
193 // infotron rolls somewhere
194 ax = PlayField16[si + FieldWidth - 1];
195 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll left
198 ax = PlayField16[si + FieldWidth + 1];
199 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll right
202 return subAnimateInfotrons;
204 loc_g_132D: // go on falling down?
205 PlayField16[si] = 0x7004; // go into intermediate waitstate
206 PlayField16[si + FieldWidth] = 0x9999; // mark as "zonk waiting to access"
207 return subAnimateInfotrons;
209 loc_g_133A: // test if infotron may roll left
210 // This if(if true) jumps up far above
211 // to the according rountine for fixed infotrons!
212 if (PlayField16[si - 1] != 0) // Remarkable!!! ' loc_g_0EF4:
215 MovHighByte(&PlayField16[si], 0x50); // infotron rolls left
216 PlayField16[si - 1] = 0x8888;
218 return subAnimateInfotrons;
220 loc_g_1350: // test if infotron may roll right
221 if (PlayField16[si + 1] != 0)
222 return subAnimateInfotrons;
224 MovHighByte(&PlayField16[si], 0x60); // infotron rolls right
225 PlayField16[si + 1] = 0x8888;
227 return subAnimateInfotrons;
229 loc_g_1364: // Murphy dies, but not in any case
230 bl = HighByte(PlayField16[si + FieldWidth]);
231 if (bl == 0xE || bl == 0xF || bl == 0x28)
232 return subAnimateInfotrons;
234 if (bl == 0x29 || bl == 0x25 || bl == 0x26)
235 return subAnimateInfotrons;
237 loc_g_1386: // someone dies/explodes immediately
238 si = si + FieldWidth; // 1 field down
239 ExplodeFieldSP(si); // Explode
240 return subAnimateInfotrons;
242 loc_g_138D: // infotron comes rolling from right to left
243 // To Do: draw infotron rolling from right
244 // according to position in (bl And &H07)
245 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
246 X = GetStretchX(si + 1);
250 StretchedSprites.BltImg(X, Y, aniSpace, 0);
251 StretchedSprites.BltImg(X - (TwoPixels * dx), Y, aniInfotronRollLeft, dx - 1);
253 StretchedSprites.BltEx(X, Y, 0);
254 StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniFramesInfotronRollLeft[dx - 1]);
256 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
257 bl = HighByte(PlayField16[si]) + 1; // get and increment sequence#
259 PlayField16[si + 1] = 0xAAAA;
263 MovHighByte(&PlayField16[si], bl);
264 subCleanUpForInfotronsAbove(si + 1);
268 MovHighByte(&PlayField16[si], bl);
272 PlayField16[si] = 0x7004; // go into intermediate state
275 return subAnimateInfotrons;
277 loc_g_13E9: // infotron comes rolling from left to right
278 // To Do: draw infotron rolling from left
279 // according to position in (bl And &H07)
280 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
281 X = GetStretchX(si - 1);
285 StretchedSprites.BltImg(X, Y, aniSpace, 0);
286 StretchedSprites.BltImg(X + (TwoPixels * dx), Y, aniInfotronRollRight, dx - 1);
288 StretchedSprites.BltEx(X, Y, 0);
289 StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniFramesInfotronRollRight[dx - 1]);
291 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
292 bl = HighByte(PlayField16[si]) + 1;
294 PlayField16[si - 1] = 0xAAAA;
298 MovHighByte(&PlayField16[si], bl);
299 subCleanUpForInfotronsAbove(si - 1);
303 MovHighByte(&PlayField16[si], bl);
307 PlayField16[si] = 0x7004; // go into intermediate state
310 return subAnimateInfotrons;
312 loc_g_1444: // infotron falls straight down
316 MovHighByte(&PlayField16[si], bl);
318 else if (PlayField16[si + FieldWidth] != 0)
320 bl = bl - 1; // stay waiting
321 MovHighByte(&PlayField16[si], bl);
325 PlayField16[si] = 0xFFFF;
326 si = si + FieldWidth; // 1 field down
327 PlayField16[si] = 0x1004; // go falling
330 return subAnimateInfotrons;
332 loc_g_1472: // infotron rolls left
333 // To Do: draw infotron rolling to left
334 // according to position in (bl And &H0F)
335 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
340 StretchedSprites.BltImg(X, Y, aniSpace, 0);
341 StretchedSprites.BltImg(X - (TwoPixels * dx), Y, aniInfotronRollLeft, dx - 1);
343 StretchedSprites.BltEx(X, Y, 0);
344 StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniFramesInfotronRollLeft[dx - 1]);
346 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
347 bl = HighByte(PlayField16[si]) + 1; // retrieve and increment sequence#
350 MovHighByte(&PlayField16[si], bl);
351 return subAnimateInfotrons;
354 if (PlayField16[si + FieldWidth - 1] != 0)
357 if (PlayField16[si - 1] != 0)
359 if (PlayField16[si - 1] != 0x8888)
363 PlayField16[si] = 0xFFFF;
364 si = si - 1; // 1 field left
365 PlayField16[si] = 0x2204;
366 PlayField16[si + FieldWidth] = 0x9999;
367 return subAnimateInfotrons;
369 loc_g_14D9: // stay waiting
371 MovHighByte(&PlayField16[si], bl);
372 return subAnimateInfotrons;
374 loc_g_14E0: // infotron rolls right
375 // To Do: draw infotron rolling to right
376 // according to position in (bl And &H07)
377 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
382 StretchedSprites.BltImg(X, Y, aniSpace, 0);
383 StretchedSprites.BltImg(X + (TwoPixels * dx), Y, aniInfotronRollRight, dx - 1);
385 StretchedSprites.BltEx(X, Y, 0);
386 StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniFramesInfotronRollRight[dx - 1]);
388 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
389 bl = HighByte(PlayField16[si]) + 1;
392 MovHighByte(&PlayField16[si], bl);
393 return subAnimateInfotrons;
396 if (PlayField16[si + FieldWidth + 1] != 0)
399 if (PlayField16[si + 1] != 0)
401 if (PlayField16[si + 1] != 0x8888)
405 PlayField16[si] = 0xFFFF;
407 PlayField16[si] = 0x3204;
408 PlayField16[si + FieldWidth] = 0x9999;
409 return subAnimateInfotrons;
411 loc_g_1547: // stay waiting
413 MovHighByte(&PlayField16[si], bl);
414 return subAnimateInfotrons;
416 loc_g_154E: // intermediate state
417 ax = PlayField16[si + FieldWidth];
418 if (ax == 0 || ax == 0x9999)
420 PlayField16[si] = 0xFFFF;
421 si = si + FieldWidth; // 1 field down
422 PlayField16[si] = 0x1004; // start falling down
426 return subAnimateInfotrons;
427 } // subAnimateInfotrons
429 int subCleanUpForInfotronsAbove(int si)
431 int subCleanUpForInfotronsAbove;
435 if (LowByte(PlayField16[si]) != fiExplosion)
438 if (PlayField16[si - FieldWidth] != 0)
440 if (PlayField16[si - FieldWidth] != 0x9999)
441 return subCleanUpForInfotronsAbove;
443 if (LowByte(PlayField16[si - 2 * FieldWidth]) != fiZonk)
444 return subCleanUpForInfotronsAbove;
447 if (PlayField16[si - FieldWidth - 1] == fiInfotron)
451 if (PlayField16[si - FieldWidth + 1] == fiInfotron)
454 return subCleanUpForInfotronsAbove;
457 ax = PlayField16[si - 1];
458 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
460 PlayField16[si - FieldWidth - 1] = 0x6004;
461 PlayField16[si - FieldWidth] = 0x8888;
462 return subCleanUpForInfotronsAbove;
468 ax = PlayField16[si + 1];
469 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
471 PlayField16[si - FieldWidth + 1] = 0x5004;
472 PlayField16[si - FieldWidth] = 0x8888;
475 return subCleanUpForInfotronsAbove;
476 } // subCleanUpForInfotronsAbove