1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
5 #include "DoGameStuff.h"
7 static void CallAnimation(int si, byte bl);
8 static boolean IsToBeAnimated(int bl);
10 static char *VB_Name = "modDoGameStuff";
11 // --- Option Explicit
13 int *AnimationPosTable;
14 byte *AnimationSubTable;
16 // ==========================================================================
19 // ==========================================================================
27 subAnimateMurphy(MurphyPosIndex); // move Murphy in any direction
29 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
30 // Build a database of locations and subs-to-call of animatable fields only:
31 // Make a snapshot from the field before the animation cycle starts.
32 // first and last line are not animated.
34 cx = LevelMax - 2 * FieldWidth - 1;
38 bl = LowByte(PlayField16[si]);
39 if (((bl & 0xD) != 0) && (bl < 0x20)) // all animatables have 1's in &H0D' above &H1F? (&H1F=explosion!)
41 if (IsToBeAnimated(bl))
43 AnimationPosTable[dx] = si;
44 AnimationSubTable[dx] = bl;
45 dx = dx + 1; // count database entries
49 si = si + 1; // next field
52 while (0 < cx); // locloop_g_2282' until all lines scanned(not top- and bottom edge)
54 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
55 // Now use the database to animate all animatables the fastest way.
56 // All the other fields are not checked anymore: those have no database entry.
57 // The field from before animation is frozen in the database in order not to
58 // do follow-up animations in the same loop.
59 if (dx != 0) // any database entries?
62 for (cx = 0; cx <= dx; cx++)
64 CallAnimation(AnimationPosTable[cx], AnimationSubTable[cx]);
65 } // loop locloop_g_22B8 ' until all animatables done
68 // All animations are done now
69 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
70 if (KillMurphyFlag == 1 || MurphyMoveCounter == 0)
72 if (LeadOutCounter == 0)
74 KillMurphyFlag = 0; // no more "kill Murphy"
75 ExplodeFieldSP(MurphyExplodePos); // Explode
76 LeadOutCounter = 0x40; // quit: start lead-out
81 return subDoGameStuff;
84 static boolean IsToBeAnimated(int bl)
86 static boolean IsToBeAnimated;
98 IsToBeAnimated = True;
102 IsToBeAnimated = False;
106 return IsToBeAnimated;
109 static void CallAnimation(int si, byte bl)
118 subAnimateInfotrons(si);
122 subAnimateOrangeDisks(si);
126 subAnimateSnikSnaks(si);
130 subAnimateTerminals(si);
134 subAnimateElectrons(si);
142 subAnimateExplosion(si);
146 // Debug.Assert(False);