27 gi.WriteByte(ent->style);
28 gi.WritePosition(ent->s.origin);
29 gi.multicast(ent->s.origin, MULTICAST_PVS);
60 if (ent->spawnflags & 3) {
65 ent->s.sound = ent->noise_index;
68 if (ent->spawnflags & 4)
69 chan = CHAN_VOICE | CHAN_RELIABLE;
74 gi.positioned_sound(ent->s.origin, ent, chan, ent->noise_index, ent->volume, ent->attenuation, 0);
80 char buffer[MAX_QPATH];
83 gi.dprintf(
"target_speaker with no noise set at %s\n",
vtos(ent->s.origin));
89 strncpy(buffer,
st.
noise,
sizeof(buffer));
90 ent->noise_index =
gi.soundindex(buffer);
95 if (!ent->attenuation)
96 ent->attenuation = 1.0;
97 else if (ent->attenuation == -1)
101 if (ent->spawnflags & 1)
102 ent->s.sound = ent->noise_index;
116 if (ent->spawnflags & 1)
136 gi.dprintf(
"%s with no message at %s\n", ent->classname,
vtos(ent->s.origin));
151 gi.sound(ent, CHAN_VOICE, ent->noise_index, 1, ATTN_NORM, 0);
170 ent->noise_index =
gi.soundindex(
st.
noise);
171 ent->svflags = SVF_NOCLIENT;
174 if (!Q_stricmp(
level.
mapname,
"mine3") && ent->s.origin[0] == 280 && ent->s.origin[1] == -2048 && ent->s.origin[2] == -624)
175 ent->message =
"You have found a secret area.";
186 gi.sound(ent, CHAN_VOICE, ent->noise_index, 1, ATTN_NORM, 0);
191 gi.configstring(CS_CDTRACK,
"0");
208 ent->noise_index =
gi.soundindex(
st.
noise);
209 ent->svflags = SVF_NOCLIENT;
227 gi.WriteByte(TE_EXPLOSION1);
228 gi.WritePosition(self->s.origin);
229 gi.multicast(self->s.origin, MULTICAST_PHS);
241 self->activator = activator;
249 self->nextthink =
level.
time +
self->delay;
255 ent->svflags = SVF_NOCLIENT;
282 if (activator && activator->client)
283 gi.bprintf(PRINT_HIGH,
"%s exited the level.\n", activator->client->pers.netname);
287 if (strstr(self->map,
"*"))
296 gi.dprintf(
"target_changelevel with no map at %s\n",
vtos(ent->s.origin));
302 if ((Q_stricmp(
level.
mapname,
"fact1") == 0) && (Q_stricmp(ent->map,
"fact3") == 0))
303 ent->map =
"fact3$secret1";
306 ent->svflags = SVF_NOCLIENT;
331 gi.WriteByte(TE_SPLASH);
332 gi.WriteByte(self->count);
333 gi.WritePosition(self->s.origin);
334 gi.WriteDir(self->movedir);
335 gi.WriteByte(self->sounds);
336 gi.multicast(self->s.origin, MULTICAST_PVS);
350 self->svflags = SVF_NOCLIENT;
375 ent->classname =
self->target;
376 VectorCopy(self->s.origin, ent->s.origin);
377 VectorCopy(self->s.angles, ent->s.angles);
379 gi.unlinkentity(ent);
383 VectorCopy(self->movedir, ent->velocity);
389 self->svflags = SVF_NOCLIENT;
392 VectorScale(self->movedir, self->speed, self->movedir);
410 if (self->spawnflags & 2)
412 else if (self->spawnflags & 1)
413 effect = EF_HYPERBLASTER;
419 gi.sound(
self, CHAN_VOICE, self->noise_index, 1, ATTN_NORM, 0);
426 self->noise_index =
gi.soundindex(
"weapons/laser2.wav");
433 self->svflags = SVF_NOCLIENT;
450 self->svflags = SVF_NOCLIENT;
472 self->svflags = SVF_NOCLIENT;
475 self->nextthink =
level.
time +
self->delay;
495 if (self->spawnflags & 0x80000000)
501 VectorCopy(self->movedir, last_movedir);
502 VectorMA(self->enemy->absmin, 0.5, self->enemy->size, point);
503 VectorSubtract(point, self->s.origin, self->movedir);
505 if (!VectorCompare(self->movedir, last_movedir))
506 self->spawnflags |= 0x80000000;
510 VectorCopy(self->s.origin, start);
511 VectorMA(start, 2048, self->movedir, end);
513 tr =
gi.trace(start, NULL, NULL, end, ignore, CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_DEADMONSTER);
523 if (!(tr.ent->svflags & SVF_MONSTER) && (!tr.ent->client)) {
524 if (self->spawnflags & 0x80000000) {
525 self->spawnflags &= ~0x80000000;
527 gi.WriteByte(TE_LASER_SPARKS);
529 gi.WritePosition(tr.endpos);
530 gi.WriteDir(tr.plane.normal);
531 gi.WriteByte(self->s.skinnum);
532 gi.multicast(tr.endpos, MULTICAST_PVS);
538 VectorCopy(tr.endpos, start);
541 VectorCopy(tr.endpos, self->s.old_origin);
548 if (!self->activator)
549 self->activator =
self;
550 self->spawnflags |= 0x80000001;
551 self->svflags &= ~SVF_NOCLIENT;
557 self->spawnflags &= ~1;
558 self->svflags |= SVF_NOCLIENT;
564 self->activator = activator;
565 if (self->spawnflags & 1)
576 self->solid = SOLID_NOT;
577 self->s.renderfx |= RF_BEAM | RF_TRANSLUCENT;
578 self->s.modelindex = 1;
581 if (self->spawnflags & 64)
587 if (self->spawnflags & 2)
588 self->s.skinnum = 0xf2f2f0f0;
589 else if (self->spawnflags & 4)
590 self->s.skinnum = 0xd0d1d2d3;
591 else if (self->spawnflags & 8)
592 self->s.skinnum = 0xf3f3f1f1;
593 else if (self->spawnflags & 16)
594 self->s.skinnum = 0xdcdddedf;
595 else if (self->spawnflags & 32)
596 self->s.skinnum = 0xe0e1e2e3;
600 ent =
G_Find(NULL,
FOFS(targetname), self->target);
602 gi.dprintf(
"%s at %s: %s is a bad target\n", self->classname,
vtos(self->s.origin), self->target);
614 VectorSet(self->mins, -8, -8, -8);
615 VectorSet(self->maxs, 8, 8, 8);
618 if (self->spawnflags & 1)
642 style[0] =
'a' +
self->movedir[0] + (
level.
time -
self->timestamp) /
FRAMETIME * self->movedir[2];
644 gi.configstring(CS_LIGHTS + self->enemy->style, style);
646 if ((
level.
time - self->timestamp) <
self->speed) {
648 }
else if (self->spawnflags & 1) {
651 temp =
self->movedir[0];
652 self->movedir[0] =
self->movedir[1];
653 self->movedir[1] = temp;
654 self->movedir[2] *= -1;
666 e =
G_Find(e,
FOFS(targetname), self->target);
669 if (strcmp(e->classname,
"light") != 0) {
670 gi.dprintf(
"%s at %s ", self->classname,
vtos(self->s.origin));
671 gi.dprintf(
"target %s (%s at %s) is not a light\n", self->target, e->classname,
vtos(e->s.origin));
678 gi.dprintf(
"%s target %s not found at %s\n", self->classname, self->target,
vtos(self->s.origin));
690 if (!self->message || strlen(self->message) != 2 || self->message[0] <
'a' || self->message[0] >
'z' || self->message[1] <
'a' || self->message[1] >
'z' || self->message[0] == self->message[1]) {
691 gi.dprintf(
"target_lightramp has bad ramp (%s) at %s\n", self->message,
vtos(self->s.origin));
702 gi.dprintf(
"%s with no target at %s\n", self->classname,
vtos(self->s.origin));
707 self->svflags |= SVF_NOCLIENT;
711 self->movedir[0] =
self->message[0] -
'a';
712 self->movedir[1] =
self->message[1] -
'a';
713 self->movedir[2] = (
self->movedir[1] -
self->movedir[0]) / (self->speed /
FRAMETIME);
731 gi.positioned_sound(self->s.origin,
self, CHAN_AUTO, self->noise_index, 1.0, ATTN_NONE, 0);
740 if (!e->groundentity)
743 e->groundentity = NULL;
744 e->velocity[0] +=
crandom() * 150;
745 e->velocity[1] +=
crandom() * 150;
746 e->velocity[2] =
self->speed * (100.0 / e->mass);
755 self->timestamp =
level.
time +
self->count;
757 self->activator = activator;
758 self->last_move_time = 0;
763 if (!self->targetname)
764 gi.dprintf(
"untargeted %s at %s\n", self->classname,
vtos(self->s.origin));
772 self->svflags |= SVF_NOCLIENT;
776 self->noise_index =
gi.soundindex(
"world/quake.wav");