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
176 subSoundFXZonk(); // play the zonk sound,'cause zonk hits something "hard"
178 if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM))
179 return subAnimateInfotrons;
181 // infotron rolls somewhere
182 ax = PlayField16[si + FieldWidth - 1];
183 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll left
186 ax = PlayField16[si + FieldWidth + 1];
187 if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll right
190 return subAnimateInfotrons;
192 loc_g_132D: // go on falling down?
193 PlayField16[si] = 0x7004; // go into intermediate waitstate
194 PlayField16[si + FieldWidth] = 0x9999; // mark as "zonk waiting to access"
195 return subAnimateInfotrons;
197 loc_g_133A: // test if infotron may roll left
198 // This if(if true) jumps up far above
199 // to the according rountine for fixed infotrons!
200 if (PlayField16[si - 1] != 0) // Remarkable!!! ' loc_g_0EF4:
203 MovHighByte(&PlayField16[si], 0x50); // infotron rolls left
204 Mov(&PlayField16[si - 1], 0x8888);
205 return subAnimateInfotrons;
207 loc_g_1350: // test if infotron may roll right
208 if (PlayField16[si + 1] != 0)
209 return subAnimateInfotrons;
211 MovHighByte(&PlayField16[si], 0x60); // infotron rolls right
212 Mov(&PlayField16[si + 1], 0x8888);
213 return subAnimateInfotrons;
215 loc_g_1364: // Murphy dies, but not in any case
216 bl = HighByte(PlayField16[si + FieldWidth]);
217 if (bl == 0xE || bl == 0xF || bl == 0x28)
218 return subAnimateInfotrons;
220 if (bl == 0x29 || bl == 0x25 || bl == 0x26)
221 return subAnimateInfotrons;
223 loc_g_1386: // someone dies/explodes immediately
224 si = si + FieldWidth; // 1 field down
225 ExplodeFieldSP(si); // Explode
226 return subAnimateInfotrons;
228 loc_g_138D: // infotron comes rolling from right to left
229 // To Do: draw infotron rolling from right
230 // according to position in (bl And &H07)
231 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
232 X = GetStretchX(si + 1);
236 StretchedSprites.BltImg(X, Y, aniSpace, 0);
237 StretchedSprites.BltImg(X - (TwoPixels * dx), Y, aniInfotronRollLeft, dx - 1);
239 StretchedSprites.BltEx(X, Y, 0);
240 StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniFramesInfotronRollLeft[dx - 1]);
242 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
243 bl = HighByte(PlayField16[si]) + 1; // get and increment sequence#
245 PlayField16[si + 1] = 0xAAAA;
249 MovHighByte(&PlayField16[si], bl);
250 subCleanUpForInfotronsAbove(si + 1);
254 MovHighByte(&PlayField16[si], bl);
258 PlayField16[si] = 0x7004; // go into intermediate state
261 return subAnimateInfotrons;
263 loc_g_13E9: // infotron comes rolling from left to right
264 // To Do: draw infotron rolling from left
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, aniInfotronRollRight, dx - 1);
274 StretchedSprites.BltEx(X, Y, 0);
275 StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniFramesInfotronRollRight[dx - 1]);
277 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
278 bl = HighByte(PlayField16[si]) + 1;
280 PlayField16[si - 1] = 0xAAAA;
284 MovHighByte(&PlayField16[si], bl);
285 subCleanUpForInfotronsAbove(si - 1);
289 MovHighByte(&PlayField16[si], bl);
293 PlayField16[si] = 0x7004; // go into intermediate state
296 return subAnimateInfotrons;
298 loc_g_1444: // infotron falls straight down
302 MovHighByte(&PlayField16[si], bl);
304 else if (PlayField16[si + FieldWidth] != 0)
306 bl = bl - 1; // stay waiting
307 MovHighByte(&PlayField16[si], bl);
311 PlayField16[si] = 0xFFFF;
312 si = si + FieldWidth; // 1 field down
313 PlayField16[si] = 0x1004; // go falling
316 return subAnimateInfotrons;
318 loc_g_1472: // infotron rolls left
319 // To Do: draw infotron rolling to left
320 // according to position in (bl And &H0F)
321 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
326 StretchedSprites.BltImg(X, Y, aniSpace, 0);
327 StretchedSprites.BltImg(X - (TwoPixels * dx), Y, aniInfotronRollLeft, dx - 1);
329 StretchedSprites.BltEx(X, Y, 0);
330 StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniFramesInfotronRollLeft[dx - 1]);
332 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
333 bl = HighByte(PlayField16[si]) + 1; // retrieve and increment sequence#
336 MovHighByte(&PlayField16[si], bl);
337 return subAnimateInfotrons;
340 if (PlayField16[si + FieldWidth - 1] != 0)
343 if (PlayField16[si - 1] != 0)
345 if (PlayField16[si - 1] != 0x8888)
349 PlayField16[si] = 0xFFFF;
350 si = si - 1; // 1 field left
351 PlayField16[si] = 0x2204;
352 PlayField16[si + FieldWidth] = 0x9999;
353 return subAnimateInfotrons;
355 loc_g_14D9: // stay waiting
357 MovHighByte(&PlayField16[si], bl);
358 return subAnimateInfotrons;
360 loc_g_14E0: // infotron rolls right
361 // To Do: draw infotron rolling to right
362 // according to position in (bl And &H07)
363 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
368 StretchedSprites.BltImg(X, Y, aniSpace, 0);
369 StretchedSprites.BltImg(X + (TwoPixels * dx), Y, aniInfotronRollRight, dx - 1);
371 StretchedSprites.BltEx(X, Y, 0);
372 StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniFramesInfotronRollRight[dx - 1]);
374 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
375 bl = HighByte(PlayField16[si]) + 1;
378 MovHighByte(&PlayField16[si], bl);
379 return subAnimateInfotrons;
382 if (PlayField16[si + FieldWidth + 1] != 0)
385 if (PlayField16[si + 1] != 0)
387 if (PlayField16[si + 1] != 0x8888)
391 PlayField16[si] = 0xFFFF;
393 PlayField16[si] = 0x3204;
394 PlayField16[si + FieldWidth] = 0x9999;
395 return subAnimateInfotrons;
397 loc_g_1547: // stay waiting
399 MovHighByte(&PlayField16[si], bl);
400 return subAnimateInfotrons;
402 loc_g_154E: // intermediate state
403 ax = PlayField16[si + FieldWidth];
404 if (ax == 0 || ax == 0x9999)
406 PlayField16[si] = 0xFFFF;
407 si = si + FieldWidth; // 1 field down
408 PlayField16[si] = 0x1004; // start falling down
412 return subAnimateInfotrons;
413 } // subAnimateInfotrons
415 int subCleanUpForInfotronsAbove(int si)
417 int subCleanUpForInfotronsAbove;
421 if (LowByte(PlayField16[si]) != fiExplosion)
424 if (PlayField16[si - FieldWidth] != 0)
426 if (PlayField16[si - FieldWidth] != 0x9999)
427 return subCleanUpForInfotronsAbove;
429 if (LowByte(PlayField16[si - 2 * FieldWidth]) != fiZonk)
430 return subCleanUpForInfotronsAbove;
433 if (PlayField16[si - FieldWidth - 1] == fiInfotron)
437 if (PlayField16[si - FieldWidth + 1] == fiInfotron)
440 return subCleanUpForInfotronsAbove;
443 ax = PlayField16[si - 1];
444 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
446 PlayField16[si - FieldWidth - 1] = 0x6004;
447 PlayField16[si - FieldWidth] = 0x8888;
448 return subCleanUpForInfotronsAbove;
454 ax = PlayField16[si + 1];
455 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
457 PlayField16[si - FieldWidth + 1] = 0x5004;
458 PlayField16[si - FieldWidth] = 0x8888;
461 return subCleanUpForInfotronsAbove;
462 } // subCleanUpForInfotronsAbove