+#include "train.qh"
.float train_wait_turning;
void train_next(entity this);
#ifdef SVQC
void train_wait(entity this)
{
SUB_UseTargets(this.enemy, NULL, NULL);
- this.enemy = world;
+ this.enemy = NULL;
// if turning is enabled, the train will turn toward the next point while waiting
if(this.platmovetype_turn && !this.train_wait_turning)
{
entity targ, cp;
vector ang;
- targ = find(world, targetname, this.target);
+ targ = find(NULL, targetname, this.target);
if((this.spawnflags & 1) && targ.curvetarget)
- cp = find(world, targetname, targ.curvetarget);
+ cp = find(NULL, targetname, targ.curvetarget);
else
- cp = world;
+ cp = NULL;
if(cp) // bezier curves movement
ang = cp.origin - (this.origin - this.view_ofs); // use the origin of the control point of the next path_corner
#endif
#ifdef SVQC
- entity tg = find(world, targetname, this.target);
+ entity tg = find(NULL, targetname, this.target);
if(tg.spawnflags & 4)
{
this.use = train_use;
void train_next(entity this)
{
- entity targ, cp = world;
+ entity targ, cp = NULL;
vector cp_org = '0 0 0';
- targ = find(world, targetname, this.target);
+ targ = find(NULL, targetname, this.target);
this.target = targ.target;
if (this.spawnflags & 1)
{
if(targ.curvetarget)
{
- cp = find(world, targetname, targ.curvetarget); // get its second target (the control point)
+ cp = find(NULL, targetname, targ.curvetarget); // get its second target (the control point)
cp_org = cp.origin - this.view_ofs; // no control point found, assume a straight line to the destination
}
}
if (this.target == "")
- objerror("train_next: no next target");
+ objerror(this, "train_next: no next target");
this.wait = targ.wait;
if (!this.wait)
this.wait = 0.1;
void func_train_find(entity this)
{
entity targ;
- targ = find(world, targetname, this.target);
+ targ = find(NULL, targetname, this.target);
this.target = targ.target;
if (this.target == "")
- objerror("func_train_find: no next target");
+ objerror(this, "func_train_find: no next target");
SUB_SETORIGIN(this, targ.origin - this.view_ofs);
if(!(this.spawnflags & 4))
precache_sound(this.noise);
if (this.target == "")
- objerror("func_train without a target");
+ objerror(this, "func_train without a target");
if (!this.speed)
this.speed = 100;
// wait for targets to spawn
InitializeEntity(this, func_train_find, INITPRIO_FINDTARGET);
- this.blocked = generic_plat_blocked;
+ setblocked(this, generic_plat_blocked);
if(this.dmg && (this.message == ""))
this.message = " was squished";
if(this.dmg && (this.message2 == ""))
this.classname = "func_train";
this.solid = SOLID_BSP;
- this.movetype = MOVETYPE_PUSH;
+ set_movetype(this, MOVETYPE_PUSH);
this.drawmask = MASK_NORMAL;
this.draw = train_draw;
+ if (isnew) IL_PUSH(g_drawables, this);
this.entremove = trigger_remove_generic;
if(set_platmovetype(this, this.platmovetype))
//func_train_find();
// but we will need these
- //this.move_nextthink = this.move_ltime + 0.1;
- //this.move_think = train_next;
train_next(this);
- this.move_movetype = MOVETYPE_PUSH;
- this.move_origin = this.origin;
- this.move_angles = this.angles;
+ set_movetype(this, MOVETYPE_PUSH);
this.move_time = time;
}