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) static void writeSnapShot (FArchive &arc, level_info_t *i)
{ {
arc << i->snapshotVer; arc << i->snapshotVer << i->MapName;
writeMapName (arc, i->MapName);
i->snapshot->Serialize (arc); i->snapshot->Serialize (arc);
} }
@ -1658,14 +1637,14 @@ void G_WriteSnapshots (FILE *file)
{ {
arc = new FPNGChunkArchive (file, VIST_ID); arc = new FPNGChunkArchive (file, VIST_ID);
} }
writeMapName (*arc, wadlevelinfos[i].MapName); (*arc) << wadlevelinfos[i].MapName;
} }
} }
if (arc != NULL) if (arc != NULL)
{ {
BYTE zero = 0; FString empty = "";
*arc << zero; (*arc) << empty;
delete arc; delete arc;
} }
@ -1706,6 +1685,7 @@ void G_ReadSnapshots (PNGHandle *png)
DWORD chunkLen; DWORD chunkLen;
BYTE namelen; BYTE namelen;
char mapname[256]; char mapname[256];
FString MapName;
level_info_t *i; level_info_t *i;
G_ClearSnapshots (); G_ClearSnapshots ();
@ -1717,10 +1697,15 @@ void G_ReadSnapshots (PNGHandle *png)
DWORD snapver; DWORD snapver;
arc << snapver; arc << snapver;
if (SaveVersion < 4508)
{
arc << namelen; arc << namelen;
arc.Read(mapname, namelen); arc.Read(mapname, namelen);
mapname[namelen] = 0; mapname[namelen] = 0;
i = FindLevelInfo (mapname); MapName = mapname;
}
else arc << MapName;
i = FindLevelInfo (MapName);
i->snapshotVer = snapver; i->snapshotVer = snapver;
i->snapshot = new FCompressedMemFile; i->snapshot = new FCompressedMemFile;
i->snapshot->Serialize (arc); i->snapshot->Serialize (arc);
@ -1746,6 +1731,8 @@ void G_ReadSnapshots (PNGHandle *png)
{ {
FPNGChunkArchive arc (png->File->GetFile(), VIST_ID, chunkLen); FPNGChunkArchive arc (png->File->GetFile(), VIST_ID, chunkLen);
if (SaveVersion < 4508)
{
arc << namelen; arc << namelen;
while (namelen != 0) while (namelen != 0)
{ {
@ -1756,6 +1743,15 @@ void G_ReadSnapshots (PNGHandle *png)
arc << namelen; arc << namelen;
} }
} }
else
{
while (arc << MapName, MapName.Len() > 0)
{
i = FindLevelInfo(MapName);
i->flags |= LEVEL_VISITED;
}
}
}
chunkLen = (DWORD)M_FindPNGChunk (png, RCLS_ID); chunkLen = (DWORD)M_FindPNGChunk (png, RCLS_ID);
if (chunkLen != 0) if (chunkLen != 0)
@ -1809,8 +1805,7 @@ CCMD(listsnapshots)
static void writeDefereds (FArchive &arc, level_info_t *i) static void writeDefereds (FArchive &arc, level_info_t *i)
{ {
writeMapName (arc, i->MapName); arc << i->MapName << i->defered;
arc << i->defered;
} }
//========================================================================== //==========================================================================
@ -1837,8 +1832,8 @@ void P_WriteACSDefereds (FILE *file)
if (arc != NULL) if (arc != NULL)
{ {
// Signal end of defereds // Signal end of defereds
BYTE zero = 0; FString empty = "";
*arc << zero; (*arc) << empty;
delete arc; delete arc;
} }
} }
@ -1852,6 +1847,7 @@ void P_ReadACSDefereds (PNGHandle *png)
{ {
BYTE namelen; BYTE namelen;
char mapname[256]; char mapname[256];
FString MapName;
size_t chunklen; size_t chunklen;
P_RemoveDefereds (); P_RemoveDefereds ();
@ -1860,8 +1856,10 @@ void P_ReadACSDefereds (PNGHandle *png)
{ {
FPNGChunkArchive arc (png->File->GetFile(), ACSD_ID, chunklen); FPNGChunkArchive arc (png->File->GetFile(), ACSD_ID, chunklen);
if (SaveVersion < 4508)
{
arc << namelen; arc << namelen;
while (namelen) while (namelen != 0)
{ {
arc.Read(mapname, namelen); arc.Read(mapname, namelen);
mapname[namelen] = 0; mapname[namelen] = 0;
@ -1874,6 +1872,19 @@ void P_ReadACSDefereds (PNGHandle *png)
arc << namelen; 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(); png->File->ResetFilePtr();
} }

View File

@ -208,6 +208,9 @@ void P_BringUpWeapon (player_t *player)
player->psprites[ps_weapon].sy = player->cheats & CF_INSTANTWEAPSWITCH player->psprites[ps_weapon].sy = player->cheats & CF_INSTANTWEAPSWITCH
? WEAPONTOP : WEAPONBOTTOM; ? WEAPONTOP : WEAPONBOTTOM;
P_SetPsprite (player, ps_weapon, newstate); 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 // Use 4500 as the base git save version, since it's higher than the
// SVN revision ever got. // SVN revision ever got.
#define SAVEVER 4507 #define SAVEVER 4508
#define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY2(x) #x
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)