]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_phys.c
redesigned tempstring system, now uses a fixed size buffer based on the prvm_tempstri...
[xonotic/darkplaces.git] / sv_phys.c
index c00abe7f267f5acc19b46dd372058667b6705fa8..dbd6b33e3b9877a479faef313035c4660fdffa1e 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -20,8 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 // sv_phys.c
 
 #include "quakedef.h"
-// used only for VM_GetTempString
-#include "prvm_cmds.h"
 
 /*
 
@@ -91,7 +89,25 @@ static int SV_TestEntityPosition (prvm_edict_t *ent)
        if (trace.startsupercontents & SUPERCONTENTS_SOLID)
                return true;
        else
+       {
+               if (sv.worldmodel->brushq1.hulls && !VectorCompare(ent->fields.server->mins, ent->fields.server->maxs))
+               {
+                       // q1bsp/hlbsp use hulls and if the entity does not exactly match
+                       // a hull size it is incorrectly tested, so this code tries to
+                       // 'fix' it slightly...
+                       int i;
+                       vec3_t v;
+                       for (i = 0;i < 8;i++)
+                       {
+                               v[0] = (i & 1) ? ent->fields.server->maxs[0] : ent->fields.server->mins[0];
+                               v[1] = (i & 2) ? ent->fields.server->maxs[1] : ent->fields.server->mins[1];
+                               v[2] = (i & 4) ? ent->fields.server->maxs[2] : ent->fields.server->mins[2];
+                               if (SV_PointSuperContents(v) & SUPERCONTENTS_SOLID)
+                                       return true;
+                       }
+               }
                return false;
+       }
 }
 
 /*
@@ -272,11 +288,7 @@ void SV_Impact (prvm_edict_t *e1, trace_t *trace)
                if ((val = PRVM_GETGLOBALFIELDVALUE(gval_trace_dphittexturename)))
                {
                        if (trace->hittexture)
-                       {
-                               char *s = VM_GetTempString();
-                               strlcpy(s, trace->hittexture->name, VM_STRINGTEMP_LENGTH);
-                               val->string = PRVM_SetEngineString(s);
-                       }
+                               val->string = PRVM_SetTempString(trace->hittexture->name);
                        else
                                val->string = 0;
                }
@@ -1002,7 +1014,8 @@ static void SV_UnstickEntity (prvm_edict_t *ent)
                        }
 
        VectorCopy (org, ent->fields.server->origin);
-       Con_DPrintf("Stuck entity %i (classname \"%s\").\n", (int)PRVM_EDICT_TO_PROG(ent), PRVM_GetString(ent->fields.server->classname));
+       if (developer.integer >= 100)
+               Con_Printf("Stuck entity %i (classname \"%s\").\n", (int)PRVM_EDICT_TO_PROG(ent), PRVM_GetString(ent->fields.server->classname));
 }