From: bones_was_here Date: Mon, 7 Nov 2022 09:39:13 +0000 (+1000) Subject: Minor sv_cullentities refactoring X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4e793be6f999b83670d70350f7ebfaacaf40e89c;p=xonotic%2Fdarkplaces.git Minor sv_cullentities refactoring --- diff --git a/sv_main.c b/sv_main.c index f08bc4e0..891e8023 100644 --- a/sv_main.c +++ b/sv_main.c @@ -88,7 +88,7 @@ cvar_t sv_cullentities_trace_enlarge = {CF_SERVER, "sv_cullentities_trace_enlarg cvar_t sv_cullentities_trace_expand = {CF_SERVER, "sv_cullentities_trace_expand", "0", "box is expanded by this many units for entity culling (also applies to portal camera eyes even if sv_cullentities_trace is 0)"}; cvar_t sv_cullentities_trace_eyejitter = {CF_SERVER, "sv_cullentities_trace_eyejitter", "16", "jitter the eye by this much for each trace (also applies to portal camera eyes even if sv_cullentities_trace is 0)"}; cvar_t sv_cullentities_trace_prediction = {CF_SERVER, "sv_cullentities_trace_prediction", "1", "also trace from the predicted player position"}; -cvar_t sv_cullentities_trace_prediction_time = {CF_SERVER, "sv_cullentities_trace_prediction_time", "0.2", "how many seconds of prediction to use"}; +cvar_t sv_cullentities_trace_prediction_time = {CF_SERVER, "sv_cullentities_trace_prediction_time", "0.2", "maximum ping time to predict in seconds"}; cvar_t sv_cullentities_trace_entityocclusion = {CF_SERVER, "sv_cullentities_trace_entityocclusion", "0", "also check if doors and other bsp models are in the way"}; cvar_t sv_cullentities_trace_samples = {CF_SERVER, "sv_cullentities_trace_samples", "2", "number of samples to test for entity culling"}; cvar_t sv_cullentities_trace_samples_extra = {CF_SERVER, "sv_cullentities_trace_samples_extra", "2", "number of samples to test for entity culling when the entity affects its surroundings by e.g. dlight (also applies to portal camera eyes even if sv_cullentities_trace is 0)"}; diff --git a/sv_send.c b/sv_send.c index b4f7ab63..a9675530 100644 --- a/sv_send.c +++ b/sv_send.c @@ -956,13 +956,12 @@ void SV_MarkWriteEntityStateToClient(entity_state_t *s, client_t *client) s->specialvisibilityradius ? sv_cullentities_trace_samples_extra.integer : sv_cullentities_trace_samples.integer; - float enlarge = sv_cullentities_trace_enlarge.value; if(samples > 0) { int eyeindex; for (eyeindex = 0;eyeindex < sv.writeentitiestoclient_numeyes;eyeindex++) - if(SV_CanSeeBox(samples, sv_cullentities_trace_eyejitter.value, enlarge, sv_cullentities_trace_expand.value, sv.writeentitiestoclient_eyes[eyeindex], ed->priv.server->cullmins, ed->priv.server->cullmaxs)) + if(SV_CanSeeBox(samples, sv_cullentities_trace_eyejitter.value, sv_cullentities_trace_enlarge.value, sv_cullentities_trace_expand.value, sv.writeentitiestoclient_eyes[eyeindex], ed->priv.server->cullmins, ed->priv.server->cullmaxs)) break; if(eyeindex < sv.writeentitiestoclient_numeyes) svs.clients[sv.writeentitiestoclient_clientnumber].visibletime[s->number] = @@ -995,15 +994,12 @@ void SV_AddCameraEyes(void) prvm_prog_t *prog = SVVM_prog; int e, i, j, k; prvm_edict_t *ed; - static int cameras[MAX_LEVELNETWORKEYES]; - static vec3_t camera_origins[MAX_LEVELNETWORKEYES]; - static int eye_levels[MAX_CLIENTNETWORKEYES]; + int cameras[MAX_LEVELNETWORKEYES]; + vec3_t camera_origins[MAX_LEVELNETWORKEYES]; + int eye_levels[MAX_CLIENTNETWORKEYES] = {0}; int n_cameras = 0; vec3_t mi, ma; - for(i = 0; i < sv.writeentitiestoclient_numeyes; ++i) - eye_levels[i] = 0; - // check line of sight to portal entities and add them to PVS for (e = 1, ed = PRVM_NEXT_EDICT(prog->edicts);e < prog->num_edicts;e++, ed = PRVM_NEXT_EDICT(ed)) {