44 return 0.125 * (
int)
x;
54 if (self->teammaster->owner)
86 VectorMA (self->s.origin, self->move_origin[0], f, start);
87 VectorMA (start, self->move_origin[1],
r, start);
88 VectorMA (start, self->move_origin[2], u, start);
90 damage = 100 +
random() * 50;
92 fire_rocket (self->teammaster->owner, start, f, damage, speed, 150, damage);
106 if (self->move_angles[
PITCH] > 180)
107 self->move_angles[
PITCH] -= 360;
110 if (self->move_angles[
PITCH] > self->pos1[
PITCH])
112 else if (self->move_angles[
PITCH] < self->pos2[
PITCH])
115 if ((self->move_angles[
YAW] < self->pos1[
YAW]) || (self->move_angles[
YAW] > self->pos2[
YAW]))
119 dmin = fabs(self->pos1[
YAW] - self->move_angles[
YAW]);
124 dmax = fabs(self->pos2[
YAW] - self->move_angles[
YAW]);
129 if (fabs(dmin) < fabs(dmax))
130 self->move_angles[
YAW] =
self->pos1[
YAW];
132 self->move_angles[
YAW] =
self->pos2[
YAW];
138 else if (delta[0] > 180)
142 else if (delta[1] > 180)
148 if (delta[0] < -1 * self->speed *
FRAMETIME)
152 if (delta[1] < -1 * self->speed *
FRAMETIME)
172 self->owner->avelocity[0] =
self->avelocity[0];
173 self->owner->avelocity[1] =
self->avelocity[1];
176 angle =
self->s.angles[1] +
self->owner->move_origin[1];
177 angle *= (
M_PI*2 / 360);
178 target[0] =
SnapToEights(self->s.origin[0] + cos(angle) * self->owner->move_origin[0]);
179 target[1] =
SnapToEights(self->s.origin[1] + sin(angle) * self->owner->move_origin[0]);
180 target[2] =
self->owner->s.origin[2];
183 self->owner->velocity[0] = dir[0] * 1.0 /
FRAMETIME;
184 self->owner->velocity[1] = dir[1] * 1.0 /
FRAMETIME;
187 angle =
self->s.angles[
PITCH] * (
M_PI*2 / 360);
188 target_z =
SnapToEights(self->s.origin[2] + self->owner->move_origin[0] * tan(angle) + self->owner->move_origin[2]);
190 diff = target_z -
self->owner->s.origin[2];
191 self->owner->velocity[2] = diff * 1.0 /
FRAMETIME;
193 if (self->spawnflags & 65536)
196 self->spawnflags &= ~65536;
206 gi.
dprintf(
"%s at %s needs a target\n", self->classname,
vtos(self->s.origin));
211 VectorSubtract (self->target_ent->s.origin, self->s.origin, self->move_origin);
215 self->teammaster->dmg =
self->dmg;
243 self->ideal_yaw =
self->s.angles[
YAW];
244 self->move_angles[
YAW] =
self->ideal_yaw;
289 self->teammaster =
NULL;
292 self->target_ent->owner =
NULL;
293 self->target_ent->teammaster->owner =
NULL;
308 if (self->enemy && (!self->enemy->inuse || self->enemy->health <= 0))
315 self->monsterinfo.trail_time =
level.time;
320 if (
visible (
self, self->enemy))
324 self->monsterinfo.trail_time =
level.time;
337 target[2] +=
self->enemy->viewheight;
342 if (
level.time < self->monsterinfo.attack_finished)
346 if ((
level.time - self->monsterinfo.trail_time) < reaction_time)
349 self->monsterinfo.attack_finished =
level.time + reaction_time + 1.0;
351 self->target_ent->spawnflags |= 65536;
363 self->target_ent->owner =
self;
364 self->target_ent->teammaster->owner =
self;
365 VectorCopy (self->target_ent->s.angles, self->s.angles);
367 vec[0] =
self->target_ent->s.origin[0] -
self->s.origin[0];
368 vec[1] =
self->target_ent->s.origin[1] -
self->s.origin[1];
375 self->move_origin[1] = vec[1];
377 self->move_origin[2] =
self->s.origin[2] -
self->target_ent->s.origin[2];
397 self->s.modelindex =
gi.
modelindex(
"models/monsters/infantry/tris.md2");
402 self->gib_health = 0;
404 self->viewheight = 24;
411 level.total_monsters++;
418 VectorCopy (self->s.origin, self->s.old_origin);