- 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.aircontrol
<< level.teamdamage << level.teamdamage
<< level.maptime << level.maptime
<< i << i;
<< level.nextmusic;
if (SaveVersion >= 3313)
{
arc << level.nextmusic;
}
// Hub transitions must keep the current total time // Hub transitions must keep the current total time
if (!hubLoad) if (!hubLoad)

View File

@ -44,6 +44,26 @@ void DLightningThinker::Serialize (FArchive &arc)
arc << Stopped << NextLightningFlash << LightningFlashCount; 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 (arc.IsLoading ())
{ {
if (LightningLightLevels != NULL) if (LightningLightLevels != NULL)

View File

@ -2032,19 +2032,35 @@ void FBehavior::StaticStopMyScripts (AActor *actor)
void P_SerializeACSScriptNumber(FArchive &arc, int &scriptnum, bool was2byte) void P_SerializeACSScriptNumber(FArchive &arc, int &scriptnum, bool was2byte)
{ {
arc << scriptnum; if (SaveVersion < 3359)
// 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()) if (was2byte)
{ {
arc.WriteName(FName(ENamedName(-scriptnum)).GetChars()); WORD oldver;
arc << oldver;
scriptnum = oldver;
} }
else else
{ {
const char *nam = arc.ReadName(); arc << scriptnum;
scriptnum = -FName(nam); }
}
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 << velz
<< tics << tics
<< state << state
<< Damage << Damage;
<< projectileKickback if (SaveVersion >= 3227)
<< flags {
arc << projectileKickback;
}
arc << flags
<< flags2 << flags2
<< flags3 << flags3
<< flags4 << flags4
@ -266,10 +269,12 @@ void AActor::Serialize (FArchive &arc)
{ {
arc << args[0]; arc << args[0];
} }
arc << args[1] << args[2] << args[3] << args[4] arc << args[1] << args[2] << args[3] << args[4];
<< accuracy if (SaveVersion >= 3427)
<< stamina {
<< goal arc << accuracy << stamina;
}
arc << goal
<< waterlevel << waterlevel
<< MinMissileChance << MinMissileChance
<< SpawnFlags << SpawnFlags
@ -304,10 +309,14 @@ void AActor::Serialize (FArchive &arc)
<< maxtargetrange << maxtargetrange
<< meleethreshold << meleethreshold
<< meleerange << meleerange
<< DamageType << DamageType;
if (SaveVersion >= 3237)
{
arc
<< PainType << PainType
<< DeathType << DeathType;
<< gravity }
arc << gravity
<< FastChaseStrafeCount << FastChaseStrafeCount
<< master << master
<< smokecounter << smokecounter
@ -316,16 +325,22 @@ void AActor::Serialize (FArchive &arc)
<< VisibleToTeam // [BB] << VisibleToTeam // [BB]
<< pushfactor << pushfactor
<< Species << Species
<< Score << Score;
<< DesignatedTeam if (SaveVersion >= 3113)
<< lastpush << lastbump {
arc << DesignatedTeam;
}
arc << lastpush << lastbump
<< PainThreshold << PainThreshold
<< DamageFactor << DamageFactor
<< WeaveIndexXY << WeaveIndexZ << WeaveIndexXY << WeaveIndexZ
<< PoisonDamageReceived << PoisonDurationReceived << PoisonPeriodReceived << Poisoner << PoisonDamageReceived << PoisonDurationReceived << PoisonPeriodReceived << Poisoner
<< PoisonDamage << PoisonDuration << PoisonPeriod << PoisonDamage << PoisonDuration << PoisonPeriod;
<< PoisonDamageType << PoisonDamageTypeReceived if (SaveVersion >= 3235)
<< ConversationRoot << Conversation; {
arc << PoisonDamageType << PoisonDamageTypeReceived;
}
arc << ConversationRoot << Conversation;
{ {
FString tagstr; FString tagstr;

View File

@ -326,9 +326,18 @@ void P_SerializeWorld (FArchive &arc)
for (i = 0, sec = sectors; i < numsectors; i++, sec++) for (i = 0, sec = sectors; i < numsectors; i++, sec++)
{ {
arc << sec->floorplane arc << sec->floorplane
<< sec->ceilingplane << sec->ceilingplane;
<< sec->lightlevel if (SaveVersion < 3223)
<< sec->special {
BYTE bytelight;
arc << bytelight;
sec->lightlevel = bytelight;
}
else
{
arc << sec->lightlevel;
}
arc << sec->special
<< sec->tag << sec->tag
<< sec->soundtraversed << sec->soundtraversed
<< sec->seqType << sec->seqType

View File

@ -727,7 +727,17 @@ IMPLEMENT_CLASS (DLightTransfer)
void DLightTransfer::Serialize (FArchive &arc) void DLightTransfer::Serialize (FArchive &arc)
{ {
Super::Serialize (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) DLightTransfer::DLightTransfer (sector_t *srcSec, int target, bool copyFloor)
@ -810,7 +820,17 @@ IMPLEMENT_CLASS (DWallLightTransfer)
void DWallLightTransfer::Serialize (FArchive &arc) void DWallLightTransfer::Serialize (FArchive &arc)
{ {
Super::Serialize (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) DWallLightTransfer::DWallLightTransfer (sector_t *srcSec, int target, BYTE flags)

View File

@ -2613,8 +2613,18 @@ void player_t::Serialize (FArchive &arc)
<< BlendR << BlendR
<< BlendG << BlendG
<< BlendB << BlendB
<< BlendA << BlendA;
<< LogText if (SaveVersion < 3427)
{
WORD oldaccuracy, oldstamina;
arc << oldaccuracy << oldstamina;
if (mo != NULL)
{
mo->accuracy = oldaccuracy;
mo->stamina = oldstamina;
}
}
arc << LogText
<< ConversationNPC << ConversationNPC
<< ConversationPC << ConversationPC
<< ConversationNPCAngle << ConversationNPCAngle

View File

@ -75,7 +75,7 @@
// SAVESIG should match SAVEVER. // SAVESIG should match SAVEVER.
// MINSAVEVER is the minimum level snapshot version that can be loaded. // MINSAVEVER is the minimum level snapshot version that can be loaded.
#define MINSAVEVER 3427 #define MINSAVEVER 3100
#if SVN_REVISION_NUMBER < MINSAVEVER #if SVN_REVISION_NUMBER < MINSAVEVER
// If we don't know the current revision write something very high to ensure that // If we don't know the current revision write something very high to ensure that