]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
make bouncing also support the entity gravity
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 12 Mar 2009 08:42:21 +0000 (08:42 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 12 Mar 2009 08:42:21 +0000 (08:42 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8803 d7cf8633-e32d-0410-b094-e92efae38249

sv_phys.c

index 91db80521cd3153c8445c091a6db494f9b798b90..7300cbd65b3a4399a56823ca4a52b4a5f15d5269 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -1958,13 +1958,19 @@ void SV_Physics_Toss (prvm_edict_t *ent)
                }
                else if (ent->fields.server->movetype == MOVETYPE_BOUNCE)
                {
-                       float d;
+                       float d, ent_gravity;
+                       prvm_eval_t *val;
                        ClipVelocity (ent->fields.server->velocity, trace.plane.normal, ent->fields.server->velocity, 1.5);
                        // LordHavoc: fixed grenades not bouncing when fired down a slope
+                       val = PRVM_EDICTFIELDVALUE(ent, prog->fieldoffsets.gravity);
+                       if (val!=0 && val->_float)
+                               ent_gravity = val->_float;
+                       else
+                               ent_gravity = 1.0;
                        if (sv_gameplayfix_grenadebouncedownslopes.integer)
                        {
                                d = DotProduct(trace.plane.normal, ent->fields.server->velocity);
-                               if (trace.plane.normal[2] > 0.7 && fabs(d) < sv_gravity.value * (60.0 / 800.0))
+                               if (trace.plane.normal[2] > 0.7 && fabs(d) < sv_gravity.value * (60.0 / 800.0) * ent_gravity)
                                {
                                        ent->fields.server->flags = (int)ent->fields.server->flags | FL_ONGROUND;
                                        ent->fields.server->groundentity = PRVM_EDICT_TO_PROG(trace.ent);
@@ -1976,7 +1982,7 @@ void SV_Physics_Toss (prvm_edict_t *ent)
                        }
                        else
                        {
-                               if (trace.plane.normal[2] > 0.7 && ent->fields.server->velocity[2] < sv_gravity.value * (60.0 / 800.0))
+                               if (trace.plane.normal[2] > 0.7 && ent->fields.server->velocity[2] < sv_gravity.value * (60.0 / 800.0) * ent_gravity)
                                {
                                        ent->fields.server->flags = (int)ent->fields.server->flags | FL_ONGROUND;
                                        ent->fields.server->groundentity = PRVM_EDICT_TO_PROG(trace.ent);