1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
5 #include "DoGameStuff.h"
8 static void CallAnimation(int si, byte bl);
9 static boolean IsToBeAnimated(int bl);
11 int *AnimationPosTable;
12 byte *AnimationSubTable;
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 &&
74 printf("::: DoGameStuff.c: killing murphy [%d] ...\n", KillMurphyFlag);
77 KillMurphyFlag = 0; // no more "kill Murphy"
78 ExplodeFieldSP(MurphyExplodePos); // Explode
79 LeadOutCounter = 0x40; // quit: start lead-out
82 printf("::: DoGameStuff.c: !!!!!!!!!! GAME OVER !!!!!!!!!!\n");
83 printf("::: [KillMurphyFlag == %d]\n", KillMurphyFlag);
86 /* give Murphy some more time (LeadOutCounter) to reach the exit */
91 static boolean IsToBeAnimated(int bl)
93 static boolean IsToBeAnimated;
105 IsToBeAnimated = True;
109 IsToBeAnimated = False;
113 return IsToBeAnimated;
116 static void CallAnimation(int si, byte bl)
125 subAnimateInfotrons(si);
129 subAnimateOrangeDisks(si);
133 subAnimateSnikSnaks(si);
137 subAnimateTerminals(si);
141 subAnimateElectrons(si);
149 subAnimateExplosion(si);
153 // Debug.Assert(False);