8 struct EngineSnapshotInfo_SP engine_snapshot_sp;
14 screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY,
22 unsigned int InitEngineRandom_SP(long seed)
24 if (seed == NEW_RANDOMIZE)
28 seed = (long)RandomSeed;
31 RandomSeed = (short)seed;
33 return (unsigned int) seed;
37 /* ------------------------------------------------------------------------- */
38 /* Supaplex game engine snapshot handling functions */
39 /* ------------------------------------------------------------------------- */
41 void SaveEngineSnapshotValues_SP()
45 engine_snapshot_sp.game_sp = game_sp;
47 /* these arrays have playfield-size dependent variable size */
49 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
50 engine_snapshot_sp.PlayField16[i] = PlayField16[i];
51 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
52 engine_snapshot_sp.PlayField8[i] = PlayField8[i];
53 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
54 engine_snapshot_sp.DisPlayField[i] = DisPlayField[i];
56 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
57 engine_snapshot_sp.AnimationPosTable[i] = AnimationPosTable[i];
58 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
59 engine_snapshot_sp.AnimationSubTable[i] = AnimationSubTable[i];
60 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
61 engine_snapshot_sp.TerminalState[i] = TerminalState[i];
63 /* store special data into engine snapshot buffers */
65 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FieldWidth));
66 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FieldHeight));
67 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FieldMax));
68 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(LevelMax));
69 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FileMax));
71 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(TimerVar));
72 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RandomSeed));
74 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(TerminalMaxCycles));
76 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollX));
77 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollY));
78 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollX_last));
79 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(mScrollY_last));
81 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScreenScrollXPos));
82 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScreenScrollYPos));
83 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMinX));
84 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMinY));
85 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMaxX));
86 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMaxY));
88 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(InfotronsNeeded));
89 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(KillMurphyFlag));
90 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyMoveCounter));
91 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyExplodePos));
92 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(SplitMoveFlag));
93 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskReleaseMurphyPos));
94 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyPosIndex));
95 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyXPos));
96 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyYPos));
97 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyScreenXPos));
98 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyScreenYPos));
99 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MurphyVarFaceLeft));
100 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskCount));
101 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskReleaseFlag));
102 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(MovingPictureSequencePhase));
103 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RedDiskReleasePhase));
104 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScratchGravity));
105 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GravityFlag));
106 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(SnikSnaksElectronsFrozen));
107 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(YellowDisksExploded));
108 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(YawnSleepCounter));
110 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(LeadOutCounter));
112 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxElementLast));
113 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxGraphicLast));
114 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxGraphic));
115 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(GfxFrame));
117 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMinX));
118 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMinY));
119 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMaxX));
120 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollMaxY));
121 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollX));
122 SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(ScrollY));
124 SaveEngineSnapshotBuffer(&PlayField16[-game_sp.preceding_buffer_size],
125 game_sp.preceding_buffer_size * sizeof(int));
128 void LoadEngineSnapshotValues_SP()
132 /* stored engine snapshot buffers already restored at this point */
134 game_sp = engine_snapshot_sp.game_sp;
136 /* these arrays have playfield-size dependent variable size */
138 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
139 PlayField16[i] = engine_snapshot_sp.PlayField16[i];
140 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
141 PlayField8[i] = engine_snapshot_sp.PlayField8[i];
142 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
143 DisPlayField[i] = engine_snapshot_sp.DisPlayField[i];
145 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
146 AnimationPosTable[i] = engine_snapshot_sp.AnimationPosTable[i];
147 for (i = 0; i < FieldWidth * (FieldHeight - 2); i++)
148 AnimationSubTable[i] = engine_snapshot_sp.AnimationSubTable[i];
149 for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
150 TerminalState[i] = engine_snapshot_sp.TerminalState[i];
152 RedrawPlayfield_SP(TRUE);