added saving static variables to engine snapshots for SP game engine
authorHolger Schemel <info@artsoft.org>
Tue, 17 Apr 2018 17:58:38 +0000 (19:58 +0200)
committerHolger Schemel <info@artsoft.org>
Tue, 17 Apr 2018 17:58:38 +0000 (19:58 +0200)
There were a number of static variables holding game engine values
that were forgotten to be saved in game engine snapshots for the
Supaplex game engine.

Storing and restoring these engine values was added by this fix.

src/game_sp/Murphy.c
src/game_sp/Murphy.h
src/game_sp/init.c

index bf590db0fd22da5b5dfe0991a440be88b764cb52..c0a148fd909df8866a04ef7e3a03f220f6318d8e 100644 (file)
@@ -11,6 +11,32 @@ static boolean subMoveKillsMurphy(int si, int ax, int bl);
 #define LocalStretch                   (2)
 #define MurphyZoomFactor               (ZoomFactor)
 
+
+// Variables that hold information about the animation sequence
+static int dx1 = 0; // image/animation token
+static int dx2 = 0; // an additional image position of a second sprite, for instance: yellow disk if pushed
+static int MurphyDX = 0, MurphyDY = 0; // murphys move steps
+static int SeqPos = 0; // index into dx()
+static int ClearPos = 0; // Position to clear before blitting sprites, none=-1
+static int dxPos = 0; // field-position  to draw dx(SeqPos)
+static int dx2Step = 0; // position of dx2 relative to dx-position
+static int dx1SequenceLength = 0;
+
+
+void SaveEngineSnapshotValues_SP_Murphy(ListNode **buffers)
+{
+  SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(dx1));
+  SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(dx2));
+  SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(MurphyDX));
+  SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(MurphyDY));
+  SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(SeqPos));
+  SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(ClearPos));
+  SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(dxPos));
+  SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(dx2Step));
+  SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(dx1SequenceLength));
+}
+
+
 // ==========================================================================
 //                              SUBROUTINE
 // Move Murphy in any direction
@@ -22,16 +48,6 @@ void subAnimateMurphy(int *si)
   int time1, time2;
   int tDeltaX, tDeltaY, tPos, Tmp;
 
-  // Variables that hold information about the animation sequence
-  static int dx1 = 0; // image/animation token
-  static int dx2 = 0; // an additional image position of a second sprite, for instance: yellow disk if pushed
-  static int MurphyDX = 0, MurphyDY = 0; // murphys move steps
-  static int SeqPos = 0; // index into dx()
-  static int ClearPos = 0; // Position to clear before blitting sprites, none=-1
-  static int dxPos = 0; // field-position  to draw dx(SeqPos)
-  static int dx2Step = 0; // position of dx2 relative to dx-position
-  static int dx1SequenceLength = 0;
-
   ax = PlayField16[*si];
   al = LowByte(ax);
 
index e0d51a352d92d6e154d671c97c3f76668f5c52a6..f9781cc2f9c289a8c09be00008aa03d0cd909f8e 100644 (file)
@@ -7,6 +7,8 @@
 
 #include "global.h"
 
+void SaveEngineSnapshotValues_SP_Murphy(ListNode **);
+
 extern void subAdjustZonksInfotronsAboveMurphy(int);
 extern void subAnimateMurphy(int *);
 extern void subCopyFieldToScreen(int, int);
index e86e3185a4972dad010f28006fd66d0e4e6beb26..af364aca8aa914db1210c3ec9d17215fde215962 100644 (file)
@@ -188,6 +188,8 @@ void SaveEngineSnapshotValues_SP(ListNode **buffers)
 
   SaveSnapshotBuffer(buffers, &PlayField16[-game_sp.preceding_buffer_size],
                     game_sp.preceding_buffer_size * sizeof(int));
+
+  SaveEngineSnapshotValues_SP_Murphy(buffers);
 }
 
 void LoadEngineSnapshotValues_SP()