PACKAGEMANAGER is now a compiletime feature in its own right, and can be enabled separately from WEBCLIENT (although won't be able to download without WEBCLIENT).

SAVEDGAMES is now a new compiletime feature. Deathmatch/dedicated servers can freely disable it.
menuqc now makes sure that any fields it needs are actually present.
developer 1 should now report glsl line numbers a bit more reliably.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5284 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2018-08-04 07:05:20 +00:00
parent 61c0b9f83b
commit 0b2be8f4ba
21 changed files with 330 additions and 164 deletions

View file

@ -1,7 +1,7 @@
#include "quakedef.h"
#include "pr_common.h"
#ifndef CLIENTONLY
#if !defined(CLIENTONLY) && defined(SAVEDGAMES)
extern cvar_t skill;
extern cvar_t deathmatch;
@ -9,7 +9,7 @@ extern cvar_t coop;
extern cvar_t teamplay;
extern cvar_t pr_enable_profiling;
cvar_t sv_savefmt = CVARFD("sv_savefmt", "1", CVAR_SAVE, "Specifies the format used for the saved game.\n0=legacy.\n1=fte\n2=binary");
cvar_t sv_savefmt = CVARFD("sv_savefmt", "", CVAR_SAVE, "Specifies the format used for the saved game.\n0=legacy.\n1=fte\n2=binary");
cvar_t sv_autosave = CVARFD("sv_autosave", "5", CVAR_SAVE, "Interval for autosaves, in minutes. Set to 0 to disable autosave.");
void SV_Savegame_f (void);
@ -78,7 +78,7 @@ void SV_SavegameComment (char *text, size_t textsize)
#ifndef QUAKETC
//expects the version to have already been parsed
void SV_Loadgame_Legacy(char *filename, vfsfile_t *f, int version)
static void SV_Loadgame_Legacy(char *filename, vfsfile_t *f, int version)
{
//FIXME: Multiplayer save probably won't work with spectators.
char mapname[MAX_QPATH];
@ -394,7 +394,7 @@ static void SV_LegacySavegame (const char *savename)
}
sprintf (name, "%s", savename);
COM_RequireExtension (name, ".sav", sizeof(name));
COM_RequireExtension (name, ".sav", sizeof(name)); //do NOT allow .pak etc
if (!FS_NativePath(name, FS_GAMEONLY, native, sizeof(native)))
return;
Con_TPrintf (U8("Saving game to %s...\n"), native);
@ -1109,7 +1109,7 @@ void SV_SaveLevelCache(const char *savedir, qboolean dontharmgame)
//FIXME: static entities
//FIXME: midi track
//FIXME: custom temp-ents?
//FIXME: pending uri_gets? (if only just to report fails)
//FIXME: pending uri_gets? (if only just to report fails on load)
//FIXME: routing calls?
//FIXME: sql queries?
//FIXME: frik files?

View file

@ -116,7 +116,9 @@ typedef struct
unsigned int csqcchecksum;
qboolean mapchangelocked;
#ifdef SAVEDGAMES
double autosave_time;
#endif
double time;
double starttime;
int framenum;
@ -1572,7 +1574,6 @@ typedef struct
int SV_MVD_GotQTVRequest(vfsfile_t *clientstream, char *headerstart, char *headerend, qtvpendingstate_t *p);
// savegame.c
void SV_LegacySavegame_f(void);
void SV_Savegame_f (void);
void SV_Savegame_c(int argn, const char *partial, struct xcommandargcompletioncb_s *ctx);
void SV_Loadgame_f (void);

View file

@ -675,6 +675,7 @@ void SV_Map_f (void)
if (!isrestart)
SV_SaveSpawnparms ();
#ifdef SAVEDGAMES
if (newunit)
SV_FlushLevelCache(); //forget all on new unit
else if (startspot && !isrestart && !newunit)
@ -698,6 +699,7 @@ void SV_Map_f (void)
#endif
SV_SaveLevelCache(NULL, false);
}
#endif
#ifdef Q3SERVER
{
@ -783,7 +785,11 @@ void SV_Map_f (void)
}
SCR_SetLoadingFile("spawnserver");
if (newunit || !startspot || cinematic || !SV_LoadLevelCache(NULL, level, startspot, false))
if (newunit || !startspot || cinematic
#ifdef SAVEDGAMES
|| !SV_LoadLevelCache(NULL, level, startspot, false)
#endif
)
{
if (waschangelevel && !startspot)
startspot = "";
@ -854,12 +860,13 @@ void SV_Map_f (void)
Cvar_Set(nsv, "");
}
#ifdef SAVEDGAMES
if (q2savetos0)
{
if (sv.state != ss_cinematic) //too weird.
SV_Savegame("s0", true);
}
#endif
if (isDedicated)
Mod_Purge(MP_MAPCHANGED);

View file

@ -650,7 +650,9 @@ void SV_UnspawnServer (void) //terminate the running server.
free(svs.clients);
svs.clients = NULL;
svs.allocated_client_slots = 0;
#ifdef SAVEDGAMES
SV_FlushLevelCache();
#endif
NET_CloseServer ();
SV_RunCmdCleanup();
}
@ -1614,7 +1616,9 @@ void SV_SpawnServer (const char *server, const char *startspot, qboolean noents,
if (!startspot)
{
#ifdef SAVEDGAMES
SV_FlushLevelCache(); //to make sure it's caught
#endif
for (i=0 ; i<sv.allocated_client_slots ; i++)
{
if (svs.clients[i].spawninfo)
@ -1730,7 +1734,9 @@ void SV_SpawnServer (const char *server, const char *startspot, qboolean noents,
SV_SetMoveVars();
sv.starttime = Sys_DoubleTime() - sv.time;
#ifdef SAVEDGAMES
sv.autosave_time = sv.time + sv_autosave.value*60;
#endif
}
#endif

View file

@ -4899,8 +4899,10 @@ float SV_Frame (void)
{
isidle = false;
#ifdef SAVEDGAMES
if (sv.time > sv.autosave_time)
SV_AutoSave();
#endif
}
}
else
@ -5203,10 +5205,9 @@ void SV_InitLocal (void)
Cmd_AddCommand ("openroute", SV_OpenRoute_f);
#ifndef NOBUILTINMENUS
#ifndef SERVERONLY
#ifdef SAVEDGAMES
#if !defined(NOBUILTINMENUS) && !defined(SERVERONLY)
Cvar_Register(&sv_autosave, cvargroup_servercontrol);
#endif
#endif
Cvar_Register(&sv_savefmt, cvargroup_servercontrol);
#ifndef QUAKETC
@ -5216,6 +5217,7 @@ void SV_InitLocal (void)
Cmd_AddCommandAD ("loadgame", SV_Loadgame_f, SV_Savegame_c, "Loads an existing saved game.");
Cmd_AddCommandAD ("save", SV_Savegame_f, SV_Savegame_c, "Saves the game to the named location.");
Cmd_AddCommandAD ("load", SV_Loadgame_f, SV_Savegame_c, "Loads an existing saved game.");
#endif
SV_MVDInit();