1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
10 boolean DemoAvailable;
13 int FieldWidth; // standard size = 60
14 int FieldHeight; // standard size = 24
15 int HeaderSize; // standard size = 96
16 int FieldMax, LevelMax;
24 // int PlayField16[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
25 // byte PlayField8[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
26 byte DisPlayField[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
44 int ScrollMinX, ScrollMaxX, ScrollMinY, ScrollMaxY;
47 int MurphyPosIndex, MurphyXPos, MurphyYPos;
48 int MurphyScreenXPos, MurphyScreenYPos;
49 int MurphyExplodePos, SplitMoveFlag, RedDiskReleaseMurphyPos;
50 int KillMurphyFlag, MurphyMoveCounter;
52 int MurphyVarFaceLeft;
53 int ScratchGravity, GravityFlag;
54 int RedDiskReleaseFlag, MovingPictureSequencePhase;
56 int YellowDisksExploded;
57 int AllowRedDiskCheat, AllowEatRightRedDiskBug;
60 int InfotronsNeeded, TotalInfotronsNeeded;
62 int SnikSnaksElectronsFrozen;
66 int RedDiskReleasePhase;
113 int aniSnikSnakTurningLeft[] =
115 aniSnikSnakTurnUpToLeft,
116 aniSnikSnakTurnLeftToDown,
117 aniSnikSnakTurnDownToRight,
118 aniSnikSnakTurnRightToUp
121 int aniSnikSnakTurningRight[] =
123 aniSnikSnakTurnUpToRight,
124 aniSnikSnakTurnRightToDown,
125 aniSnikSnakTurnDownToLeft,
126 aniSnikSnakTurnLeftToUp
130 int getSequenceLength(int sequence)
141 case aniTouchInfotron:
155 boolean isSnappingSequence(int sequence)
160 case aniTouchInfotron:
161 case aniTouchRedDisk:
171 InitPrecedingPlayfieldMemory();
173 AutoScrollFlag = True;
179 FieldMax = (FieldWidth * FieldHeight) + HeaderSize - 1;
180 LevelMax = (FieldWidth * FieldHeight) - 1;
184 /* add preceding playfield buffer (as large as preceding memory area) */
185 PlayField16 = checked_calloc((game_sp.preceding_buffer_size +
186 SP_MAX_PLAYFIELD_SIZE +
187 SP_HEADER_SIZE) * sizeof(int));
188 PlayField16 = &PlayField16[game_sp.preceding_buffer_size];
190 /* add preceding playfield buffer (as large as one playfield row) */
191 PlayField8 = checked_calloc((SP_MAX_PLAYFIELD_WIDTH +
192 SP_MAX_PLAYFIELD_SIZE +
193 SP_HEADER_SIZE) * sizeof(byte));
194 PlayField8 = &PlayField8[SP_MAX_PLAYFIELD_WIDTH];
197 /* these defaults will be changed after reading a Supaplex level file */
198 PlayField8 = REDIM_1D(sizeof(byte), 0, FieldMax);
199 DisPlayField = REDIM_1D(sizeof(byte), 0, FieldMax);
200 PlayField16 = REDIM_1D(sizeof(int), 0, FieldMax);
202 AnimationPosTable = REDIM_1D(sizeof(int), 0, LevelMax);
203 AnimationSubTable = REDIM_1D(sizeof(byte), 0, LevelMax);
204 TerminalState = REDIM_1D(sizeof(byte), 0, FieldMax);
208 int GetSI(int X, int Y)
210 return Y * FieldWidth + X;
215 return si % FieldWidth;
220 return si / FieldWidth;
223 int GetStretchX(int si)
225 return StretchWidth * (si % FieldWidth);
228 int GetStretchY(int si)
230 return StretchWidth * (si / FieldWidth);
235 copyInternalEngineVars_SP();
246 void Trace(char *Source, char *Message)
248 printf("::: Trace: Source == '%s', Message == '%s'\n", Source, Message);
251 void ReportError(char *Source, char *Message)
253 printf("::: ReportError: Source == '%s', Message == '%s'\n", Source, Message);
257 int Min(int A, int B)
259 return (A < B ? A : B);
262 int Max(int A, int B)
264 return (A < B ? B : A);