- cleaned up switch code and fixed several problems:

* savegames stored an index in the switch table and performed no validation when loading a savegame.
  * setting of a random switch animation duration was broken.
  * separated the 2 values stored in the Time variable into 2 separate variables.
  * defining a switch with one texture already belonging to another switch could leave broken definitions in the switch table.
- added function for serializing switch and door animation pointers.
- bumped min. savegame versions due to changes to DButtonThinker and removed all current savegame compatibility code.


SVN r3030 (trunk)
This commit is contained in:
Christoph Oelckers 2010-12-12 15:43:35 +00:00
commit 0715b7dfc6
17 changed files with 194 additions and 344 deletions

View file

@ -258,18 +258,9 @@ void AActor::Serialize (FArchive &arc)
<< args[0] << args[1] << args[2] << args[3] << args[4]
<< goal
<< waterlevel
<< MinMissileChance;
if (SaveVersion >= 2826)
{
arc << SpawnFlags;
}
else
{
WORD w;
arc << w;
SpawnFlags = w;
}
arc << Inventory
<< MinMissileChance
<< SpawnFlags
<< Inventory
<< InventoryID
<< id
<< FloatBobPhase
@ -281,12 +272,9 @@ void AActor::Serialize (FArchive &arc)
<< ActiveSound
<< UseSound
<< BounceSound
<< WallBounceSound;
if (SaveVersion >= 2234)
{
arc << CrushPainSound;
}
arc << Speed
<< WallBounceSound
<< CrushPainSound
<< Speed
<< FloatSpeed
<< Mass
<< PainChance
@ -313,83 +301,14 @@ void AActor::Serialize (FArchive &arc)
<< pushfactor
<< Species
<< Score
<< Tag;
if (SaveVersion >= 1904)
{
arc << lastpush << lastbump;
}
if (SaveVersion >= 1900)
{
arc << PainThreshold;
}
if (SaveVersion >= 1914)
{
arc << DamageFactor;
}
if (SaveVersion > 2036)
{
arc << WeaveIndexXY << WeaveIndexZ;
}
else
{
int index;
if (SaveVersion < 2036)
{
index = special2;
}
else
{
arc << index;
}
// A_BishopMissileWeave and A_CStaffMissileSlither stored the weaveXY
// value in different parts of the index.
if (this->IsKindOf(PClass::FindClass("BishopFX")))
{
WeaveIndexXY = index >> 16;
WeaveIndexZ = index;
}
else
{
WeaveIndexXY = index;
WeaveIndexZ = 0;
}
}
if (SaveVersion >= 2450)
{
arc << PoisonDamageReceived << PoisonDurationReceived << PoisonPeriodReceived << Poisoner;
arc << PoisonDamage << PoisonDuration << PoisonPeriod;
}
// Skip past uservar array in old savegames
if (SaveVersion < 1933)
{
int foo;
for (int i = 0; i < 10; ++i)
arc << foo;
}
if (SaveVersion > 2560)
{
arc << ConversationRoot << Conversation;
}
else // old code which uses relative indexing.
{
int convnum;
convnum = arc.ReadCount();
if (GetConversation(GetClass()->TypeName) == -1)
{
Conversation = NULL;
ConversationRoot = -1;
}
else
{
// This cannot be restored anymore.
I_Error("Cannot load old savegames with active dialogues");
}
}
<< Tag
<< lastpush << lastbump
<< PainThreshold
<< DamageFactor
<< WeaveIndexXY << WeaveIndexZ
<< PoisonDamageReceived << PoisonDurationReceived << PoisonPeriodReceived << Poisoner
<< PoisonDamage << PoisonDuration << PoisonPeriod
<< ConversationRoot << Conversation;
if (arc.IsLoading ())
{