From: Mircea Kitsune Date: Fri, 25 May 2012 10:32:26 +0000 (+0300) Subject: Don't offset with self.mins when the train is rotating. Now trains will center proper... X-Git-Tag: xonotic-v0.8.0~295^2~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=59883b7deef86ac60e9e2eda1ee5a4c96b18672d;p=xonotic%2Fxonotic-data.pk3dir.git Don't offset with self.mins when the train is rotating. Now trains will center properly to each path_corner --- diff --git a/qcsrc/server/t_plats.qc b/qcsrc/server/t_plats.qc index 4b0adbfa1..86e1585d1 100644 --- a/qcsrc/server/t_plats.qc +++ b/qcsrc/server/t_plats.qc @@ -310,9 +310,9 @@ void train_wait() cp = world; if(cp) // bezier curves movement - ang = cp.origin - (self.origin + self.mins); // use the origin of the control point of the next path_corner + ang = cp.origin - (self.origin - self.view_ofs); // use the origin of the control point of the next path_corner else // linear movement - ang = targ.origin - (self.origin + self.mins); // use the origin of the next path_corner + ang = targ.origin - (self.origin - self.view_ofs); // use the origin of the next path_corner ang = vectoangles(ang); ang_x = -ang_x; // flip up / down orientation @@ -353,7 +353,7 @@ void train_next() if(targ.curvetarget) { cp = find(world, targetname, targ.curvetarget); // get its second target (the control point) - cp_org = cp.origin - self.mins; // no control point found, assume a straight line to the destination + cp_org = cp.origin - self.view_ofs; // no control point found, assume a straight line to the destination } else cp = world; // no cp @@ -380,16 +380,16 @@ void train_next() if (targ.speed) { if (cp) - SUB_CalcMove_Bezier(cp_org, targ.origin - self.mins, TSPEED_LINEAR, targ.speed, train_wait); + SUB_CalcMove_Bezier(cp_org, targ.origin - self.view_ofs, TSPEED_LINEAR, targ.speed, train_wait); else - SUB_CalcMove(targ.origin - self.mins, TSPEED_LINEAR, targ.speed, train_wait); + SUB_CalcMove(targ.origin - self.view_ofs, TSPEED_LINEAR, targ.speed, train_wait); } else { if (cp) - SUB_CalcMove_Bezier(cp_org, targ.origin - self.mins, TSPEED_LINEAR, self.speed, train_wait); + SUB_CalcMove_Bezier(cp_org, targ.origin - self.view_ofs, TSPEED_LINEAR, self.speed, train_wait); else - SUB_CalcMove(targ.origin - self.mins, TSPEED_LINEAR, self.speed, train_wait); + SUB_CalcMove(targ.origin - self.view_ofs, TSPEED_LINEAR, self.speed, train_wait); } if(self.noise != "") @@ -403,7 +403,7 @@ void func_train_find() self.target = targ.target; if (!self.target) objerror("func_train_find: no next target"); - setorigin(self, targ.origin - self.mins); + setorigin(self, targ.origin - self.view_ofs); self.nextthink = self.ltime + 1; self.think = train_next; } @@ -422,8 +422,14 @@ void spawnfunc_func_train() objerror("func_train without a target"); if (!self.speed) self.speed = 100; + if (self.spawnflags & 2) + { self.platmovetype_turn = TRUE; + self.view_ofs = '0 0 0'; // don't offset a rotating train, origin works differently now + } + else + self.view_ofs = self.mins; if not(InitMovingBrushTrigger()) return;