This commit is contained in:
Shawn Walker 2014-05-23 19:08:56 -07:00
commit 01e909070a
3 changed files with 64 additions and 50 deletions

View File

@ -1597,30 +1597,9 @@ void G_UnSnapshotLevel (bool hubLoad)
//
//==========================================================================
static void writeMapName (FArchive &arc, const char *name)
{
BYTE size;
if (name[7] != 0)
{
size = 8;
}
else
{
size = (BYTE)strlen (name);
}
arc << size;
arc.Write (name, size);
}
//==========================================================================
//
//
//==========================================================================
static void writeSnapShot (FArchive &arc, level_info_t *i)
{
arc << i->snapshotVer;
writeMapName (arc, i->MapName);
arc << i->snapshotVer << i->MapName;
i->snapshot->Serialize (arc);
}
@ -1658,14 +1637,14 @@ void G_WriteSnapshots (FILE *file)
{
arc = new FPNGChunkArchive (file, VIST_ID);
}
writeMapName (*arc, wadlevelinfos[i].MapName);
(*arc) << wadlevelinfos[i].MapName;
}
}
if (arc != NULL)
{
BYTE zero = 0;
*arc << zero;
FString empty = "";
(*arc) << empty;
delete arc;
}
@ -1706,6 +1685,7 @@ void G_ReadSnapshots (PNGHandle *png)
DWORD chunkLen;
BYTE namelen;
char mapname[256];
FString MapName;
level_info_t *i;
G_ClearSnapshots ();
@ -1717,10 +1697,15 @@ void G_ReadSnapshots (PNGHandle *png)
DWORD snapver;
arc << snapver;
arc << namelen;
arc.Read (mapname, namelen);
mapname[namelen] = 0;
i = FindLevelInfo (mapname);
if (SaveVersion < 4508)
{
arc << namelen;
arc.Read(mapname, namelen);
mapname[namelen] = 0;
MapName = mapname;
}
else arc << MapName;
i = FindLevelInfo (MapName);
i->snapshotVer = snapver;
i->snapshot = new FCompressedMemFile;
i->snapshot->Serialize (arc);
@ -1746,14 +1731,25 @@ void G_ReadSnapshots (PNGHandle *png)
{
FPNGChunkArchive arc (png->File->GetFile(), VIST_ID, chunkLen);
arc << namelen;
while (namelen != 0)
if (SaveVersion < 4508)
{
arc.Read (mapname, namelen);
mapname[namelen] = 0;
i = FindLevelInfo (mapname);
i->flags |= LEVEL_VISITED;
arc << namelen;
while (namelen != 0)
{
arc.Read(mapname, namelen);
mapname[namelen] = 0;
i = FindLevelInfo(mapname);
i->flags |= LEVEL_VISITED;
arc << namelen;
}
}
else
{
while (arc << MapName, MapName.Len() > 0)
{
i = FindLevelInfo(MapName);
i->flags |= LEVEL_VISITED;
}
}
}
@ -1809,8 +1805,7 @@ CCMD(listsnapshots)
static void writeDefereds (FArchive &arc, level_info_t *i)
{
writeMapName (arc, i->MapName);
arc << i->defered;
arc << i->MapName << i->defered;
}
//==========================================================================
@ -1837,8 +1832,8 @@ void P_WriteACSDefereds (FILE *file)
if (arc != NULL)
{
// Signal end of defereds
BYTE zero = 0;
*arc << zero;
FString empty = "";
(*arc) << empty;
delete arc;
}
}
@ -1852,6 +1847,7 @@ void P_ReadACSDefereds (PNGHandle *png)
{
BYTE namelen;
char mapname[256];
FString MapName;
size_t chunklen;
P_RemoveDefereds ();
@ -1860,18 +1856,33 @@ void P_ReadACSDefereds (PNGHandle *png)
{
FPNGChunkArchive arc (png->File->GetFile(), ACSD_ID, chunklen);
arc << namelen;
while (namelen)
if (SaveVersion < 4508)
{
arc.Read (mapname, namelen);
mapname[namelen] = 0;
level_info_t *i = FindLevelInfo (mapname);
if (i == NULL)
{
I_Error ("Unknown map '%s' in savegame", mapname);
}
arc << i->defered;
arc << namelen;
while (namelen != 0)
{
arc.Read(mapname, namelen);
mapname[namelen] = 0;
level_info_t *i = FindLevelInfo(mapname);
if (i == NULL)
{
I_Error("Unknown map '%s' in savegame", mapname);
}
arc << i->defered;
arc << namelen;
}
}
else
{
while (arc << MapName, MapName.Len() > 0)
{
level_info_t *i = FindLevelInfo(MapName);
if (i == NULL)
{
I_Error("Unknown map '%s' in savegame", MapName.GetChars());
}
arc << i->defered;
}
}
}
png->File->ResetFilePtr();

View File

@ -208,6 +208,9 @@ void P_BringUpWeapon (player_t *player)
player->psprites[ps_weapon].sy = player->cheats & CF_INSTANTWEAPSWITCH
? WEAPONTOP : WEAPONBOTTOM;
P_SetPsprite (player, ps_weapon, newstate);
// make sure that the previous weapon's flash state is terminated.
// When coming here from a weapon drop it may still be active.
P_SetPsprite(player, ps_flash, NULL);
}

View File

@ -76,7 +76,7 @@ const char *GetVersionString();
// Use 4500 as the base git save version, since it's higher than the
// SVN revision ever got.
#define SAVEVER 4507
#define SAVEVER 4508
#define SAVEVERSTRINGIFY2(x) #x
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)