]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Minor sv_cullentities refactoring
authorbones_was_here <bones_was_here@xonotic.au>
Mon, 7 Nov 2022 09:39:13 +0000 (19:39 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Mon, 7 Nov 2022 09:41:27 +0000 (19:41 +1000)
sv_main.c
sv_send.c

index f08bc4e027b0858d50d3e7bb7f9d93fab42c9ed4..891e8023cf50a0b2701e7a87e69d6297473146ce 100644 (file)
--- 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)"};
index b4f7ab638d97853123da3818e345d34d124d1c9a..a9675530a9f98313657985c7ae2e5cb035134878 100644 (file)
--- 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))
        {