self.enemy = world;
// if turning is enabled, the train will turn toward the next point while waiting
- if(self.wait >= 0 && self.bezier_turn && !self.train_wait_turning)
+ if(self.platmovetype_turn && !self.train_wait_turning)
{
- entity targ;
+ entity targ, cp;
vector org;
- if(self.spawnflags & 1) // bezier curves movement
- {
- targ = find(world, targetname, self.target);
- org = normalize(targ.origin);
- SUB_CalcAngleMove(org, TSPEED_TIME, self.ltime - time + self.wait, train_wait);
- }
+ targ = find(world, targetname, self.target);
+ if((self.spawnflags & 1) && targ.curvetarget)
+ cp = find(world, targetname, targ.curvetarget);
else
+ cp = world;
+
+ if(cp) // bezier curves movement
+ org = vectoangles(cp.origin - self.origin); // use the origin of the control point of the next path_corner
+ else // linear movement
+ org = vectoangles(targ.origin - self.origin); // use the origin of the next path_corner
+
+ if(self.wait >= 0) // slow turning
{
- targ = find(world, targetname, self.target);
- org = normalize(targ.origin);
SUB_CalcAngleMove(org, TSPEED_TIME, self.ltime - time + self.wait, train_wait);
+ self.train_wait_turning = TRUE;
+ return;
}
- self.train_wait_turning = TRUE;
- return;
+ else // instant turning
+ self.angles = org;
}
if(self.noise != "")
self.target = targ.target;
if (self.spawnflags & 1)
{
- if(targ.curve)
+ if(targ.curvetarget)
{
- cp = find(world, targetname, targ.curve); // get its second target (the control point)
+ 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
}
else
if (!self.speed)
self.speed = 100;
if (self.spawnflags & 2)
- self.bezier_turn = TRUE;
+ self.platmovetype_turn = TRUE;
if not(InitMovingBrushTrigger())
return;