8 struct EngineSnapshotInfo_SP engine_snapshot_sp;
10 static void init_struct_functions()
12 Stage.Blt = &DDScrollBuffer_Blt;
13 Stage.ScrollTo = &DDScrollBuffer_ScrollTo;
14 Stage.ScrollTowards = &DDScrollBuffer_ScrollTowards;
15 Stage.SoftScrollTo = &DDScrollBuffer_SoftScrollTo;
17 // StretchedSprites.BltEx = &DDSpriteBuffer_BltEx;
18 StretchedSprites.BltImg = &DDSpriteBuffer_BltImg;
21 static void init_global_values()
23 menBorder.Checked = False;
24 menPanel.Checked = True;
25 menAutoScroll.Checked = True;
27 MainForm.picPane.Width = picPane.Width = SCR_FIELDX * TILEX;
28 MainForm.picPane.Height = picPane.Height = SCR_FIELDY * TILEY;
33 init_struct_functions();
38 screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY,
41 DDSpriteBuffer_Init();
48 unsigned int InitEngineRandom_SP(long seed)
50 if (seed == NEW_RANDOMIZE)
53 printf("::: init.c: InitEngineRandom_SP(): subRandomize()\n");
58 seed = (long)RandomSeed;
61 RandomSeed = (short)seed;
64 printf("::: init.c: InitEngineRandom_SP(): RandomSeed == %d\n", RandomSeed);
67 return (unsigned int) seed;
71 /* ------------------------------------------------------------------------- */
72 /* Supaplex game engine snapshot handling functions */
73 /* ------------------------------------------------------------------------- */
75 void SaveEngineSnapshotValues_SP()
79 engine_snapshot_sp.game_sp = game_sp;
81 /* these arrays have playfield-size dependent variable size */
83 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
84 engine_snapshot_sp.PlayField16[i] = PlayField16[i];
85 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
86 engine_snapshot_sp.PlayField8[i] = PlayField8[i];
87 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
88 engine_snapshot_sp.DisPlayField[i] = DisPlayField[i];
90 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
91 engine_snapshot_sp.AnimationPosTable[i] = AnimationPosTable[i];
92 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
93 engine_snapshot_sp.AnimationSubTable[i] = AnimationSubTable[i];
94 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
95 engine_snapshot_sp.TerminalState[i] = TerminalState[i];
97 /* store special data into engine snapshot buffers */
99 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FieldWidth));
100 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FieldHeight));
101 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FieldMax));
102 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(LevelMax));
103 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FileMax));
105 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(TimerVar));
106 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RandomSeed));
108 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(TerminalMaxCycles));
110 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollX));
111 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollY));
112 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollX_last));
113 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollY_last));
115 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScreenScrollXPos));
116 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScreenScrollYPos));
117 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMinX));
118 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMinY));
119 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMaxX));
120 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMaxY));
121 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayWidth));
122 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayHeight));
124 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(InfotronsNeeded));
125 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(KillMurphyFlag));
126 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyMoveCounter));
127 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyExplodePos));
128 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(SplitMoveFlag));
129 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskReleaseMurphyPos));
130 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyPosIndex));
131 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyXPos));
132 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyYPos));
133 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyScreenXPos));
134 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyScreenYPos));
135 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyVarFaceLeft));
136 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskCount));
137 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskReleaseFlag));
138 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MovingPictureSequencePhase));
139 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskReleasePhase));
140 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScratchGravity));
141 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GravityFlag));
142 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(SnikSnaksElectronsFrozen));
143 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(UpdateTimeFlag));
144 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(UpdatedFlag));
145 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(YellowDisksExploded));
146 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(YawnSleepCounter));
148 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(LeadOutCounter));
150 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxElementLast));
151 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxGraphicLast));
152 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxGraphic));
153 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxFrame));
155 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMinX));
156 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMinY));
157 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMaxX));
158 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMaxY));
159 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollX));
160 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollY));
162 SaveEngineSnapshotBuffer(&PlayField16[-game_sp.preceding_buffer_size],
163 game_sp.preceding_buffer_size * sizeof(int));
166 void LoadEngineSnapshotValues_SP()
170 /* stored engine snapshot buffers already restored at this point */
172 game_sp = engine_snapshot_sp.game_sp;
174 /* these arrays have playfield-size dependent variable size */
176 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
177 PlayField16[i] = engine_snapshot_sp.PlayField16[i];
178 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
179 PlayField8[i] = engine_snapshot_sp.PlayField8[i];
180 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
181 DisPlayField[i] = engine_snapshot_sp.DisPlayField[i];
183 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
184 AnimationPosTable[i] = engine_snapshot_sp.AnimationPosTable[i];
185 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
186 AnimationSubTable[i] = engine_snapshot_sp.AnimationSubTable[i];
187 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
188 TerminalState[i] = engine_snapshot_sp.TerminalState[i];
190 RedrawPlayfield_SP(TRUE);