]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix two bugs introduced in r5828 (2005-11-25) that made monsters and
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 6 Nov 2009 14:24:21 +0000 (14:24 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 6 Nov 2009 14:24:21 +0000 (14:24 +0000)
corpses slide off of groundentity
thanks to negke for reporting this bug and assisting in identifying it

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9439 d7cf8633-e32d-0410-b094-e92efae38249

sv_phys.c

index 5c23977726e5607114374f8dc4adea526f95b5ee..bd8b50ce30262ed9a36b8092fd8f49a009552867 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -2434,10 +2434,12 @@ void SV_Physics_Toss (prvm_edict_t *ent)
        vec3_t move;
        vec_t movetime;
        int bump;
+       prvm_edict_t *groundentity;
 
 // if onground, return without moving
        if ((int)ent->fields.server->flags & FL_ONGROUND)
        {
+               groundentity = PRVM_PROG_TO_EDICT(ent->fields.server->groundentity);
                if (ent->fields.server->velocity[2] >= (1.0 / 32.0) && sv_gameplayfix_upwardvelocityclearsongroundflag.integer)
                {
                        // don't stick to ground if onground and moving upward
@@ -2448,7 +2450,7 @@ void SV_Physics_Toss (prvm_edict_t *ent)
                        // we can trust FL_ONGROUND if groundentity is world because it never moves
                        return;
                }
-               else if (ent->priv.server->suspendedinairflag && PRVM_PROG_TO_EDICT(ent->fields.server->groundentity)->priv.server->free)
+               else if (ent->priv.server->suspendedinairflag && groundentity->priv.server->free)
                {
                        // if ent was supported by a brush model on previous frame,
                        // and groundentity is now freed, set groundentity to 0 (world)
@@ -2457,6 +2459,11 @@ void SV_Physics_Toss (prvm_edict_t *ent)
                        if (sv_gameplayfix_noairborncorpse_allowsuspendeditems.integer)
                                return;
                }
+               else if (BoxesOverlap(ent->priv.server->cullmins, ent->priv.server->cullmaxs, groundentity->priv.server->cullmins, groundentity->priv.server->cullmaxs))
+               {
+                       // don't slide if still touching the groundentity
+                       return;
+               }
        }
        ent->priv.server->suspendedinairflag = false;
 
@@ -2608,7 +2615,7 @@ void SV_Physics_Step (prvm_edict_t *ent)
                {
                        // freefall if onground and moving upward
                        // freefall if not standing on a world surface (it may be a lift or trap door)
-                       if ((ent->fields.server->velocity[2] >= (1.0 / 32.0) && sv_gameplayfix_upwardvelocityclearsongroundflag.integer) || ent->fields.server->groundentity)
+                       if (ent->fields.server->velocity[2] >= (1.0 / 32.0) && sv_gameplayfix_upwardvelocityclearsongroundflag.integer)
                        {
                                ent->fields.server->flags -= FL_ONGROUND;
                                SV_CheckVelocity(ent);