1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
7 static char *VB_Name = "modInfotron";
10 // ==========================================================================
12 // Animate Infotrons (falling)
13 // ==========================================================================
15 int subAnimateInfotrons(int si)
17 int subAnimateInfotrons;
22 int ax, bx, cx, dx, di, X, Y;
23 int ah, bh, ch, dh, al, bl, cl, dl;
25 tFld = PlayField16[si];
26 if ((tFld & 0xFF) != fiInfotron)
27 return subAnimateInfotrons;
29 if (tFld == fiInfotron)
31 ax = PlayField16[si + FieldWidth]; // select case playfield16(si+60)
44 return subAnimateInfotrons;
46 loc_g_11A6: // Case fiZonk, fiInfotron, fiRAM
47 ax = PlayField16[si + FieldWidth - 1];
48 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA)
52 ax = PlayField16[si + FieldWidth + 1];
53 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA)
56 return subAnimateInfotrons;
58 loc_g_11D5: // Case fiSpace
59 MovHighByte(&PlayField16[si], 0x40);
62 loc_g_11DC: // roll left?
63 if (PlayField16[si - 1] == 0)
69 MovHighByte(&PlayField16[si], 0x50);
70 PlayField16[si - 1] = 0x8888;
73 loc_g_11F2: // roll right?
74 if (PlayField16[si + 1] == 0)
77 return subAnimateInfotrons;
80 MovHighByte(&PlayField16[si], 0x60);
81 PlayField16[si + 1] = 0x8888;
82 } // tFld = fiInfotron
85 // from now on the infotron is definitely moving,
86 // maybe the sequence is in an advanced frame
87 // or just beeing initialized due to the code above
88 bl = HighByte(PlayField16[si]);
92 if (al == 0x10) // infotron comes falling from above
95 if (al == 0x20) // infotron comes rolling from right to left
98 if (al == 0x30) // infotron comes rolling from left to right
101 if (al == 0x40) // infotron falls straight down
104 if (al == 0x50) // infotron rolls left
107 if (al == 0x60) // infotron rolls right
110 if (al == 0x70) // intermediate state
113 return subAnimateInfotrons;
115 loc_g_1242: // infotron comes falling from above
116 // To Do: draw infotron falling from above
117 // according to position in (bl And &H07)
118 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
120 Y = GetStretchY(si - FieldWidth);
122 StretchedSprites.BltEx(X, Y, 0);
123 StretchedSprites.BltEx(X, Y + TwoPixels * (dx + 1), fiInfotron);
124 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
125 bl = HighByte(PlayField16[si]) + 1;
128 MovHighByte(&PlayField16[si], bl);
129 subCleanUpForInfotronsAbove(si - FieldWidth);
130 return subAnimateInfotrons;
135 MovHighByte(&PlayField16[si], bl);
136 return subAnimateInfotrons;
139 MovHighByte(&PlayField16[si], 0); // infotron arrived at the field
141 // now check if the zonk may go on falling somehow
142 ax = PlayField16[si + FieldWidth];
143 if (ax == 0) // below is empty!-> go on falling
146 if (ax == 0x9999) // below is only temporarily used
149 if ((ax & 0xFF) == fiMurphy) // Murphy dies
152 if (ax == fiRedDisk) // red disk hit
155 if ((ax & 0xFF) == fiSnikSnak) // SnikSnak dies
159 if ((ax & 0xFF) == fiElectron) // Electron cracked!
162 if (ax == fiYellowDisk) // yellow disk hit
165 if (ax == fiOrangeDisk) // orange disk hit
168 subSoundFXZonk(); // play the zonk sound,'cause zonk hits something "hard"
170 if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM))
171 return subAnimateInfotrons;
173 // infotron rolls somewhere
174 ax = PlayField16[si + FieldWidth - 1];
175 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll left
178 ax = PlayField16[si + FieldWidth + 1];
179 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll right
182 return subAnimateInfotrons;
184 loc_g_132D: // go on falling down?
185 PlayField16[si] = 0x7004; // go into intermediate waitstate
186 PlayField16[si + FieldWidth] = 0x9999; // mark as "zonk waiting to access"
187 return subAnimateInfotrons;
189 loc_g_133A: // test if infotron may roll left
190 // This if(if true) jumps up far above
191 // to the according rountine for fixed infotrons!
192 if (PlayField16[si - 1] != 0) // Remarkable!!! ' loc_g_0EF4:
195 MovHighByte(&PlayField16[si], 0x50); // infotron rolls left
196 Mov(&PlayField16[si - 1], 0x8888);
197 return subAnimateInfotrons;
199 loc_g_1350: // test if infotron may roll right
200 if (PlayField16[si + 1] != 0)
201 return subAnimateInfotrons;
203 MovHighByte(&PlayField16[si], 0x60); // infotron rolls right
204 Mov(&PlayField16[si + 1], 0x8888);
205 return subAnimateInfotrons;
207 loc_g_1364: // Murphy dies, but not in any case
208 bl = HighByte(PlayField16[si + FieldWidth]);
209 if (bl == 0xE || bl == 0xF || bl == 0x28)
210 return subAnimateInfotrons;
212 if (bl == 0x29 || bl == 0x25 || bl == 0x26)
213 return subAnimateInfotrons;
225 loc_g_1386: // someone dies/explodes immediately
226 si = si + FieldWidth; // 1 field down
227 ExplodeFieldSP(si); // Explode
228 return subAnimateInfotrons;
234 loc_g_138D: // infotron comes rolling from right to left
235 // To Do: draw infotron rolling from right
236 // according to position in (bl And &H07)
237 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
238 X = GetStretchX(si + 1);
241 StretchedSprites.BltEx(X, Y, 0);
242 StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniInfotronRollLeft[dx - 1]);
243 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
244 bl = HighByte(PlayField16[si]) + 1; // get and increment sequence#
246 PlayField16[si + 1] = 0xAAAA;
250 MovHighByte(&PlayField16[si], bl);
251 subCleanUpForInfotronsAbove(si + 1);
255 MovHighByte(&PlayField16[si], bl);
259 PlayField16[si] = 0x7004; // go into intermediate state
262 return subAnimateInfotrons;
264 loc_g_13E9: // infotron comes rolling from left to right
265 // To Do: draw infotron rolling from left
266 // according to position in (bl And &H07)
267 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
268 X = GetStretchX(si - 1);
271 StretchedSprites.BltEx(X, Y, 0);
272 StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniInfotronRollRight[dx - 1]);
273 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
274 bl = HighByte(PlayField16[si]) + 1;
276 PlayField16[si - 1] = 0xAAAA;
280 MovHighByte(&PlayField16[si], bl);
281 subCleanUpForInfotronsAbove(si - 1);
285 MovHighByte(&PlayField16[si], bl);
289 PlayField16[si] = 0x7004; // go into intermediate state
292 return subAnimateInfotrons;
294 loc_g_1444: // infotron falls straight down
298 MovHighByte(&PlayField16[si], bl);
300 else if (PlayField16[si + FieldWidth] != 0)
302 bl = bl - 1; // stay waiting
303 MovHighByte(&PlayField16[si], bl);
307 PlayField16[si] = 0xFFFF;
308 si = si + FieldWidth; // 1 field down
309 PlayField16[si] = 0x1004; // go falling
312 return subAnimateInfotrons;
314 loc_g_1472: // infotron rolls left
315 // To Do: draw infotron rolling to left
316 // according to position in (bl And &H0F)
317 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
321 StretchedSprites.BltEx(X, Y, 0);
322 StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniInfotronRollLeft[dx - 1]);
323 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
324 bl = HighByte(PlayField16[si]) + 1; // retrieve and increment sequence#
327 MovHighByte(&PlayField16[si], bl);
328 return subAnimateInfotrons;
331 if (PlayField16[si + FieldWidth - 1] != 0)
334 if (PlayField16[si - 1] != 0)
336 if (PlayField16[si - 1] != 0x8888)
340 PlayField16[si] = 0xFFFF;
341 si = si - 1; // 1 field left
342 PlayField16[si] = 0x2204;
343 PlayField16[si + FieldWidth] = 0x9999;
344 return subAnimateInfotrons;
346 loc_g_14D9: // stay waiting
348 MovHighByte(&PlayField16[si], bl);
349 return subAnimateInfotrons;
351 loc_g_14E0: // infotron rolls right
352 // To Do: draw infotron rolling to right
353 // according to position in (bl And &H07)
354 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
358 StretchedSprites.BltEx(X, Y, 0);
359 StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniInfotronRollRight[dx - 1]);
360 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
361 bl = HighByte(PlayField16[si]) + 1;
364 MovHighByte(&PlayField16[si], bl);
365 return subAnimateInfotrons;
368 if (PlayField16[si + FieldWidth + 1] != 0)
371 if (PlayField16[si + 1] != 0)
373 if (PlayField16[si + 1] != 0x8888)
377 PlayField16[si] = 0xFFFF;
379 PlayField16[si] = 0x3204;
380 PlayField16[si + FieldWidth] = 0x9999;
381 return subAnimateInfotrons;
383 loc_g_1547: // stay waiting
385 MovHighByte(&PlayField16[si], bl);
386 return subAnimateInfotrons;
388 loc_g_154E: // intermediate state
389 ax = PlayField16[si + FieldWidth];
390 if (ax == 0 || ax == 0x9999)
392 PlayField16[si] = 0xFFFF;
393 si = si + FieldWidth; // 1 field down
394 PlayField16[si] = 0x1004; // start falling down
398 return subAnimateInfotrons;
399 } // subAnimateInfotrons
401 int subCleanUpForInfotronsAbove(int si)
403 int subCleanUpForInfotronsAbove;
407 if (LowByte(PlayField16[si]) != fiExplosion)
410 if (PlayField16[si - FieldWidth] != 0)
412 if (PlayField16[si - FieldWidth] != 0x9999)
413 return subCleanUpForInfotronsAbove;
415 if (LowByte(PlayField16[si - 2 * FieldWidth]) != fiZonk)
416 return subCleanUpForInfotronsAbove;
419 if (PlayField16[si - FieldWidth - 1] == fiInfotron)
423 if (PlayField16[si - FieldWidth + 1] == fiInfotron)
426 return subCleanUpForInfotronsAbove;
429 ax = PlayField16[si - 1];
430 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
432 PlayField16[si - FieldWidth - 1] = 0x6004;
433 PlayField16[si - FieldWidth] = 0x8888;
434 return subCleanUpForInfotronsAbove;
440 ax = PlayField16[si + 1];
441 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
443 PlayField16[si - FieldWidth + 1] = 0x5004;
444 PlayField16[si - FieldWidth] = 0x8888;
447 return subCleanUpForInfotronsAbove;
448 } // subCleanUpForInfotronsAbove