diff --git a/src/g_level.cpp b/src/g_level.cpp index 194ebb888..97061852e 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1367,8 +1367,12 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad) << level.aircontrol << level.teamdamage << level.maptime - << i - << level.nextmusic; + << i; + + if (SaveVersion >= 3313) + { + arc << level.nextmusic; + } // Hub transitions must keep the current total time if (!hubLoad) diff --git a/src/g_shared/a_lightning.cpp b/src/g_shared/a_lightning.cpp index 80e83e1e4..e7c598d3e 100644 --- a/src/g_shared/a_lightning.cpp +++ b/src/g_shared/a_lightning.cpp @@ -44,6 +44,26 @@ void DLightningThinker::Serialize (FArchive &arc) arc << Stopped << NextLightningFlash << LightningFlashCount; + if (SaveVersion < 3243) + { + // Do nothing with old savegames and just keep whatever the constructor made + // but read the obsolete data from the savegame + for (i = (numsectors + (numsectors+7)/8); i > 0; --i) + { + if (SaveVersion < 3223) + { + BYTE bytelight; + arc << bytelight; + } + else + { + short shortlight; + arc << shortlight; + } + } + return; + } + if (arc.IsLoading ()) { if (LightningLightLevels != NULL) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 5d520ffb7..a50113782 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -2032,19 +2032,35 @@ void FBehavior::StaticStopMyScripts (AActor *actor) void P_SerializeACSScriptNumber(FArchive &arc, int &scriptnum, bool was2byte) { - arc << scriptnum; - // If the script number is negative, then it's really a name. - // So read/store the name after it. - if (scriptnum < 0) + if (SaveVersion < 3359) { - if (arc.IsStoring()) + if (was2byte) { - arc.WriteName(FName(ENamedName(-scriptnum)).GetChars()); + WORD oldver; + arc << oldver; + scriptnum = oldver; } else { - const char *nam = arc.ReadName(); - scriptnum = -FName(nam); + arc << scriptnum; + } + } + else + { + arc << scriptnum; + // If the script number is negative, then it's really a name. + // So read/store the name after it. + if (scriptnum < 0) + { + if (arc.IsStoring()) + { + arc.WriteName(FName(ENamedName(-scriptnum)).GetChars()); + } + else + { + const char *nam = arc.ReadName(); + scriptnum = -FName(nam); + } } } } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 68dbf2707..3d676cddc 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -230,9 +230,12 @@ void AActor::Serialize (FArchive &arc) << velz << tics << state - << Damage - << projectileKickback - << flags + << Damage; + if (SaveVersion >= 3227) + { + arc << projectileKickback; + } + arc << flags << flags2 << flags3 << flags4 @@ -266,10 +269,12 @@ void AActor::Serialize (FArchive &arc) { arc << args[0]; } - arc << args[1] << args[2] << args[3] << args[4] - << accuracy - << stamina - << goal + arc << args[1] << args[2] << args[3] << args[4]; + if (SaveVersion >= 3427) + { + arc << accuracy << stamina; + } + arc << goal << waterlevel << MinMissileChance << SpawnFlags @@ -304,10 +309,14 @@ void AActor::Serialize (FArchive &arc) << maxtargetrange << meleethreshold << meleerange - << DamageType + << DamageType; + if (SaveVersion >= 3237) + { + arc << PainType - << DeathType - << gravity + << DeathType; + } + arc << gravity << FastChaseStrafeCount << master << smokecounter @@ -316,16 +325,22 @@ void AActor::Serialize (FArchive &arc) << VisibleToTeam // [BB] << pushfactor << Species - << Score - << DesignatedTeam - << lastpush << lastbump + << Score; + if (SaveVersion >= 3113) + { + arc << DesignatedTeam; + } + arc << lastpush << lastbump << PainThreshold << DamageFactor << WeaveIndexXY << WeaveIndexZ << PoisonDamageReceived << PoisonDurationReceived << PoisonPeriodReceived << Poisoner - << PoisonDamage << PoisonDuration << PoisonPeriod - << PoisonDamageType << PoisonDamageTypeReceived - << ConversationRoot << Conversation; + << PoisonDamage << PoisonDuration << PoisonPeriod; + if (SaveVersion >= 3235) + { + arc << PoisonDamageType << PoisonDamageTypeReceived; + } + arc << ConversationRoot << Conversation; { FString tagstr; diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index adadbac95..3b7533efc 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -326,9 +326,18 @@ void P_SerializeWorld (FArchive &arc) for (i = 0, sec = sectors; i < numsectors; i++, sec++) { arc << sec->floorplane - << sec->ceilingplane - << sec->lightlevel - << sec->special + << sec->ceilingplane; + if (SaveVersion < 3223) + { + BYTE bytelight; + arc << bytelight; + sec->lightlevel = bytelight; + } + else + { + arc << sec->lightlevel; + } + arc << sec->special << sec->tag << sec->soundtraversed << sec->seqType diff --git a/src/p_spec.cpp b/src/p_spec.cpp index e1777cf46..a41fa2cad 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -727,7 +727,17 @@ IMPLEMENT_CLASS (DLightTransfer) void DLightTransfer::Serialize (FArchive &arc) { Super::Serialize (arc); - arc << LastLight << Source << TargetTag << CopyFloor; + if (SaveVersion < 3223) + { + BYTE bytelight; + arc << bytelight; + LastLight = bytelight; + } + else + { + arc << LastLight; + } + arc << Source << TargetTag << CopyFloor; } DLightTransfer::DLightTransfer (sector_t *srcSec, int target, bool copyFloor) @@ -810,7 +820,17 @@ IMPLEMENT_CLASS (DWallLightTransfer) void DWallLightTransfer::Serialize (FArchive &arc) { Super::Serialize (arc); - arc << LastLight << Source << TargetID << Flags; + if (SaveVersion < 3223) + { + BYTE bytelight; + arc << bytelight; + LastLight = bytelight; + } + else + { + arc << LastLight; + } + arc << Source << TargetID << Flags; } DWallLightTransfer::DWallLightTransfer (sector_t *srcSec, int target, BYTE flags) diff --git a/src/p_user.cpp b/src/p_user.cpp index 955003937..de48cf20b 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -2613,8 +2613,18 @@ void player_t::Serialize (FArchive &arc) << BlendR << BlendG << BlendB - << BlendA - << LogText + << BlendA; + if (SaveVersion < 3427) + { + WORD oldaccuracy, oldstamina; + arc << oldaccuracy << oldstamina; + if (mo != NULL) + { + mo->accuracy = oldaccuracy; + mo->stamina = oldstamina; + } + } + arc << LogText << ConversationNPC << ConversationPC << ConversationNPCAngle diff --git a/src/version.h b/src/version.h index 524f494d7..ab877820d 100644 --- a/src/version.h +++ b/src/version.h @@ -75,7 +75,7 @@ // SAVESIG should match SAVEVER. // MINSAVEVER is the minimum level snapshot version that can be loaded. -#define MINSAVEVER 3427 +#define MINSAVEVER 3100 #if SVN_REVISION_NUMBER < MINSAVEVER // If we don't know the current revision write something very high to ensure that