1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
8 static int *PlayField16Mem;
9 static byte *PlayField8Mem;
13 boolean DemoAvailable;
16 int FieldWidth; // standard size = 60
17 int FieldHeight; // standard size = 24
18 int HeaderSize; // standard size = 96
19 int FieldMax, LevelMax;
23 byte DisPlayField[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
32 int ScrollMinX, ScrollMaxX, ScrollMinY, ScrollMaxY;
35 int MurphyPosIndex, MurphyXPos, MurphyYPos;
36 int MurphyScreenXPos, MurphyScreenYPos;
37 int MurphyExplodePos, SplitMoveFlag, RedDiskReleaseMurphyPos;
38 int KillMurphyFlag, MurphyMoveCounter;
40 int MurphyVarFaceLeft;
41 int ScratchGravity, GravityFlag;
42 int RedDiskReleaseFlag, MovingPictureSequencePhase;
44 int YellowDisksExploded;
45 int AllowRedDiskCheat, AllowEatRightRedDiskBug;
48 int InfotronsNeeded, TotalInfotronsNeeded;
50 int SnikSnaksElectronsFrozen;
54 int RedDiskReleasePhase;
101 int aniSnikSnakTurningLeft[] =
103 aniSnikSnakTurnUpToLeft,
104 aniSnikSnakTurnLeftToDown,
105 aniSnikSnakTurnDownToRight,
106 aniSnikSnakTurnRightToUp
109 int aniSnikSnakTurningRight[] =
111 aniSnikSnakTurnUpToRight,
112 aniSnikSnakTurnRightToDown,
113 aniSnikSnakTurnDownToLeft,
114 aniSnikSnakTurnLeftToUp
118 int getSequenceLength(int sequence)
129 case aniTouchInfotron:
143 boolean isSnappingSequence(int sequence)
148 case aniTouchInfotron:
149 case aniTouchRedDisk:
157 void InitGlobals(void)
159 InitPrecedingPlayfieldMemory();
161 AutoScrollFlag = True;
167 FieldMax = (FieldWidth * FieldHeight) + HeaderSize - 1;
168 LevelMax = (FieldWidth * FieldHeight) - 1;
172 // add preceding playfield buffer (as large as preceding memory area)
173 PlayField16Mem = checked_calloc((game_sp.preceding_buffer_size +
174 SP_MAX_PLAYFIELD_SIZE +
175 SP_HEADER_SIZE) * sizeof(int));
176 PlayField16 = &PlayField16Mem[game_sp.preceding_buffer_size];
178 // add preceding playfield buffer (as large as one playfield row)
179 PlayField8Mem = checked_calloc((SP_MAX_PLAYFIELD_WIDTH +
180 SP_MAX_PLAYFIELD_SIZE +
181 SP_HEADER_SIZE) * sizeof(byte));
182 PlayField8 = &PlayField8Mem[SP_MAX_PLAYFIELD_WIDTH];
185 void FreeGlobals(void)
187 checked_free(PlayField16Mem);
188 checked_free(PlayField8Mem);
191 int GetSI(int X, int Y)
193 return Y * FieldWidth + X;
198 return si % FieldWidth;
203 return si / FieldWidth;
206 int GetStretchX(int si)
208 return StretchWidth * (si % FieldWidth);
211 int GetStretchY(int si)
213 return StretchWidth * (si / FieldWidth);
216 void PrepareLevel(void)
218 copyInternalEngineVars_SP();
226 int Min(int A, int B)
228 return (A < B ? A : B);
231 int Max(int A, int B)
233 return (A < B ? B : A);