void train_wait (edict_t *self) { if (self->target_ent->pathtarget) { char *savetarget; edict_t *ent; ent = self->target_ent; savetarget = ent->target; ent->target = ent->pathtarget; G_UseTargets (ent, self->activator); ent->target = savetarget; // make sure we didn't get killed by a killtarget if (!self->inuse) return; } if (self->moveinfo.wait) { if (self->moveinfo.wait > 0) { self->nextthink = level.time + self->moveinfo.wait; self->think = train_next; } else if (self->spawnflags & TRAIN_TOGGLE) // && wait < 0 { train_next (self); self->spawnflags &= ~TRAIN_START_ON; VectorClear (self->velocity); self->nextthink = 0; } if (!(self->flags & FL_TEAMSLAVE)) { if (self->moveinfo.sound_end) gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_end, 1, ATTN_STATIC, 0); self->s.sound = 0; } } else { train_next (self); } }
void train_use (edict_t *self, edict_t *other, edict_t *activator) { self->activator = activator; if (self->spawnflags & TRAIN_START_ON) { if (!(self->spawnflags & TRAIN_TOGGLE)) return; self->spawnflags &= ~TRAIN_START_ON; VectorClear (self->velocity); self->nextthink = 0; } else { if (self->target_ent) train_resume(self); else train_next(self); } }