8 struct EngineSnapshotInfo_SP engine_snapshot_sp;
10 static void init_global_values()
21 screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY,
24 DDSpriteBuffer_Init();
31 unsigned int InitEngineRandom_SP(long seed)
33 if (seed == NEW_RANDOMIZE)
37 seed = (long)RandomSeed;
40 RandomSeed = (short)seed;
42 return (unsigned int) seed;
46 /* ------------------------------------------------------------------------- */
47 /* Supaplex game engine snapshot handling functions */
48 /* ------------------------------------------------------------------------- */
50 void SaveEngineSnapshotValues_SP()
54 engine_snapshot_sp.game_sp = game_sp;
56 /* these arrays have playfield-size dependent variable size */
58 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
59 engine_snapshot_sp.PlayField16[i] = PlayField16[i];
60 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
61 engine_snapshot_sp.PlayField8[i] = PlayField8[i];
62 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
63 engine_snapshot_sp.DisPlayField[i] = DisPlayField[i];
65 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
66 engine_snapshot_sp.AnimationPosTable[i] = AnimationPosTable[i];
67 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
68 engine_snapshot_sp.AnimationSubTable[i] = AnimationSubTable[i];
69 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
70 engine_snapshot_sp.TerminalState[i] = TerminalState[i];
72 /* store special data into engine snapshot buffers */
74 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FieldWidth));
75 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FieldHeight));
76 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FieldMax));
77 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(LevelMax));
78 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FileMax));
80 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(TimerVar));
81 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RandomSeed));
83 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(TerminalMaxCycles));
85 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollX));
86 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollY));
87 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollX_last));
88 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollY_last));
90 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScreenScrollXPos));
91 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScreenScrollYPos));
92 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMinX));
93 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMinY));
94 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMaxX));
95 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMaxY));
96 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayWidth));
97 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayHeight));
99 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(InfotronsNeeded));
100 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(KillMurphyFlag));
101 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyMoveCounter));
102 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyExplodePos));
103 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(SplitMoveFlag));
104 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskReleaseMurphyPos));
105 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyPosIndex));
106 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyXPos));
107 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyYPos));
108 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyScreenXPos));
109 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyScreenYPos));
110 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyVarFaceLeft));
111 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskCount));
112 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskReleaseFlag));
113 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MovingPictureSequencePhase));
114 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskReleasePhase));
115 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScratchGravity));
116 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GravityFlag));
117 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(SnikSnaksElectronsFrozen));
118 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(YellowDisksExploded));
119 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(YawnSleepCounter));
121 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(LeadOutCounter));
123 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxElementLast));
124 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxGraphicLast));
125 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxGraphic));
126 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxFrame));
128 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMinX));
129 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMinY));
130 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMaxX));
131 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMaxY));
132 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollX));
133 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollY));
135 SaveEngineSnapshotBuffer(&PlayField16[-game_sp.preceding_buffer_size],
136 game_sp.preceding_buffer_size * sizeof(int));
139 void LoadEngineSnapshotValues_SP()
143 /* stored engine snapshot buffers already restored at this point */
145 game_sp = engine_snapshot_sp.game_sp;
147 /* these arrays have playfield-size dependent variable size */
149 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
150 PlayField16[i] = engine_snapshot_sp.PlayField16[i];
151 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
152 PlayField8[i] = engine_snapshot_sp.PlayField8[i];
153 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
154 DisPlayField[i] = engine_snapshot_sp.DisPlayField[i];
156 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
157 AnimationPosTable[i] = engine_snapshot_sp.AnimationPosTable[i];
158 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
159 AnimationSubTable[i] = engine_snapshot_sp.AnimationSubTable[i];
160 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
161 TerminalState[i] = engine_snapshot_sp.TerminalState[i];
163 RedrawPlayfield_SP(TRUE);