1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
5 #include "DoGameStuff.h"
8 static void CallAnimation(int si, byte bl);
9 static boolean IsToBeAnimated(int bl);
11 int AnimationPosTable[SP_MAX_PLAYFIELD_SIZE];
12 byte AnimationSubTable[SP_MAX_PLAYFIELD_SIZE];
15 // ==========================================================================
18 // ==========================================================================
24 subAnimateMurphy(&MurphyPosIndex); // move Murphy in any direction
26 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
27 // Build a database of locations and subs-to-call of animatable fields only:
28 // Make a snapshot from the field before the animation cycle starts.
29 // first and last line are not animated.
31 cx = LevelMax - 2 * FieldWidth - 1;
35 bl = LowByte(PlayField16[si]);
36 if (((bl & 0xD) != 0) && (bl < 0x20)) // all animatables have 1's in &H0D' above &H1F? (&H1F=explosion!)
38 if (IsToBeAnimated(bl))
40 AnimationPosTable[dx] = si;
41 AnimationSubTable[dx] = bl;
42 dx = dx + 1; // count database entries
46 si = si + 1; // next field
49 while (0 < cx); // locloop_g_2282' until all lines scanned(not top- and bottom edge)
51 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
52 // Now use the database to animate all animatables the fastest way.
53 // All the other fields are not checked anymore: those have no database entry.
54 // The field from before animation is frozen in the database in order not to
55 // do follow-up animations in the same loop.
56 if (dx != 0) // any database entries?
59 for (cx = 0; cx <= dx; cx++)
61 CallAnimation(AnimationPosTable[cx], AnimationSubTable[cx]);
62 } // loop locloop_g_22B8 ' until all animatables done
65 // All animations are done now
66 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
67 if (KillMurphyFlag == 1 || MurphyMoveCounter == 0)
69 if (LeadOutCounter == 0 &&
70 !game_sp.LevelSolved &&
73 KillMurphyFlag = 0; // no more "kill Murphy"
74 ExplodeFieldSP(MurphyExplodePos); // Explode
75 LeadOutCounter = 0x40; // quit: start lead-out
77 /* give Murphy some more time (LeadOutCounter) to reach the exit */
82 static boolean IsToBeAnimated(int bl)
84 static boolean IsToBeAnimated;
96 IsToBeAnimated = True;
100 IsToBeAnimated = False;
104 return IsToBeAnimated;
107 static void CallAnimation(int si, byte bl)
116 subAnimateInfotrons(si);
120 subAnimateOrangeDisks(si);
124 subAnimateSnikSnaks(si);
128 subAnimateTerminals(si);
132 subAnimateElectrons(si);
140 subAnimateExplosion(si);
144 // Debug.Assert(False);