From: lordhavoc Date: Fri, 18 Jan 2002 20:17:58 +0000 (+0000) Subject: grenades no longer stick when you fire down a slope X-Git-Tag: RELEASE_0_2_0_RC1~717 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=81957082d7496de3bbd2163af724253a495f7c8a;p=xonotic%2Fdarkplaces.git grenades no longer stick when you fire down a slope git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1362 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/sv_phys.c b/sv_phys.c index 91f35921..d43cb2c1 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -217,7 +217,7 @@ int ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) if (out[i] > -STOP_EPSILON && out[i] < STOP_EPSILON) out[i] = 0; } - + return blocked; } @@ -1289,13 +1289,23 @@ void SV_Physics_Toss (edict_t *ent) trace_t trace; vec3_t move; float backoff; + edict_t *groundentity; // regular thinking if (!SV_RunThink (ent)) return; // if onground, return without moving if ( ((int)ent->v.flags & FL_ONGROUND) ) - return; + { + // LordHavoc: fall if the groundentity was removed + if (ent->v.groundentity) + { + groundentity = PROG_TO_EDICT(ent->v.groundentity); + if (groundentity && groundentity->v.solid != SOLID_NOT && groundentity->v.solid != SOLID_TRIGGER) + return; + } + } + ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND; SV_CheckVelocity (ent); @@ -1315,7 +1325,7 @@ void SV_Physics_Toss (edict_t *ent) return; if (ent->free) return; - + if (ent->v.movetype == MOVETYPE_BOUNCE) backoff = 1.5; else if (ent->v.movetype == MOVETYPE_BOUNCEMISSILE) @@ -1327,16 +1337,22 @@ void SV_Physics_Toss (edict_t *ent) // stop if on ground if (trace.plane.normal[2] > 0.7) - { - if (ent->v.velocity[2] < 60 || (ent->v.movetype != MOVETYPE_BOUNCE && ent->v.movetype != MOVETYPE_BOUNCEMISSILE)) + { + // LordHavoc: fixed grenades not bouncing when fired down a slope + if (fabs(ent->v.velocity[2]) < 60 || (ent->v.movetype != MOVETYPE_BOUNCE && ent->v.movetype != MOVETYPE_BOUNCEMISSILE)) + //if (ent->v.velocity[2] < 60 || (ent->v.movetype != MOVETYPE_BOUNCE && ent->v.movetype != MOVETYPE_BOUNCEMISSILE)) { ent->v.flags = (int)ent->v.flags | FL_ONGROUND; ent->v.groundentity = EDICT_TO_PROG(trace.ent); VectorClear (ent->v.velocity); VectorClear (ent->v.avelocity); } + else + ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND; } - + else + ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND; + // check for in water SV_CheckWaterTransition (ent); }