]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Correct still turning formula. It should work properly, but for some reason it doesn...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 24 May 2012 15:11:00 +0000 (18:11 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 24 May 2012 15:11:00 +0000 (18:11 +0300)
qcsrc/server/t_plats.qc

index f27bb2b9ff617d14a7c9973b66591c5d47cd81a2..e652defa6b1d0de19608a25c39b1b7b6cbc33eb8 100644 (file)
@@ -301,36 +301,28 @@ void train_wait()
        // if turning is enabled, the train will turn toward the next point while waiting
        if(self.bezier_turn && !self.train_wait_turning)
        {
-               entity targ;
+               entity targ, cp;
                vector org;
                targ = find(world, targetname, self.target);
-               if(self.spawnflags & 1) // bezier curves movement
+               if(self.spawnflags & 1 && targ.curve)
+                       cp = find(world, targetname, targ.curve);
+               else
+                       cp = world;
+
+               if(cp) // bezier curves movement
+                       org = normalize(cp.origin - self.origin); // use the origin of the control point of the next path_corner
+               else // linear movement
+                       org = normalize(targ.origin - self.origin); // use the origin of the next path_corner
+
+               if(self.wait >= 0) // slow turning
                {
-                       org = normalize(targ.origin);
-                       if(self.wait >= 0)
-                       {
-                               SUB_CalcAngleMove(org, TSPEED_TIME, self.ltime - time + self.wait, train_wait);
-                               self.train_wait_turning = TRUE;
-                               return;
-                       }
-                       else
-                       {
-                               self.angles = vectoangles(targ.origin - self.origin);
-                       }
+                       SUB_CalcAngleMove(org, TSPEED_TIME, self.ltime - time + self.wait, train_wait);
+                       self.train_wait_turning = TRUE;
+                       return;
                }
-               else
+               else // instant turning
                {
-                       org = normalize(targ.origin);
-                       if(self.wait >= 0)
-                       {
-                               SUB_CalcAngleMove(org, TSPEED_TIME, self.ltime - time + self.wait, train_wait);
-                               self.train_wait_turning = TRUE;
-                               return;
-                       }
-                       else
-                       {
-                               self.angles = vectoangles(targ.origin - self.origin);
-                       }
+                       self.angles = vectoangles(org - self.origin);
                }
        }