]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Get rid of a useless global
authorterencehill <piuntn@gmail.com>
Mon, 31 Jul 2017 20:27:40 +0000 (22:27 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 31 Jul 2017 20:27:40 +0000 (22:27 +0200)
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/jumppads.qh

index 62f6d8468f6f7b77ce943f5109376c6025a66442..533f65989e3f283a425a04ab8f713fe49a0cd618 100644 (file)
@@ -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;
index 76d244da55b2d0b8e814b1d3574b53f293c01ff6..a1260c4e5382fc2d5decb130a34e980bb38ac82f 100644 (file)
@@ -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);