13 struct EngineSnapshotInfo_SP engine_snapshot_sp;
15 static void init_struct_functions()
17 Stage.Blt = &DDScrollBuffer_Blt;
18 Stage.ScrollTo = &DDScrollBuffer_ScrollTo;
19 Stage.ScrollTowards = &DDScrollBuffer_ScrollTowards;
20 Stage.SoftScrollTo = &DDScrollBuffer_SoftScrollTo;
22 // StretchedSprites.BltEx = &DDSpriteBuffer_BltEx;
23 StretchedSprites.BltImg = &DDSpriteBuffer_BltImg;
26 static void init_global_values()
28 menBorder.Checked = False;
29 menPanel.Checked = True;
30 menAutoScroll.Checked = True;
32 MainForm.picPane.Width = picPane.Width = SCR_FIELDX * TILEX;
33 MainForm.picPane.Height = picPane.Height = SCR_FIELDY * TILEY;
38 init_struct_functions();
44 SetBitmaps_SP(&sp_objects);
48 /* too small for oversized levels, but too big for graphics performance */
49 /* (the whole playfield is drawn/updated, not only visible/scrolled area) */
50 /* !!! FIX THIS !!! */
51 screenBitmap = CreateBitmap(60 * TILEX, 24 * TILEY,
54 screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY,
58 DDSpriteBuffer_CreateFromFile("[NONE]", 16, 16);
65 unsigned int InitEngineRandom_SP(long seed)
67 if (seed == NEW_RANDOMIZE)
70 printf("::: init.c: InitEngineRandom_SP(): subRandomize()\n");
75 seed = (long)RandomSeed;
78 RandomSeed = (short)seed;
81 printf("::: init.c: InitEngineRandom_SP(): RandomSeed == %d\n", RandomSeed);
84 return (unsigned int) seed;
88 /* ------------------------------------------------------------------------- */
89 /* Supaplex game engine snapshot handling functions */
90 /* ------------------------------------------------------------------------- */
92 void SaveEngineSnapshotValues_SP()
96 engine_snapshot_sp.game_sp = game_sp;
98 /* these arrays have playfield-size dependent variable size */
100 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
101 engine_snapshot_sp.PlayField16[i] = PlayField16[i];
102 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
103 engine_snapshot_sp.PlayField8[i] = PlayField8[i];
104 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
105 engine_snapshot_sp.DisPlayField[i] = DisPlayField[i];
107 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
108 engine_snapshot_sp.AnimationPosTable[i] = AnimationPosTable[i];
109 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
110 engine_snapshot_sp.AnimationSubTable[i] = AnimationSubTable[i];
111 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
112 engine_snapshot_sp.TerminalState[i] = TerminalState[i];
114 /* store special data into engine snapshot buffers */
116 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FieldWidth));
117 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FieldHeight));
118 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FieldMax));
119 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(LevelMax));
120 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FileMax));
122 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(TimerVar));
123 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RandomSeed));
125 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(TerminalMaxCycles));
127 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollX));
128 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollY));
129 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollX_last));
130 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollY_last));
132 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScreenScrollXPos));
133 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScreenScrollYPos));
134 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMinX));
135 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMinY));
136 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMaxX));
137 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMaxY));
138 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayWidth));
139 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayHeight));
141 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(InfotronsNeeded));
142 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(KillMurphyFlag));
143 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyMoveCounter));
144 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyExplodePos));
145 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(SplitMoveFlag));
146 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskReleaseMurphyPos));
147 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyPosIndex));
148 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyXPos));
149 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyYPos));
150 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyScreenXPos));
151 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyScreenYPos));
152 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyVarFaceLeft));
153 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskCount));
154 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskReleaseFlag));
155 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MovingPictureSequencePhase));
156 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskReleasePhase));
157 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScratchGravity));
158 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GravityFlag));
159 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(SnikSnaksElectronsFrozen));
160 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(UpdateTimeFlag));
161 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(UpdatedFlag));
162 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(YellowDisksExploded));
163 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(YawnSleepCounter));
165 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(LeadOutCounter));
167 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxElementLast));
168 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxGraphicLast));
169 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxGraphic));
170 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxFrame));
172 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMinX));
173 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMinY));
174 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMaxX));
175 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMaxY));
176 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollX));
177 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollY));
179 SaveEngineSnapshotBuffer(&PlayField16[-game_sp.preceding_buffer_size],
180 game_sp.preceding_buffer_size * sizeof(int));
183 void LoadEngineSnapshotValues_SP()
187 /* stored engine snapshot buffers already restored at this point */
189 game_sp = engine_snapshot_sp.game_sp;
191 /* these arrays have playfield-size dependent variable size */
193 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
194 PlayField16[i] = engine_snapshot_sp.PlayField16[i];
195 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
196 PlayField8[i] = engine_snapshot_sp.PlayField8[i];
197 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
198 DisPlayField[i] = engine_snapshot_sp.DisPlayField[i];
200 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
201 AnimationPosTable[i] = engine_snapshot_sp.AnimationPosTable[i];
202 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
203 AnimationSubTable[i] = engine_snapshot_sp.AnimationSubTable[i];
204 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
205 TerminalState[i] = engine_snapshot_sp.TerminalState[i];
207 RedrawPlayfield_SP(TRUE);