]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix pure data entities being linked into the area grid, causing performance hit
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 26 May 2020 13:59:03 +0000 (13:59 +0000)
committerRudolf Polzer <divVerent@gmail.com>
Wed, 17 Mar 2021 14:46:38 +0000 (07:46 -0700)
From Mario (Xonotic).

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12586 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=b1d6f1dfb96bedba50fbe394ca3f0c710f99381b

clvm_cmds.c
csprogs.c
host_cmd.c
sv_main.c
svvm_cmds.c

index 54848d8e410fcbed4eea7b8b662082b59aac23da..7d2ccfd4261fd46ea110744c36641f73f9224cea 100644 (file)
@@ -1872,6 +1872,9 @@ static void VM_CL_copyentity (prvm_prog_t *prog)
                return;
        }
        memcpy(out->fields.fp, in->fields.fp, prog->entityfields * sizeof(prvm_vec_t));
+
+       if (VectorCompare(PRVM_clientedictvector(out, absmin), PRVM_clientedictvector(out, absmax)))
+               return;
        CL_LinkEdict(out);
 }
 
index 8d54fc0fabc0007f8eb72139ab645cb61a4b24bb..1a7c57de01881c28f43184acb5c619cc24169a1e 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -882,7 +882,7 @@ static void CLVM_end_increase_edicts(prvm_prog_t *prog)
 
        // link every entity except world
        for (i = 1, ent = prog->edicts;i < prog->num_edicts;i++, ent++)
-               if (!ent->priv.server->free)
+               if (!ent->priv.server->free && !VectorCompare(PRVM_clientedictvector(ent, absmin), PRVM_clientedictvector(ent, absmax)))
                        CL_LinkEdict(ent);
 }
 
index a62b08324be7aa6bad9b80428204e4579b7853b1..582a58f9737162c0d8a7a64b406aacec2f1f325c 100644 (file)
@@ -964,7 +964,7 @@ static void Host_Loadgame_f (void)
                        PRVM_ED_ParseEdict (prog, start, ent);
 
                        // link it into the bsp tree
-                       if (!ent->priv.server->free)
+                       if (!ent->priv.server->free && !VectorCompare(PRVM_serveredictvector(ent, absmin), PRVM_serveredictvector(ent, absmax)))
                                SV_LinkEdict(ent);
                }
 
index d724aa1f3ad3bbd42a268c123061975722bf830e..12632eb3f3c0a73071b1ee6c460f4c64b30d8a38 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -3595,7 +3595,7 @@ static void SVVM_end_increase_edicts(prvm_prog_t *prog)
 
        // link every entity except world
        for (i = 1, ent = prog->edicts;i < prog->num_edicts;i++, ent++)
-               if (!ent->priv.server->free)
+               if (!ent->priv.server->free && !VectorCompare(PRVM_serveredictvector(ent, absmin), PRVM_serveredictvector(ent, absmax)))
                        SV_LinkEdict(ent);
 }
 
index e4969440a27c713127c6eec5bf8da0a5371cd87d..fc1449f3567e32d068a59585babf2aabd76c243d 100644 (file)
@@ -1772,6 +1772,8 @@ static void VM_SV_copyentity(prvm_prog_t *prog)
                return;
        }
        memcpy(out->fields.fp, in->fields.fp, prog->entityfields * sizeof(prvm_vec_t));
+       if (VectorCompare(PRVM_serveredictvector(out, absmin), PRVM_serveredictvector(out, absmax)))
+               return;
        SV_LinkEdict(out);
 }