]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
cleaned up suspendedinairflag a bit
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 16 May 2005 03:15:34 +0000 (03:15 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 16 May 2005 03:15:34 +0000 (03:15 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5306 d7cf8633-e32d-0410-b094-e92efae38249

sv_phys.c

index b30a92bdd2ab080a53f11458c8cce8a35e7c80bc..f51628528c916dfa3dad2aa40d85b82fdbc22e9a 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -1197,7 +1197,6 @@ void SV_Physics_Toss (edict_t *ent)
 {
        trace_t trace;
        vec3_t move;
-       edict_t *groundentity;
 
        // don't stick to ground if onground and moving upward
        if (ent->v->velocity[2] >= (1.0 / 32.0) && ((int)ent->v->flags & FL_ONGROUND))
@@ -1206,23 +1205,14 @@ void SV_Physics_Toss (edict_t *ent)
 // if onground, return without moving
        if ((int)ent->v->flags & FL_ONGROUND)
        {
-               if (!sv_gameplayfix_noairborncorpse.integer)
-                       return;
-               if (ent->v->groundentity == 0)
+               if (ent->v->groundentity == 0 || sv_gameplayfix_noairborncorpse.integer)
                        return;
                // if ent was supported by a brush model on previous frame,
                // and groundentity is now freed, set groundentity to 0 (floating)
-               groundentity = PROG_TO_EDICT(ent->v->groundentity);
-               if (groundentity->v->solid == SOLID_BSP)
-               {
-                       ent->e->suspendedinairflag = true;
-                       return;
-               }
-               else if (ent->e->suspendedinairflag && groundentity->e->free)
+               if (ent->e->suspendedinairflag && PROG_TO_EDICT(ent->v->groundentity)->e->free)
                {
                        // leave it suspended in the air
                        ent->v->groundentity = 0;
-                       ent->e->suspendedinairflag = false;
                        return;
                }
        }
@@ -1288,6 +1278,8 @@ void SV_Physics_Toss (edict_t *ent)
                        {
                                ent->v->flags = (int)ent->v->flags | FL_ONGROUND;
                                ent->v->groundentity = EDICT_TO_PROG(trace.ent);
+                               if (((edict_t *)trace.ent)->v->solid == SOLID_BSP)
+                                       ent->e->suspendedinairflag = true;
                                VectorClear (ent->v->velocity);
                                VectorClear (ent->v->avelocity);
                        }