// set up csqc world for collision culling
if (cl.worldmodel)
- World_SetSize(&cl.world, cl.worldmodel->normalmins, cl.worldmodel->normalmaxs);
+ World_SetSize(&cl.world, cl.worldmodel->name, cl.worldmodel->normalmins, cl.worldmodel->normalmaxs);
else
- World_SetSize(&cl.world, defaultmins, defaultmaxs);
+ World_SetSize(&cl.world, "", defaultmins, defaultmaxs);
// load or reload .loc file for team chat messages
CL_Locs_Reload_f();
// set time
prog->globals.client->time = cl.time;
- prog->globals.client->mapname = PRVM_SetEngineString(cl.worldmodel->name);
+ prog->globals.client->mapname = cl.worldmodel ? PRVM_SetEngineString(cl.worldmodel->name) : PRVM_SetEngineString("");
prog->globals.client->player_localentnum = cl.playerentity;
// set map description (use world entity 0)
val = PRVM_EDICTFIELDVALUE(prog->edicts, prog->fieldoffsets.message);
if(val)
val->string = PRVM_SetEngineString(cl.levelname);
+ VectorCopy(cl.world.mins, prog->edicts->fields.client->mins);
+ VectorCopy(cl.world.maxs, prog->edicts->fields.client->maxs);
// call the prog init
PRVM_ExecuteProgram(prog->funcoffsets.CSQC_Init, "QC function CSQC_Init is missing");
// make sure all the clients know we're disconnecting
SV_VM_Begin();
- for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
- if (host_client->active)
- SV_DropClient(false); // server shutdown
if(prog->loaded)
if(prog->funcoffsets.SV_Shutdown)
{
prog->funcoffsets.SV_Shutdown = 0; // prevent it from getting called again
PRVM_ExecuteProgram(s,"SV_Shutdown() required");
}
+ for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
+ if (host_client->active)
+ SV_DropClient(false); // server shutdown
SV_VM_End();
NetConn_CloseServerPorts();
client->clientcamera = PRVM_NUM_FOR_EDICT(client->edict);
MSG_WriteByte (&client->netconnection->message, svc_setview);
MSG_WriteShort (&client->netconnection->message, client->clientcamera);
-
+
MSG_WriteByte (&client->netconnection->message, svc_signonnum);
MSG_WriteByte (&client->netconnection->message, 1);
Con_DPrintf("SpawnServer: %s\n", server);
+ dpsnprintf (modelname, sizeof(modelname), "maps/%s.bsp", server);
+
+ if (!FS_FileExists(modelname))
+ {
+ Con_Printf("SpawnServer: no map file named %s\n", modelname);
+ return;
+ }
+
if (cls.state != ca_dedicated)
{
SCR_BeginLoadingPlaque();
S_StopAllSounds();
}
- dpsnprintf (modelname, sizeof(modelname), "maps/%s.bsp", server);
+ if(sv.active)
+ {
+ SV_VM_Begin();
+ if(prog->funcoffsets.SV_Shutdown)
+ {
+ func_t s = prog->funcoffsets.SV_Shutdown;
+ prog->funcoffsets.SV_Shutdown = 0; // prevent it from getting called again
+ PRVM_ExecuteProgram(s,"SV_Shutdown() required");
+ }
+ SV_VM_End();
+ }
+
worldmodel = Mod_ForName(modelname, false, true, true);
if (!worldmodel || !worldmodel->TraceBox)
{
//
// clear world interaction links
//
- World_SetSize(&sv.world, sv.worldmodel->normalmins, sv.worldmodel->normalmaxs);
+ World_SetSize(&sv.world, sv.worldmodel->name, sv.worldmodel->normalmins, sv.worldmodel->normalmaxs);
strlcpy(sv.sound_precache[0], "", sizeof(sv.sound_precache[0]));
ent->fields.server->modelindex = 1; // world model
ent->fields.server->solid = SOLID_BSP;
ent->fields.server->movetype = MOVETYPE_PUSH;
- VectorCopy(sv.worldmodel->normalmins, ent->fields.server->mins);
- VectorCopy(sv.worldmodel->normalmaxs, ent->fields.server->maxs);
- VectorCopy(sv.worldmodel->normalmins, ent->fields.server->absmin);
- VectorCopy(sv.worldmodel->normalmaxs, ent->fields.server->absmax);
+ VectorCopy(sv.world.mins, ent->fields.server->mins);
+ VectorCopy(sv.world.maxs, ent->fields.server->maxs);
+ VectorCopy(sv.world.mins, ent->fields.server->absmin);
+ VectorCopy(sv.world.maxs, ent->fields.server->absmax);
if (coop.value)
prog->globals.server->coop = coop.integer;
===============
*/
-void World_SetSize(world_t *world, const vec3_t mins, const vec3_t maxs)
+void World_SetSize(world_t *world, const char *filename, const vec3_t mins, const vec3_t maxs)
{
int i;
+
+ strlcpy(world->filename, filename, sizeof(world->filename));
+ VectorCopy(mins, world->mins);
+ VectorCopy(maxs, world->maxs);
+
// the areagrid_marknumber is not allowed to be 0
if (world->areagrid_marknumber < 1)
world->areagrid_marknumber = 1;
typedef struct world_s
{
+ // convenient fields
+ char filename[MAX_QPATH];
+ vec3_t mins;
+ vec3_t maxs;
+
int areagrid_stats_calls;
int areagrid_stats_nodechecks;
int areagrid_stats_entitychecks;
void World_Init(void);
// called after the world model has been loaded, before linking any entities
-void World_SetSize(world_t *world, const vec3_t mins, const vec3_t maxs);
+void World_SetSize(world_t *world, const char *filename, const vec3_t mins, const vec3_t maxs);
// unlinks all entities (used before reallocation of edicts)
void World_UnlinkAll(world_t *world);