- added a 'noautosavehint' MAPINFO option. This does not actually block the autosave from happening. It just does not increase the autosave counter so any subsequent autosave in the same session will overwrite the last one which was saved with this hint on.

SVN r3050 (trunk)
This commit is contained in:
Christoph Oelckers 2010-12-16 09:13:06 +00:00
parent a06b88fa50
commit 6d614af4f4
4 changed files with 21 additions and 2 deletions

View File

@ -1904,6 +1904,7 @@ FString G_BuildSaveName (const char *prefix, int slot)
}
CVAR (Int, autosavenum, 0, CVAR_NOSET|CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
static int nextautosave = -1;
CVAR (Int, disableautosave, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CUSTOM_CVAR (Int, autosavecount, 4, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{
@ -1924,10 +1925,25 @@ void G_DoAutoSave ()
const char *readableTime;
int count = autosavecount != 0 ? autosavecount : 1;
num.Int = (autosavenum + 1) % count;
if (nextautosave == -1)
{
nextautosave = (autosavenum + 1) % count;
}
num.Int = nextautosave;
autosavenum.ForceSet (num, CVAR_Int);
file = G_BuildSaveName ("auto", num.Int);
file = G_BuildSaveName ("auto", nextautosave);
if (!(level.flags2 & LEVEL2_NOAUTOSAVEHINT))
{
nextautosave = (nextautosave + 1) % count;
}
else
{
// This flag can only be used once per level
level.flags2 &= ~LEVEL2_NOAUTOSAVEHINT;
}
readableTime = myasctime ();
strcpy (description, "Autosave ");

View File

@ -212,6 +212,7 @@ enum ELevelFlags
LEVEL2_NOSTATISTICS = 0x10000000, // This level should not have statistics collected
LEVEL2_ENDGAME = 0x20000000, // This is an epilogue level that cannot be quit.
LEVEL2_NOAUTOSAVEHINT = 0x40000000, // tell the game that an autosave for this level does not need to be kept
};

View File

@ -1238,6 +1238,7 @@ MapFlagHandlers[] =
{ "resethealth", MITYPE_SETFLAG2, LEVEL2_RESETHEALTH, 0 },
{ "endofgame", MITYPE_SETFLAG2, LEVEL2_ENDGAME, 0 },
{ "nostatistics", MITYPE_SETFLAG2, LEVEL2_NOSTATISTICS, 0 },
{ "noautosavehint", MITYPE_SETFLAG2, LEVEL2_NOAUTOSAVEHINT, 0 },
{ "unfreezesingleplayerconversations",MITYPE_SETFLAG2, LEVEL2_CONV_SINGLE_UNFREEZE, 0 },
{ "nobotnodes", MITYPE_IGNORE, 0, 0 }, // Skulltag option: nobotnodes
{ "compat_shorttex", MITYPE_COMPATFLAG, COMPATF_SHORTTEX},

View File

@ -2798,6 +2798,7 @@ FUNC(LS_Autosave)
{
if (gameaction != ga_savegame)
{
level.flags2 &= ~LEVEL2_NOAUTOSAVEHINT;
Net_WriteByte (DEM_CHECKAUTOSAVE);
}
return true;