// sv_main.c -- server main program
#include "quakedef.h"
-#include "portals.h"
static cvar_t sv_cullentities_pvs = {0, "sv_cullentities_pvs", "0"}; // fast but loose
-static cvar_t sv_cullentities_portal = {0, "sv_cullentities_portal", "0"}; // extremely accurate visibility checking, but too slow
static cvar_t sv_cullentities_trace = {0, "sv_cullentities_trace", "1"}; // tends to get false negatives, uses a timeout to keep entities visible a short time after becoming hidden
static cvar_t sv_cullentities_stats = {0, "sv_cullentities_stats", "0"};
static cvar_t sv_entpatch = {0, "sv_entpatch", "1"};
Cvar_RegisterVariable (&sv_nostep);
Cvar_RegisterVariable (&sv_deltacompress);
Cvar_RegisterVariable (&sv_cullentities_pvs);
- Cvar_RegisterVariable (&sv_cullentities_portal);
Cvar_RegisterVariable (&sv_cullentities_trace);
Cvar_RegisterVariable (&sv_cullentities_stats);
Cvar_RegisterVariable (&sv_entpatch);
void SV_WriteEntitiesToClient (client_t *client, edict_t *clent, sizebuf_t *msg)
{
int e, clentnum, bits, alpha, glowcolor, glowsize, scale, effects, lightsize;
- int culled_pvs, culled_portal, culled_trace, visibleentities, totalentities;
+ int culled_pvs, culled_trace, visibleentities, totalentities;
qbyte *pvs;
vec3_t origin, angles, entmins, entmaxs, testorigin, testeye;
float nextfullupdate, alphaf;
fatbytes = sv.worldmodel->brush.FatPVS(sv.worldmodel, testeye, 8, sv_writeentitiestoclient_pvs, sizeof(sv_writeentitiestoclient_pvs));
culled_pvs = 0;
- culled_portal = 0;
culled_trace = 0;
visibleentities = 0;
totalentities = 0;
continue;
}
- // or not visible through the portals
- if (sv_cullentities_portal.integer && !Portal_CheckBox(sv.worldmodel, testeye, entmins, entmaxs))
- {
- culled_portal++;
- continue;
- }
-
// don't try to cull embedded brush models with this, they're sometimes huge (spanning several rooms)
if (sv_cullentities_trace.integer && (model == NULL || model->type != mod_brush || model->name[0] != '*'))
{
}
if (sv_cullentities_stats.integer)
- Con_Printf("client \"%s\" entities: %d total, %d visible, %d culled by: %d pvs %d portal %d trace\n", client->name, totalentities, visibleentities, culled_pvs + culled_portal + culled_trace, culled_pvs, culled_portal, culled_trace);
+ Con_Printf("client \"%s\" entities: %d total, %d visible, %d culled by: %d pvs %d trace\n", client->name, totalentities, visibleentities, culled_pvs + culled_trace, culled_pvs, culled_trace);
}
#else
static int numsendentities;
static int sententities[MAX_EDICTS];
static int sententitiesconsideration[MAX_EDICTS];
static int sv_writeentitiestoclient_culled_pvs;
-static int sv_writeentitiestoclient_culled_portal;
static int sv_writeentitiestoclient_culled_trace;
static int sv_writeentitiestoclient_visibleentities;
static int sv_writeentitiestoclient_totalentities;
sv_writeentitiestoclient_culled_pvs++;
return;
}
- // or not visible through the portals
- if (sv_cullentities_portal.integer && !Portal_CheckBox(sv.worldmodel, sv_writeentitiestoclient_testeye, lightmins, lightmaxs))
- {
- sv_writeentitiestoclient_culled_portal++;
- return;
- }
// or not seen by random tracelines
if (sv_cullentities_trace.integer)
{
sv_writeentitiestoclient_client = client;
sv_writeentitiestoclient_culled_pvs = 0;
- sv_writeentitiestoclient_culled_portal = 0;
sv_writeentitiestoclient_culled_trace = 0;
sv_writeentitiestoclient_visibleentities = 0;
sv_writeentitiestoclient_totalentities = 0;
d->currentcommit = NULL;
if (sv_cullentities_stats.integer)
- Con_Printf("client \"%s\" entities: %d total, %d visible, %d culled by: %d pvs %d portal %d trace\n", client->name, sv_writeentitiestoclient_totalentities, sv_writeentitiestoclient_visibleentities, sv_writeentitiestoclient_culled_pvs + sv_writeentitiestoclient_culled_portal + sv_writeentitiestoclient_culled_trace, sv_writeentitiestoclient_culled_pvs, sv_writeentitiestoclient_culled_portal, sv_writeentitiestoclient_culled_trace);
+ Con_Printf("client \"%s\" entities: %d total, %d visible, %d culled by: %d pvs %d trace\n", client->name, sv_writeentitiestoclient_totalentities, sv_writeentitiestoclient_visibleentities, sv_writeentitiestoclient_culled_pvs + sv_writeentitiestoclient_culled_trace, sv_writeentitiestoclient_culled_pvs, sv_writeentitiestoclient_culled_trace);
}
#endif
sv.model_precache[0] = "";
sv.model_precache[1] = sv.modelname;
- for (i = 1;i < sv.worldmodel->brushq1.numsubmodels;i++)
+ for (i = 1;i < sv.worldmodel->brush.numsubmodels;i++)
{
sv.model_precache[i+1] = localmodels[i];
sv.models[i+1] = Mod_ForName (localmodels[i], false, false, false);