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 Mov(&PlayField16[si - 1], 0x8888);
217 return subAnimateInfotrons;
219 loc_g_1350: // test if infotron may roll right
220 if (PlayField16[si + 1] != 0)
221 return subAnimateInfotrons;
223 MovHighByte(&PlayField16[si], 0x60); // infotron rolls right
224 Mov(&PlayField16[si + 1], 0x8888);
225 return subAnimateInfotrons;
227 loc_g_1364: // Murphy dies, but not in any case
228 bl = HighByte(PlayField16[si + FieldWidth]);
229 if (bl == 0xE || bl == 0xF || bl == 0x28)
230 return subAnimateInfotrons;
232 if (bl == 0x29 || bl == 0x25 || bl == 0x26)
233 return subAnimateInfotrons;
235 loc_g_1386: // someone dies/explodes immediately
236 si = si + FieldWidth; // 1 field down
237 ExplodeFieldSP(si); // Explode
238 return subAnimateInfotrons;
240 loc_g_138D: // infotron comes rolling from right to left
241 // To Do: draw infotron rolling from right
242 // according to position in (bl And &H07)
243 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
244 X = GetStretchX(si + 1);
248 StretchedSprites.BltImg(X, Y, aniSpace, 0);
249 StretchedSprites.BltImg(X - (TwoPixels * dx), Y, aniInfotronRollLeft, dx - 1);
251 StretchedSprites.BltEx(X, Y, 0);
252 StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniFramesInfotronRollLeft[dx - 1]);
254 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
255 bl = HighByte(PlayField16[si]) + 1; // get and increment sequence#
257 PlayField16[si + 1] = 0xAAAA;
261 MovHighByte(&PlayField16[si], bl);
262 subCleanUpForInfotronsAbove(si + 1);
266 MovHighByte(&PlayField16[si], bl);
270 PlayField16[si] = 0x7004; // go into intermediate state
273 return subAnimateInfotrons;
275 loc_g_13E9: // infotron comes rolling from left to right
276 // To Do: draw infotron rolling from left
277 // according to position in (bl And &H07)
278 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
279 X = GetStretchX(si - 1);
283 StretchedSprites.BltImg(X, Y, aniSpace, 0);
284 StretchedSprites.BltImg(X + (TwoPixels * dx), Y, aniInfotronRollRight, dx - 1);
286 StretchedSprites.BltEx(X, Y, 0);
287 StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniFramesInfotronRollRight[dx - 1]);
289 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
290 bl = HighByte(PlayField16[si]) + 1;
292 PlayField16[si - 1] = 0xAAAA;
296 MovHighByte(&PlayField16[si], bl);
297 subCleanUpForInfotronsAbove(si - 1);
301 MovHighByte(&PlayField16[si], bl);
305 PlayField16[si] = 0x7004; // go into intermediate state
308 return subAnimateInfotrons;
310 loc_g_1444: // infotron falls straight down
314 MovHighByte(&PlayField16[si], bl);
316 else if (PlayField16[si + FieldWidth] != 0)
318 bl = bl - 1; // stay waiting
319 MovHighByte(&PlayField16[si], bl);
323 PlayField16[si] = 0xFFFF;
324 si = si + FieldWidth; // 1 field down
325 PlayField16[si] = 0x1004; // go falling
328 return subAnimateInfotrons;
330 loc_g_1472: // infotron rolls left
331 // To Do: draw infotron rolling to left
332 // according to position in (bl And &H0F)
333 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
338 StretchedSprites.BltImg(X, Y, aniSpace, 0);
339 StretchedSprites.BltImg(X - (TwoPixels * dx), Y, aniInfotronRollLeft, dx - 1);
341 StretchedSprites.BltEx(X, Y, 0);
342 StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniFramesInfotronRollLeft[dx - 1]);
344 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
345 bl = HighByte(PlayField16[si]) + 1; // retrieve and increment sequence#
348 MovHighByte(&PlayField16[si], bl);
349 return subAnimateInfotrons;
352 if (PlayField16[si + FieldWidth - 1] != 0)
355 if (PlayField16[si - 1] != 0)
357 if (PlayField16[si - 1] != 0x8888)
361 PlayField16[si] = 0xFFFF;
362 si = si - 1; // 1 field left
363 PlayField16[si] = 0x2204;
364 PlayField16[si + FieldWidth] = 0x9999;
365 return subAnimateInfotrons;
367 loc_g_14D9: // stay waiting
369 MovHighByte(&PlayField16[si], bl);
370 return subAnimateInfotrons;
372 loc_g_14E0: // infotron rolls right
373 // To Do: draw infotron rolling to right
374 // according to position in (bl And &H07)
375 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
380 StretchedSprites.BltImg(X, Y, aniSpace, 0);
381 StretchedSprites.BltImg(X + (TwoPixels * dx), Y, aniInfotronRollRight, dx - 1);
383 StretchedSprites.BltEx(X, Y, 0);
384 StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniFramesInfotronRollRight[dx - 1]);
386 // +++++++++++++++++++++++++++++++++++++++++++++++++++++
387 bl = HighByte(PlayField16[si]) + 1;
390 MovHighByte(&PlayField16[si], bl);
391 return subAnimateInfotrons;
394 if (PlayField16[si + FieldWidth + 1] != 0)
397 if (PlayField16[si + 1] != 0)
399 if (PlayField16[si + 1] != 0x8888)
403 PlayField16[si] = 0xFFFF;
405 PlayField16[si] = 0x3204;
406 PlayField16[si + FieldWidth] = 0x9999;
407 return subAnimateInfotrons;
409 loc_g_1547: // stay waiting
411 MovHighByte(&PlayField16[si], bl);
412 return subAnimateInfotrons;
414 loc_g_154E: // intermediate state
415 ax = PlayField16[si + FieldWidth];
416 if (ax == 0 || ax == 0x9999)
418 PlayField16[si] = 0xFFFF;
419 si = si + FieldWidth; // 1 field down
420 PlayField16[si] = 0x1004; // start falling down
424 return subAnimateInfotrons;
425 } // subAnimateInfotrons
427 int subCleanUpForInfotronsAbove(int si)
429 int subCleanUpForInfotronsAbove;
433 if (LowByte(PlayField16[si]) != fiExplosion)
436 if (PlayField16[si - FieldWidth] != 0)
438 if (PlayField16[si - FieldWidth] != 0x9999)
439 return subCleanUpForInfotronsAbove;
441 if (LowByte(PlayField16[si - 2 * FieldWidth]) != fiZonk)
442 return subCleanUpForInfotronsAbove;
445 if (PlayField16[si - FieldWidth - 1] == fiInfotron)
449 if (PlayField16[si - FieldWidth + 1] == fiInfotron)
452 return subCleanUpForInfotronsAbove;
455 ax = PlayField16[si - 1];
456 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
458 PlayField16[si - FieldWidth - 1] = 0x6004;
459 PlayField16[si - FieldWidth] = 0x8888;
460 return subCleanUpForInfotronsAbove;
466 ax = PlayField16[si + 1];
467 if (ax == fiZonk || ax == fiInfotron || ax == fiRAM)
469 PlayField16[si - FieldWidth + 1] = 0x5004;
470 PlayField16[si - FieldWidth] = 0x8888;
473 return subCleanUpForInfotronsAbove;
474 } // subCleanUpForInfotronsAbove