added separate time counter for tape time frames
authorHolger Schemel <info@artsoft.org>
Sat, 10 Feb 2024 20:16:05 +0000 (21:16 +0100)
committerHolger Schemel <info@artsoft.org>
Sun, 18 Feb 2024 14:57:40 +0000 (15:57 +0100)
src/game.c
src/main.c
src/main.h

index 3f02c087311b7d840ab261b0ac890664a11a064b..789fb0159ba165689ba3b14896f58855ef41f7d0 100644 (file)
@@ -3843,6 +3843,8 @@ void InitGame(void)
   TimeFrames = 0;
   TimePlayed = 0;
   TimeLeft = level.time;
+
+  TapeTimeFrames = 0;
   TapeTime = 0;
 
   ScreenMovDir = MV_NONE;
@@ -11679,7 +11681,6 @@ static void CheckLevelTime(void)
   if (TimeFrames >= FRAMES_PER_SECOND)
   {
     TimeFrames = 0;
-    TapeTime++;
 
     for (i = 0; i < MAX_PLAYERS; i++)
     {
@@ -11726,6 +11727,12 @@ static void CheckLevelTime(void)
 
       game_em.lev->time = (game.no_level_time_limit ? TimePlayed : TimeLeft);
     }
+  }
+
+  if (TapeTimeFrames >= FRAMES_PER_SECOND)
+  {
+    TapeTimeFrames = 0;
+    TapeTime++;
 
     if (tape.recording || tape.playing)
       DrawVideoDisplay(VIDEO_STATE_TIME_ON, TapeTime);
@@ -11741,8 +11748,11 @@ void AdvanceFrameAndPlayerCounters(int player_nr)
 {
   int i;
 
-  // advance frame counters (global frame counter and time frame counter)
+  // advance frame counters (global frame counter and tape time frame counter)
   FrameCounter++;
+  TapeTimeFrames++;
+
+  // advance time frame counter (used to control available time to solve level)
   TimeFrames++;
 
   // advance player counters (counters for move delay, move animation etc.)
@@ -16036,6 +16046,7 @@ static ListNode *SaveEngineSnapshotBuffers(void)
   SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(TimeFrames));
   SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(TimePlayed));
   SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(TimeLeft));
+  SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(TapeTimeFrames));
   SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(TapeTime));
 
   SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(ScreenMovDir));
index 168a650b9e2ef8c3183eea6c450e4e19d2fb37eb..d3241c11e197e4b6234fe34ffa520931bce20257 100644 (file)
@@ -124,7 +124,8 @@ int                 BX2, BY2;
 int                    SBX_Left, SBX_Right;
 int                    SBY_Upper, SBY_Lower;
 
-int                    TimeFrames, TimePlayed, TimeLeft, TapeTime;
+int                    TimeFrames, TimePlayed, TimeLeft;
+int                    TapeTimeFrames, TapeTime;
 
 boolean                        network_player_action_received = FALSE;
 
index e5f50a4e73ce5dc6ffd6c68abdb0768273bccb5f..2906946675d805c773f5ad8dc94a6f3ad1d3dedd 100644 (file)
@@ -3916,7 +3916,8 @@ extern int                        BX2, BY2;
 extern int                     SBX_Left, SBX_Right;
 extern int                     SBY_Upper, SBY_Lower;
 
-extern int                     TimeFrames, TimePlayed, TimeLeft, TapeTime;
+extern int                     TimeFrames, TimePlayed, TimeLeft;
+extern int                     TapeTimeFrames, TapeTime;
 
 extern boolean                 network_player_action_received;