From: Mircea Kitsune Date: Thu, 24 May 2012 15:11:00 +0000 (+0300) Subject: Correct still turning formula. It should work properly, but for some reason it doesn... X-Git-Tag: xonotic-v0.8.0~295^2~18 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c6d6f776d3bdae15a7daeadc3741c9cf8be3a6ed;p=xonotic%2Fxonotic-data.pk3dir.git Correct still turning formula. It should work properly, but for some reason it doesn't... --- diff --git a/qcsrc/server/t_plats.qc b/qcsrc/server/t_plats.qc index f27bb2b9f..e652defa6 100644 --- a/qcsrc/server/t_plats.qc +++ b/qcsrc/server/t_plats.qc @@ -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); } }