From 6ab2f1da30fef5a019377cbe97041603248a1a5f Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 31 Jul 2017 22:27:40 +0200 Subject: [PATCH] Get rid of a useless global --- qcsrc/common/triggers/trigger/jumppads.qc | 14 ++++++-------- qcsrc/common/triggers/trigger/jumppads.qh | 5 ----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index 62f6d8468..533f65989 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -27,10 +27,7 @@ REGISTER_NET_LINKED(ENT_CLIENT_TARGET_PUSH) ht - jump height, measured from the higher one of org and tgt's midpoint Returns: velocity for the jump - the global trigger_push_calculatevelocity_flighttime is set to the total - jump time */ - vector trigger_push_calculatevelocity(vector org, entity tgt, float ht) { float grav, sdist, zdist, vs, vz, jumpheight; @@ -88,6 +85,7 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht) if(zdist == 0) solution_x = solution.y; // solution_x is 0 in this case, so don't use it, but rather use solution_y (which will be sqrt(0.5 * jumpheight / grav), actually) + float flighttime; if(zdist < 0) { // down-jump @@ -96,14 +94,14 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht) // almost straight line type // jump apex is before the jump // we must take the larger one - trigger_push_calculatevelocity_flighttime = solution.y; + flighttime = solution.y; } else { // regular jump // jump apex is during the jump // we must take the larger one too - trigger_push_calculatevelocity_flighttime = solution.y; + flighttime = solution.y; } } else @@ -114,17 +112,17 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht) // almost straight line type // jump apex is after the jump // we must take the smaller one - trigger_push_calculatevelocity_flighttime = solution.x; + flighttime = solution.x; } else { // regular jump // jump apex is during the jump // we must take the larger one - trigger_push_calculatevelocity_flighttime = solution.y; + flighttime = solution.y; } } - vs = sdist / trigger_push_calculatevelocity_flighttime; + vs = sdist / flighttime; // finally calculate the velocity return sdir * vs + '0 0 1' * vz; diff --git a/qcsrc/common/triggers/trigger/jumppads.qh b/qcsrc/common/triggers/trigger/jumppads.qh index 76d244da5..a1260c4e5 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qh +++ b/qcsrc/common/triggers/trigger/jumppads.qh @@ -11,8 +11,6 @@ const int NUM_JUMPPADSUSED = 3; .float jumppadcount; .entity jumppadsused[NUM_JUMPPADSUSED]; -float trigger_push_calculatevelocity_flighttime; - #ifdef SVQC void SUB_UseTargets(entity this, entity actor, entity trigger); void trigger_push_use(entity this, entity actor, entity trigger); @@ -28,10 +26,7 @@ void trigger_push_use(entity this, entity actor, entity trigger); ht - jump height, measured from the higher one of org and tgt's midpoint Returns: velocity for the jump - the global trigger_push_calculatevelocity_flighttime is set to the total - jump time */ - vector trigger_push_calculatevelocity(vector org, entity tgt, float ht); void trigger_push_touch(entity this, entity toucher); -- 2.39.2