From: Mircea Kitsune Date: Mon, 21 May 2012 18:55:44 +0000 (+0300) Subject: Integrate beizer curve movement for func_train (not yet finished). When this system... X-Git-Tag: xonotic-v0.8.0~295^2~57 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1ac191af03714b4a4dfd050209ea820daf9890a6;p=xonotic%2Fxonotic-data.pk3dir.git Integrate beizer curve movement for func_train (not yet finished). When this system is used (spawnfunc 1 on the train) each path_corner will require a path_corner or target_position as target2 to specify the control point of the curve. Thanks go to divVerent for the beizer curve code --- diff --git a/qcsrc/server/t_plats.qc b/qcsrc/server/t_plats.qc index 8d81ca263..0c498640d 100644 --- a/qcsrc/server/t_plats.qc +++ b/qcsrc/server/t_plats.qc @@ -278,10 +278,14 @@ void train_wait() void train_next() { - entity targ; + entity targ, cp; targ = find(world, targetname, self.target); - self.enemy = targ; self.target = targ.target; + if (self.spawnflags & 1) + { + cp = find(world, target, targ.targetname); // get the previous corner first + cp = find(world, targetname, cp.target2); // now get its second target + } if (!self.target) objerror("train_next: no next target"); self.wait = targ.wait; @@ -289,9 +293,19 @@ void train_next() self.wait = 0.1; if (targ.speed) - SUB_CalcMove(targ.origin - self.mins, targ.speed, train_wait); + { + if (self.spawnflags & 1) + SUB_CalcMove_Bezier(cp.origin, targ.origin - self.mins, targ.speed, train_wait); + else + SUB_CalcMove(targ.origin - self.mins, targ.speed, train_wait); + } else - SUB_CalcMove(targ.origin - self.mins, self.speed, train_wait); + { + if (self.spawnflags & 1) + SUB_CalcMove_Bezier(cp.origin, targ.origin - self.mins, self.speed, train_wait); + else + SUB_CalcMove(targ.origin - self.mins, self.speed, train_wait); + } if(self.noise != "") sound(self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTN_IDLE);