qboolean allowcheats = false;
extern qboolean host_shuttingdown;
+extern cvar_t developer_entityparsing;
/*
==================
return;
}
+ if(developer_entityparsing.integer)
+ Con_Printf("Host_Loadgame_f: loading version\n");
+
// version
COM_ParseToken_Simple(&t, false, false);
version = atoi(com_token);
return;
}
+ if(developer_entityparsing.integer)
+ Con_Printf("Host_Loadgame_f: loading description\n");
+
// description
COM_ParseToken_Simple(&t, false, false);
current_skill = (int)(atof(com_token) + 0.5);
Cvar_SetValue ("skill", (float)current_skill);
+ if(developer_entityparsing.integer)
+ Con_Printf("Host_Loadgame_f: loading mapname\n");
+
// mapname
COM_ParseToken_Simple(&t, false, false);
strlcpy (mapname, com_token, sizeof(mapname));
+ if(developer_entityparsing.integer)
+ Con_Printf("Host_Loadgame_f: loading time\n");
+
// time
COM_ParseToken_Simple(&t, false, false);
time = atof(com_token);
allowcheats = sv_cheats.integer != 0;
+ if(developer_entityparsing.integer)
+ Con_Printf("Host_Loadgame_f: spawning server\n");
+
SV_SpawnServer (mapname);
if (!sv.active)
{
sv.paused = true; // pause until all clients connect
sv.loadgame = true;
+ if(developer_entityparsing.integer)
+ Con_Printf("Host_Loadgame_f: loading light styles\n");
+
// load the light styles
SV_VM_Begin();
strlcpy(sv.lightstyles[i], com_token, sizeof(sv.lightstyles[i]));
}
+ if(developer_entityparsing.integer)
+ Con_Printf("Host_Loadgame_f: skipping until globals\n");
+
// now skip everything before the first opening brace
// (this is for forward compatibility, so that older versions (at
// least ones with this fix) can load savegames with extra data before the
if (entnum == -1)
{
+ if(developer_entityparsing.integer)
+ Con_Printf("Host_Loadgame_f: loading globals\n");
+
// parse the global vars
PRVM_ED_ParseGlobals (start);
}
ent = PRVM_EDICT_NUM(entnum);
memset (ent->fields.server, 0, prog->progs->entityfields * 4);
ent->priv.server->free = false;
+
+ if(developer_entityparsing.integer)
+ Con_Printf("Host_Loadgame_f: loading edict %d\n", entnum);
+
PRVM_ED_ParseEdict (start, ent);
// link it into the bsp tree
for (i = 0;i < NUM_SPAWN_PARMS;i++)
svs.clients[0].spawn_parms[i] = spawn_parms[i];
+ if(developer_entityparsing.integer)
+ Con_Printf("Host_Loadgame_f: skipping until extended data\n");
+
// read extended data if present
// the extended data is stored inside a /* */ comment block, which the
// parser intentionally skips, so we have to check for it manually here
end++;
if (end[0] == '/' && end[1] == '*' && (end[2] == '\r' || end[2] == '\n'))
{
+ if(developer_entityparsing.integer)
+ Con_Printf("Host_Loadgame_f: loading extended data\n");
+
Con_Printf("Loading extended DarkPlaces savegame\n");
t = end + 2;
memset(sv.lightstyles[0], 0, sizeof(sv.lightstyles));
}
}
+ if(developer_entityparsing.integer)
+ Con_Printf("Host_Loadgame_f: finished\n");
+
SV_VM_End();
// make sure we're connected to loopback
line[i++] = '\\';
line[i++] = '\\';
}
+ else if (*s == '"')
+ {
+ line[i++] = '\\';
+ line[i++] = '"';
+ }
else
line[i++] = *s;
s++;
For savegames
=============
*/
+extern cvar_t developer_entityparsing;
void PRVM_ED_Write (qfile_t *f, prvm_edict_t *ed)
{
ddef_t *d;
{
d = &prog->fielddefs[i];
name = PRVM_GetString(d->s_name);
+
+ if(developer_entityparsing.integer)
+ Con_Printf("PRVM_ED_Write: at entity %d field %s\n", PRVM_NUM_FOR_EDICT(ed), name);
+
if (name[strlen(name)-2] == '_')
continue; // skip _x, _y, _z vars
continue;
name = PRVM_GetString(def->s_name);
+
+ if(developer_entityparsing.integer)
+ Con_Printf("PRVM_ED_WriteGlobals: at global %s\n", name);
+
FS_Printf(f,"\"%s\" ", name);
FS_Printf(f,"\"%s\"\n", PRVM_UglyValueString((etype_t)type, (prvm_eval_t *)&prog->globals.generic[def->ofs]));
}
if (com_token[0] == '}')
break;
+ if (developer_entityparsing.integer)
+ Con_Printf("Key: \"%s\"", com_token);
+
strlcpy (keyname, com_token, sizeof(keyname));
// parse value
if (!COM_ParseToken_Simple(&data, false, true))
PRVM_ERROR ("PRVM_ED_ParseGlobals: EOF without closing brace");
+ if (developer_entityparsing.integer)
+ Con_Printf(" \"%s\"\n", com_token);
+
if (com_token[0] == '}')
PRVM_ERROR ("PRVM_ED_ParseGlobals: closing brace without data");
Used for initial level load and for savegames.
====================
*/
-extern cvar_t developer_entityparsing;
const char *PRVM_ED_ParseEdict (const char *data, prvm_edict_t *ent)
{
ddef_t *key;