]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_phys.c
Adding FreeType2 and UTF-8 Support.
[xonotic/darkplaces.git] / sv_phys.c
index c8f73b83c0af92584afc1b67a64f7a68bfcbda40..b3d981005a66eb79d49c55510bd56a583d14daa6 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -121,7 +121,7 @@ trace_t SV_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int
        dp_model_t *model;
        // list of entities to test for collisions
        int numtouchedicts;
-       prvm_edict_t *touchedicts[MAX_EDICTS];
+       static prvm_edict_t *touchedicts[MAX_EDICTS];
 
        //return SV_TraceBox(start, vec3_origin, vec3_origin, end, type, passedict, hitsupercontentsmask);
 
@@ -266,7 +266,7 @@ trace_t SV_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_
        dp_model_t *model;
        // list of entities to test for collisions
        int numtouchedicts;
-       prvm_edict_t *touchedicts[MAX_EDICTS];
+       static prvm_edict_t *touchedicts[MAX_EDICTS];
 #ifdef COLLISION_STUPID_TRACE_ENDPOS_IN_SOLID_WORKAROUND
        vec3_t end;
        vec_t len = 0;
@@ -445,7 +445,7 @@ trace_t SV_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co
        dp_model_t *model;
        // list of entities to test for collisions
        int numtouchedicts;
-       prvm_edict_t *touchedicts[MAX_EDICTS];
+       static prvm_edict_t *touchedicts[MAX_EDICTS];
 #ifdef COLLISION_STUPID_TRACE_ENDPOS_IN_SOLID_WORKAROUND
        vec3_t end;
        vec_t len = 0;
@@ -636,7 +636,7 @@ int SV_PointSuperContents(const vec3_t point)
        int frame;
        // list of entities to test for collisions
        int numtouchedicts;
-       prvm_edict_t *touchedicts[MAX_EDICTS];
+       static prvm_edict_t *touchedicts[MAX_EDICTS];
 
        // get world supercontents at this point
        if (sv.worldmodel && sv.worldmodel->PointSuperContents)
@@ -713,7 +713,8 @@ void SV_LinkEdict_TouchAreaGrid_Call(prvm_edict_t *touch, prvm_edict_t *ent)
 void SV_LinkEdict_TouchAreaGrid(prvm_edict_t *ent)
 {
        int i, numtouchedicts, old_self, old_other;
-       prvm_edict_t *touch, *touchedicts[MAX_EDICTS];
+       prvm_edict_t *touch;
+       static prvm_edict_t *touchedicts[MAX_EDICTS];
 
        if (ent == prog->edicts)
                return;         // don't add the world
@@ -1555,7 +1556,7 @@ void SV_PushMove (prvm_edict_t *pusher, float movetime)
        dp_model_t *pushermodel;
        trace_t trace, trace2;
        matrix4x4_t pusherfinalmatrix, pusherfinalimatrix;
-       unsigned short moved_edicts[MAX_EDICTS];
+       static unsigned short moved_edicts[MAX_EDICTS];
 
        if (!pusher->fields.server->velocity[0] && !pusher->fields.server->velocity[1] && !pusher->fields.server->velocity[2] && !pusher->fields.server->avelocity[0] && !pusher->fields.server->avelocity[1] && !pusher->fields.server->avelocity[2])
        {
@@ -2183,12 +2184,12 @@ void SV_WalkMove (prvm_edict_t *ent)
 
        clip = SV_FlyMove (ent, sv.frametime, applygravity, NULL, hitsupercontentsmask);
 
-       // if the move did not hit the ground at any point, we're not on ground
+       if(sv_gameplayfix_downtracesupportsongroundflag.integer)
        if(!(clip & 1))
+       {
                // only try this if there was no floor in the way in the trace (no,
                // this check seems to be not REALLY necessary, because if clip & 1,
                // our trace will hit that thing too)
-       {
                VectorSet(upmove, ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2] + 1);
                VectorSet(downmove, ent->fields.server->origin[0], ent->fields.server->origin[1], ent->fields.server->origin[2] - 1);
                if (ent->fields.server->movetype == MOVETYPE_FLYMISSILE)
@@ -2198,10 +2199,14 @@ void SV_WalkMove (prvm_edict_t *ent)
                else
                        type = MOVE_NORMAL;
                trace = SV_TraceBox(upmove, ent->fields.server->mins, ent->fields.server->maxs, downmove, type, ent, SV_GenericHitSuperContentsMask(ent));
-               if(trace.fraction >= 1 || trace.plane.normal[2] <= 0.7)
-                       ent->fields.server->flags = (int)ent->fields.server->flags & ~FL_ONGROUND;
+               if(trace.fraction < 1 && trace.plane.normal[2] > 0.7)
+                       clip |= 1; // but we HAVE found a floor
        }
 
+       // if the move did not hit the ground at any point, we're not on ground
+       if(!(clip & 1))
+               ent->fields.server->flags = (int)ent->fields.server->flags & ~FL_ONGROUND;
+
        SV_CheckVelocity(ent);
        SV_LinkEdict(ent);
        SV_LinkEdict_TouchAreaGrid(ent);