- Restored savegame compatibility that was removed in r3427.

SVN r3435 (trunk)
This commit is contained in:
Randy Heit 2012-03-13 02:43:24 +00:00
parent c05345668c
commit 58f7e72d1b
8 changed files with 128 additions and 34 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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);
}
}
}
}

View File

@ -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;

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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