Code: Select all
CUSTOM_CVAR (Int, autosavecount, 4, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{
if (self<0) self=0;
if (self>20) self=20;
}
void G_DoAutoSave ()
{
// Do not autosave in multiplayer games or demos or when dead
if (multiplayer ||
demoplayback ||
players[consoleplayer].playerstate != PST_LIVE ||
disableautosave >= 2)
{
gameaction = ga_nothing;
return;
}
// Keep up to four autosaves at a time
UCVarValue num;
char name[PATH_MAX];
char *readableTime;
num.Int = (autosavenum + 1) % autosavecount;
autosavenum.ForceSet (num, CVAR_Int);
G_BuildSaveName (name, "auto", num.Int);
savegamefile = copystring (name);
readableTime = myasctime ();
strcpy (savedescription, "Autosave ");
strncpy (savedescription+9, readableTime+4, 12);
savedescription[9+12] = 0;
G_DoSaveGame (false);
}