From 18c1b2685ff7b2f173d3801d881dcd3526d6696c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 9 Oct 2009 06:38:56 +0000 Subject: [PATCH] - fixed: AAmbientSound::Serialize was adjusting its timer value for savegames even when it was set to a 'don't check' value. SVN r1902 (trunk) --- docs/rh-log.txt | 4 ++++ src/s_advsound.cpp | 31 +++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index a5a3ff96f..1e6b1e883 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,7 @@ +October 9, 2009 (Changes by Graf Zahl) +- fixed: AAmbientSound::Serialize was adjusting its timer value for savegames + even when it was set to a 'don't check' value. + October 8, 2009 - Reinstated the off-by-one check in D3DFB from r399. I thought I could get by at just fixing it at a specific value, since the supply of SM14 cards isn't diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index 31d2d94f2..11c541f45 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -1917,11 +1917,34 @@ void AAmbientSound::Serialize (FArchive &arc) Super::Serialize (arc); arc << bActive; - int checktime = NextCheck - gametic; - arc << checktime; - if (arc.IsLoading ()) + if (SaveVersion < 1902) { - NextCheck = checktime + gametic; + arc << NextCheck; + NextCheck += gametic; + if (NextCheck < 0) NextCheck = INT_MAX; + } + else + { + if (arc.IsStoring()) + { + if (NextCheck != INT_MAX) + { + int checktime = NextCheck - gametic; + arc << checktime; + } + else + { + arc << NextCheck; + } + } + else + { + arc << NextCheck; + if (checktime != INT_MAX) + { + NextCheck += gametic; + } + } } }