]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_collision.c
now that performance of cl_decals_newsystem is not terrible, enable it
[xonotic/darkplaces.git] / cl_collision.c
index a98d0b5c6525e6e686415044fde4362020bddf82..513aa13ecb44bddf44054fa6e495904279ae0afc 100644 (file)
@@ -321,7 +321,7 @@ trace_t CL_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int
                vec3_t origin, entmins, entmaxs;
                matrix4x4_t entmatrix, entinversematrix;
 
-               if(gamemode == GAME_NEXUIZ)
+               if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC)
                {
                        // don't hit network players, if we are a nonsolid player
                        if(cl.scores[cl.playerentity-1].frags == -666 || cl.scores[cl.playerentity-1].frags == -616)
@@ -340,7 +340,7 @@ trace_t CL_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int
                        if (!cl.scores[i-1].name[0])
                                continue;
 
-                       if(gamemode == GAME_NEXUIZ)
+                       if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC)
                        {
                                // don't hit spectators or nonsolid players
                                if(cl.scores[i-1].frags == -666 || cl.scores[i-1].frags == -616)
@@ -463,7 +463,10 @@ trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_
        vec3_t end;
        vec_t len = 0;
 
-       if(!VectorCompare(start, pEnd) && collision_endposnudge.value > 0)
+       if (VectorCompare(start, pEnd))
+               return CL_TracePoint(start, type, passedict, hitsupercontentsmask, hitnetworkbrushmodels, hitnetworkplayers, hitnetworkentity, hitcsqcentities);
+
+       if(collision_endposnudge.value > 0)
        {
                // TRICK: make the trace 1 qu longer!
                VectorSubtract(pEnd, start, end);
@@ -472,10 +475,10 @@ trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_
        }
        else
                VectorCopy(pEnd, end);
-#endif
-
+#else
        if (VectorCompare(start, end))
                return CL_TracePoint(start, type, passedict, hitsupercontentsmask, hitnetworkbrushmodels, hitnetworkplayers, hitnetworkentity, hitcsqcentities);
+#endif
 
        if (hitnetworkentity)
                *hitnetworkentity = 0;
@@ -551,7 +554,7 @@ trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_
                vec3_t origin, entmins, entmaxs;
                matrix4x4_t entmatrix, entinversematrix;
 
-               if(gamemode == GAME_NEXUIZ)
+               if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC)
                {
                        // don't hit network players, if we are a nonsolid player
                        if(cl.scores[cl.playerentity-1].frags == -666 || cl.scores[cl.playerentity-1].frags == -616)
@@ -570,7 +573,7 @@ trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_
                        if (!cl.scores[i-1].name[0])
                                continue;
 
-                       if(gamemode == GAME_NEXUIZ)
+                       if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC)
                        {
                                // don't hit spectators or nonsolid players
                                if(cl.scores[i-1].frags == -666 || cl.scores[i-1].frags == -616)
@@ -701,6 +704,19 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co
        vec3_t end;
        vec_t len = 0;
 
+       if (VectorCompare(mins, maxs))
+       {
+               vec3_t shiftstart, shiftend;
+               VectorAdd(start, mins, shiftstart);
+               VectorAdd(pEnd, mins, shiftend);
+               if (VectorCompare(start, pEnd))
+                       trace = CL_TracePoint(shiftstart, type, passedict, hitsupercontentsmask, hitnetworkbrushmodels, hitnetworkplayers, hitnetworkentity, hitcsqcentities);
+               else
+                       trace = CL_TraceLine(shiftstart, shiftend, type, passedict, hitsupercontentsmask, hitnetworkbrushmodels, hitnetworkplayers, hitnetworkentity, hitcsqcentities);
+               VectorSubtract(trace.endpos, mins, trace.endpos);
+               return trace;
+       }
+
        if(!VectorCompare(start, pEnd) && collision_endposnudge.value > 0)
        {
                // TRICK: make the trace 1 qu longer!
@@ -710,8 +726,7 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co
        }
        else
                VectorCopy(pEnd, end);
-#endif
-
+#else
        if (VectorCompare(mins, maxs))
        {
                vec3_t shiftstart, shiftend;
@@ -724,6 +739,7 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co
                VectorSubtract(trace.endpos, mins, trace.endpos);
                return trace;
        }
+#endif
 
        if (hitnetworkentity)
                *hitnetworkentity = 0;
@@ -812,7 +828,7 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co
                vec3_t origin, entmins, entmaxs;
                matrix4x4_t entmatrix, entinversematrix;
 
-               if(gamemode == GAME_NEXUIZ)
+               if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC)
                {
                        // don't hit network players, if we are a nonsolid player
                        if(cl.scores[cl.playerentity-1].frags == -666 || cl.scores[cl.playerentity-1].frags == -616)
@@ -831,7 +847,7 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co
                        if (!cl.scores[i-1].name[0])
                                continue;
 
-                       if(gamemode == GAME_NEXUIZ)
+                       if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC)
                        {
                                // don't hit spectators or nonsolid players
                                if(cl.scores[i-1].frags == -666 || cl.scores[i-1].frags == -616)