33#define SAVEGAME_VERSION 5
38 int i, k, l, numbuffers, lightstyles = 64;
62 memset(comment, 0,
sizeof(comment));
66 dpsnprintf(comment,
sizeof(comment),
"(crash dump of %s progs)", prog->
name);
93 for (
i=0 ;
i<lightstyles ;
i++)
111 FS_Printf(
f,
"// DarkPlaces extended savegame\n");
129 for (
i = 0;
i < numbuffers;
i++)
142 for (l = 0;l < (
int)
sizeof(line) - 2 && *s;)
169 FS_Printf(
f,
"sv.bufstr %i %i \"%s\"\n",
i, k, line);
201 Con_Print(
"save <savename> : save a game\n");
227 Con_Print(
CON_WARN "Warning: saving a multiplayer game may have strange results when restored (to properly resume, all players must join in the same player slots and then the game can be reloaded).\n");
251 int i, k, numbuffers;
259 Con_Print(
"load <savename> : load a game\n");
266 Con_Printf(
"Loading game from %s...\n", filename);
284 Con_Printf(
"SV_Loadgame_f: loading version\n");
297 Con_Printf(
"SV_Loadgame_f: loading description\n");
314 Con_Printf(
"SV_Loadgame_f: loading mapname\n");
328 Con_Printf(
"SV_Loadgame_f: spawning server\n");
341 Con_Printf(
"SV_Loadgame_f: loading light styles\n");
364 Con_Printf(
"SV_Loadgame_f: skipping until globals\n");
401 Host_Error (
"%s: first token isn't a brace", __func__);
407 Con_Printf(
"SV_Loadgame_f: loading globals\n");
450 Con_Printf(
"SV_Loadgame_f: skipping until extended data\n");
457 while (*end ==
'\r' || *end ==
'\n')
459 if (end[0] ==
'/' && end[1] ==
'*' && (end[2] ==
'\r' || end[2] ==
'\n'))
462 Con_Printf(
"SV_Loadgame_f: loading extended data\n");
464 Con_Printf(
"Loading extended DarkPlaces savegame\n");
473 if (!strcmp(
com_token,
"sv.lightstyles"))
483 else if (!strcmp(
com_token,
"sv.model_precache"))
496 else if (!strcmp(
com_token,
"sv.sound_precache"))
506 else if (!strcmp(
com_token,
"sv.buffer"))
523 Con_Printf(
CON_WARN "unexpected end of line when parsing sv.buffer (expected buffer index)\n");
525 else if (!strcmp(
com_token,
"sv.bufstr"))
541 Con_Printf(
CON_WARN "unexpected end of line when parsing sv.bufstr (expected string)\n");
544 Con_Printf(
CON_WARN "unexpected end of line when parsing sv.bufstr (expected strindex)\n");
560 for (
i = 0;
i < numbuffers;
i++)
static int Cmd_Argc(cmd_state_t *cmd)
static const char * Cmd_Argv(cmd_state_t *cmd, int arg)
Cmd_Argv(cmd, ) will return an empty string (not a NULL) if arg > argc, so string operations are alwa...
char com_token[MAX_INPUTLINE]
qbool COM_ParseToken_Simple(const char **datapointer, qbool returnnewline, qbool parsebackslash, qbool parsecomments)
int dpsnprintf(char *buffer, size_t buffersize, const char *format,...)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
#define dp_strlcpy(dst, src, dsize)
void Con_Print(const char *msg)
Prints to all appropriate console targets, and adds timestamps.
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
void Cvar_SetValueQuick(cvar_t *var, float value)
void Cvar_UpdateAllAutoCvars(cvar_state_t *cvars)
called after loading a savegame
void FS_DefaultExtension(char *path, const char *extension, size_t size_path)
unsigned char * FS_LoadFile(const char *path, mempool_t *pool, qbool quiet, fs_offset_t *filesizepointer)
qfile_t * FS_OpenRealFile(const char *filepath, const char *mode, qbool quiet)
static int(ZEXPORT *qz_inflate)(z_stream *strm
static int const char * version
int FS_Close(qfile_t *file)
int FS_Printf(qfile_t *file, const char *format,...)
int FS_Print(qfile_t *file, const char *msg)
void Host_Error(const char *error,...)
cvar_t developer_entityparsing
model_t * Mod_ForName(const char *name, qbool crash, qbool checkdisk, const char *parentname)
#define STRINGBUFFER_QCFLAGS
#define STRINGBUFFER_SAVED
void PRVM_ED_Write(prvm_prog_t *prog, struct qfile_s *f, prvm_edict_t *ed)
#define STRINGBUFFER_TEMP
#define PRVM_EDICT_NUM(n)
const char * PRVM_ED_ParseEdict(prvm_prog_t *prog, const char *data, prvm_edict_t *ent, qbool saveload)
const char * PRVM_GetString(prvm_prog_t *prog, int num)
void PRVM_ED_WriteGlobals(prvm_prog_t *prog, struct qfile_s *f)
void PRVM_ED_ParseGlobals(prvm_prog_t *prog, const char *data)
void PRVM_MEM_IncreaseEdicts(prvm_prog_t *prog)
#define PRVM_serverglobalfloat(fieldname)
#define PRVM_serveredictfloat(ed, fieldname)
#define PRVM_serveredictstring(ed, fieldname)
void BufStr_Set(prvm_prog_t *prog, prvm_stringbuffer_t *stringbuffer, int strindex, const char *str)
void BufStr_Flush(prvm_prog_t *prog)
void BufStr_Del(prvm_prog_t *prog, prvm_stringbuffer_t *stringbuffer)
prvm_stringbuffer_t * BufStr_FindCreateReplace(prvm_prog_t *prog, int bufindex, unsigned flags, const char *format)
#define ISWHITESPACEORCONTROL(ch)
#define MAX_INPUTLINE
maximum size of console commandline, QuakeC strings, and many other text processing buffers
#define SAVEGAME_COMMENT_LENGTH
max comment length of savegame in menu
#define MAX_EDICTS
max number of objects in game world at once (32768 protocol limit)
#define MAX_LIGHTSTYLES
max flickering light styles in level (note: affects savegame format)
#define MAX_SOUNDS
max number of sounds loaded at once
#define MAX_QPATH
max length of a quake game pathname
#define MAX_MODELS
max number of models loaded at once (including during level transitions)
int current_skill
skill level for currently loaded level (in case the user changes the cvar while the level is running,...
void SV_SpawnServer(const char *map)
void SV_LinkEdict(prvm_edict_t *ent)
int SV_IsLocalServer(void)
server_static_t svs
persistant server info
command interpreter state - the tokenizing and execution of commands, as well as pointers to which cv...
void(* ConnectLocal)(void)
double realtime
the accumulated mainloop time since application started (with filtering), without any slowmo or clamp...
struct host_static_t::@12 hook
void(* Disconnect)(qbool, const char *,...)
union prvm_edict_t::@30 fields
qbool free
true if this edict is unused
int entityfields
number of vec_t fields in progs (some variables are 3)
const char * name
name of the prog, e.g. "Server", "Client" or "Menu" (used for text output)
int num_edicts
copies of some vars that were former read from sv
memexpandablearray_t stringbuffersarray
struct cmd_state_s * console_cmd
points to the relevant console command interpreter for this vm (cmd_local or &cmd_server),...
int max_edicts
number of edicts for which space has been (should be) allocated
struct client_s * clients
client slots
int maxclients
number of svs.clients slots (updated by maxplayers command)
char worldbasename[MAX_QPATH]
char lightstyles[MAX_LIGHTSTYLES][64]
char sound_precache[MAX_SOUNDS][MAX_QPATH]
world_t world
collision culling data
qbool active
false if only a net client
char model_precache[MAX_MODELS][MAX_QPATH]
qbool loadgame
handle connections specially
struct model_s * models[MAX_MODELS]
char worldname[MAX_QPATH]
void SV_Loadgame_f(cmd_state_t *cmd)
void SV_Savegame_to(prvm_prog_t *prog, const char *name)
void SV_Savegame_f(cmd_state_t *cmd)
void World_UnlinkAll(world_t *world)
unlinks all entities (used before reallocation of edicts)
size_t Mem_ExpandableArray_IndexRange(const memexpandablearray_t *l)
void * Mem_ExpandableArray_RecordAtIndex(const memexpandablearray_t *l, size_t index)