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);
125 StretchedSprites.BltEx(X, Y, 0);
126 StretchedSprites.BltEx(X, Y + TwoPixels * (dx + 1), fiInfotron);
127 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
128 bl = HighByte(PlayField16[si]) + 1;
131 MovHighByte(&PlayField16[si], bl);
132 subCleanUpForInfotronsAbove(si - FieldWidth);
133 return subAnimateInfotrons;
138 MovHighByte(&PlayField16[si], bl);
139 return subAnimateInfotrons;
142 MovHighByte(&PlayField16[si], 0); // infotron arrived at the field
144 // now check if the zonk may go on falling somehow
145 ax = PlayField16[si + FieldWidth];
146 if (ax == 0) // below is empty!-> go on falling
149 if (ax == 0x9999) // below is only temporarily used
152 if ((ax & 0xFF) == fiMurphy) // Murphy dies
155 if (ax == fiRedDisk) // red disk hit
158 if ((ax & 0xFF) == fiSnikSnak) // SnikSnak dies
162 if ((ax & 0xFF) == fiElectron) // Electron cracked!
165 if (ax == fiYellowDisk) // yellow disk hit
168 if (ax == fiOrangeDisk) // orange disk hit
171 subSoundFXZonk(); // play the zonk sound,'cause zonk hits something "hard"
173 if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM))
174 return subAnimateInfotrons;
176 // infotron rolls somewhere
177 ax = PlayField16[si + FieldWidth - 1];
178 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll left
181 ax = PlayField16[si + FieldWidth + 1];
182 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll right
185 return subAnimateInfotrons;
187 loc_g_132D: // go on falling down?
188 PlayField16[si] = 0x7004; // go into intermediate waitstate
189 PlayField16[si + FieldWidth] = 0x9999; // mark as "zonk waiting to access"
190 return subAnimateInfotrons;
192 loc_g_133A: // test if infotron may roll left
193 // This if(if true) jumps up far above
194 // to the according rountine for fixed infotrons!
195 if (PlayField16[si - 1] != 0) // Remarkable!!! ' loc_g_0EF4:
198 MovHighByte(&PlayField16[si], 0x50); // infotron rolls left
199 Mov(&PlayField16[si - 1], 0x8888);
200 return subAnimateInfotrons;
202 loc_g_1350: // test if infotron may roll right
203 if (PlayField16[si + 1] != 0)
204 return subAnimateInfotrons;
206 MovHighByte(&PlayField16[si], 0x60); // infotron rolls right
207 Mov(&PlayField16[si + 1], 0x8888);
208 return subAnimateInfotrons;
210 loc_g_1364: // Murphy dies, but not in any case
211 bl = HighByte(PlayField16[si + FieldWidth]);
212 if (bl == 0xE || bl == 0xF || bl == 0x28)
213 return subAnimateInfotrons;
215 if (bl == 0x29 || bl == 0x25 || bl == 0x26)
216 return subAnimateInfotrons;
228 loc_g_1386: // someone dies/explodes immediately
229 si = si + FieldWidth; // 1 field down
230 ExplodeFieldSP(si); // Explode
231 return subAnimateInfotrons;
237 loc_g_138D: // infotron comes rolling from right to left
238 // To Do: draw infotron rolling from right
239 // according to position in (bl And &H07)
240 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
241 X = GetStretchX(si + 1);
244 StretchedSprites.BltEx(X, Y, 0);
245 StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniInfotronRollLeft[dx - 1]);
246 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
247 bl = HighByte(PlayField16[si]) + 1; // get and increment sequence#
249 PlayField16[si + 1] = 0xAAAA;
253 MovHighByte(&PlayField16[si], bl);
254 subCleanUpForInfotronsAbove(si + 1);
258 MovHighByte(&PlayField16[si], bl);
262 PlayField16[si] = 0x7004; // go into intermediate state
265 return subAnimateInfotrons;
267 loc_g_13E9: // infotron comes rolling from left to right
268 // To Do: draw infotron rolling from left
269 // according to position in (bl And &H07)
270 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
271 X = GetStretchX(si - 1);
274 StretchedSprites.BltEx(X, Y, 0);
275 StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniInfotronRollRight[dx - 1]);
276 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
277 bl = HighByte(PlayField16[si]) + 1;
279 PlayField16[si - 1] = 0xAAAA;
283 MovHighByte(&PlayField16[si], bl);
284 subCleanUpForInfotronsAbove(si - 1);
288 MovHighByte(&PlayField16[si], bl);
292 PlayField16[si] = 0x7004; // go into intermediate state
295 return subAnimateInfotrons;
297 loc_g_1444: // infotron falls straight down
301 MovHighByte(&PlayField16[si], bl);
303 else if (PlayField16[si + FieldWidth] != 0)
305 bl = bl - 1; // stay waiting
306 MovHighByte(&PlayField16[si], bl);
310 PlayField16[si] = 0xFFFF;
311 si = si + FieldWidth; // 1 field down
312 PlayField16[si] = 0x1004; // go falling
315 return subAnimateInfotrons;
317 loc_g_1472: // infotron rolls left
318 // To Do: draw infotron rolling to left
319 // according to position in (bl And &H0F)
320 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
324 StretchedSprites.BltEx(X, Y, 0);
325 StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniInfotronRollLeft[dx - 1]);
326 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
327 bl = HighByte(PlayField16[si]) + 1; // retrieve and increment sequence#
330 MovHighByte(&PlayField16[si], bl);
331 return subAnimateInfotrons;
334 if (PlayField16[si + FieldWidth - 1] != 0)
337 if (PlayField16[si - 1] != 0)
339 if (PlayField16[si - 1] != 0x8888)
343 PlayField16[si] = 0xFFFF;
344 si = si - 1; // 1 field left
345 PlayField16[si] = 0x2204;
346 PlayField16[si + FieldWidth] = 0x9999;
347 return subAnimateInfotrons;
349 loc_g_14D9: // stay waiting
351 MovHighByte(&PlayField16[si], bl);
352 return subAnimateInfotrons;
354 loc_g_14E0: // infotron rolls right
355 // To Do: draw infotron rolling to right
356 // according to position in (bl And &H07)
357 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
361 StretchedSprites.BltEx(X, Y, 0);
362 StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniInfotronRollRight[dx - 1]);
363 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
364 bl = HighByte(PlayField16[si]) + 1;
367 MovHighByte(&PlayField16[si], bl);
368 return subAnimateInfotrons;
371 if (PlayField16[si + FieldWidth + 1] != 0)
374 if (PlayField16[si + 1] != 0)
376 if (PlayField16[si + 1] != 0x8888)
380 PlayField16[si] = 0xFFFF;
382 PlayField16[si] = 0x3204;
383 PlayField16[si + FieldWidth] = 0x9999;
384 return subAnimateInfotrons;
386 loc_g_1547: // stay waiting
388 MovHighByte(&PlayField16[si], bl);
389 return subAnimateInfotrons;
391 loc_g_154E: // intermediate state
392 ax = PlayField16[si + FieldWidth];
393 if (ax == 0 || ax == 0x9999)
395 PlayField16[si] = 0xFFFF;
396 si = si + FieldWidth; // 1 field down
397 PlayField16[si] = 0x1004; // start falling down
401 return subAnimateInfotrons;
402 } // subAnimateInfotrons
404 int subCleanUpForInfotronsAbove(int si)
406 int subCleanUpForInfotronsAbove;
410 if (LowByte(PlayField16[si]) != fiExplosion)
413 if (PlayField16[si - FieldWidth] != 0)
415 if (PlayField16[si - FieldWidth] != 0x9999)
416 return subCleanUpForInfotronsAbove;
418 if (LowByte(PlayField16[si - 2 * FieldWidth]) != fiZonk)
419 return subCleanUpForInfotronsAbove;
422 if (PlayField16[si - FieldWidth - 1] == fiInfotron)
426 if (PlayField16[si - FieldWidth + 1] == fiInfotron)
429 return subCleanUpForInfotronsAbove;
432 ax = PlayField16[si - 1];
433 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
435 PlayField16[si - FieldWidth - 1] = 0x6004;
436 PlayField16[si - FieldWidth] = 0x8888;
437 return subCleanUpForInfotronsAbove;
443 ax = PlayField16[si + 1];
444 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
446 PlayField16[si - FieldWidth + 1] = 0x5004;
447 PlayField16[si - FieldWidth] = 0x8888;
450 return subCleanUpForInfotronsAbove;
451 } // subCleanUpForInfotronsAbove