241{
246 const char *start;
247 const char *end;
248 const char *t;
249 char *text;
251 int i, k, numbuffers;
256
258 {
259 Con_Print(
"load <savename> : load a game\n");
260 return;
261 }
262
265
266 Con_Printf(
"Loading game from %s...\n", filename);
267
268 if(
host.hook.Disconnect)
270
271 if(
host.hook.ToggleMenu)
272 host.hook.ToggleMenu();
273
275
277 if (!text)
278 {
280 return;
281 }
282
284 Con_Printf(
"SV_Loadgame_f: loading version\n");
285
286
290 {
293 return;
294 }
295
297 Con_Printf(
"SV_Loadgame_f: loading description\n");
298
299
301
303 {
306 }
307
309
312
314 Con_Printf(
"SV_Loadgame_f: loading mapname\n");
315
316
319
322
323
326
328 Con_Printf(
"SV_Loadgame_f: spawning server\n");
329
332 {
335 return;
336 }
339
341 Con_Printf(
"SV_Loadgame_f: loading light styles\n");
342
343
344
345
347
349 {
350
351 start = t;
353
354
356 {
357 t = start;
358 break;
359 }
361 }
362
364 Con_Printf(
"SV_Loadgame_f: skipping until globals\n");
365
366
367
368
369
370 for (;;)
371 {
372 start = t;
374 break;
376 {
377 t = start;
378 break;
379 }
380 }
381
382
384
385
386 end = t;
387 for (;;)
388 {
389 start = t;
392 break;
394 {
395
396 break;
397 }
399 {
401 Host_Error (
"%s: first token isn't a brace", __func__);
402 }
403
405 {
407 Con_Printf(
"SV_Loadgame_f: loading globals\n");
408
409
411
412
414 }
415 else
416 {
417
419 {
422 }
428
431
433
434
437 }
438
439 end = t;
441 }
442
445
447 svs.clients[0].spawn_parms[i] = spawn_parms[i];
448
450 Con_Printf(
"SV_Loadgame_f: skipping until extended data\n");
451
452
453
454
455 if(end)
456 {
457 while (*end == '\r' || *end == '\n')
458 end++;
459 if (end[0] == '/' && end[1] == '*' && (end[2] == '\r' || end[2] == '\n'))
460 {
462 Con_Printf(
"SV_Loadgame_f: loading extended data\n");
463
464 Con_Printf(
"Loading extended DarkPlaces savegame\n");
465 t = end + 2;
466 memset(
sv.lightstyles[0], 0,
sizeof(
sv.lightstyles));
467 memset(
sv.model_precache[0], 0,
sizeof(
sv.model_precache));
468 memset(
sv.sound_precache[0], 0,
sizeof(
sv.sound_precache));
470
472 {
473 if (!strcmp(
com_token,
"sv.lightstyles"))
474 {
480 else
482 }
483 else if (!strcmp(
com_token,
"sv.model_precache"))
484 {
489 {
491 sv.models[i] =
Mod_ForName (
sv.model_precache[i],
true,
false,
sv.model_precache[i][0] ==
'*' ?
sv.worldname :
NULL);
492 }
493 else
495 }
496 else if (!strcmp(
com_token,
"sv.sound_precache"))
497 {
503 else
505 }
506 else if (!strcmp(
com_token,
"sv.buffer"))
507 {
509 {
511 if (i >= 0)
512 {
518 }
519 else
521 }
522 else
523 Con_Printf(
CON_WARN "unexpected end of line when parsing sv.buffer (expected buffer index)\n");
524 }
525 else if (!strcmp(
com_token,
"sv.bufstr"))
526 {
529 else
530 {
533 if (stringbuffer)
534 {
536 {
540 else
541 Con_Printf(
CON_WARN "unexpected end of line when parsing sv.bufstr (expected string)\n");
542 }
543 else
544 Con_Printf(
CON_WARN "unexpected end of line when parsing sv.bufstr (expected strindex)\n");
545 }
546 else
548 }
549 }
550
552 ;
553 }
554 }
555 }
557
558
560 for (i = 0; i < numbuffers; i++)
561 {
565 }
566
569
570
571 if(
sv.active &&
host.hook.ConnectLocal)
572 host.hook.ConnectLocal();
573}
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)
#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)
static int(ZEXPORT *qz_inflate)(z_stream *strm
static int const char * version
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_SAVED
#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)
void PRVM_ED_ParseGlobals(prvm_prog_t *prog, const char *data)
void PRVM_MEM_IncreaseEdicts(prvm_prog_t *prog)
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 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)
server_static_t svs
persistant server info
qbool free
true if this edict is unused
union prvm_edict_t::@130370055076073023136252053272156300303324036224 fields
int entityfields
number of vec_t fields in progs (some variables are 3)
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
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)