icculus quake2 doxygen  1.0 dev
g_target.c File Reference
#include "g_local.h"

Go to the source code of this file.

Functions

void Use_Target_Tent (edict_t *ent, edict_t *other, edict_t *activator)
 
void SP_target_temp_entity (edict_t *ent)
 
void Use_Target_Speaker (edict_t *ent, edict_t *other, edict_t *activator)
 
void SP_target_speaker (edict_t *ent)
 
void Use_Target_Help (edict_t *ent, edict_t *other, edict_t *activator)
 
void SP_target_help (edict_t *ent)
 
void use_target_secret (edict_t *ent, edict_t *other, edict_t *activator)
 
void SP_target_secret (edict_t *ent)
 
void use_target_goal (edict_t *ent, edict_t *other, edict_t *activator)
 
void SP_target_goal (edict_t *ent)
 
void target_explosion_explode (edict_t *self)
 
void use_target_explosion (edict_t *self, edict_t *other, edict_t *activator)
 
void SP_target_explosion (edict_t *ent)
 
void use_target_changelevel (edict_t *self, edict_t *other, edict_t *activator)
 
void SP_target_changelevel (edict_t *ent)
 
void use_target_splash (edict_t *self, edict_t *other, edict_t *activator)
 
void SP_target_splash (edict_t *self)
 
void ED_CallSpawn (edict_t *ent)
 
void use_target_spawner (edict_t *self, edict_t *other, edict_t *activator)
 
void SP_target_spawner (edict_t *self)
 
void use_target_blaster (edict_t *self, edict_t *other, edict_t *activator)
 
void SP_target_blaster (edict_t *self)
 
void trigger_crosslevel_trigger_use (edict_t *self, edict_t *other, edict_t *activator)
 
void SP_target_crosslevel_trigger (edict_t *self)
 
void target_crosslevel_target_think (edict_t *self)
 
void SP_target_crosslevel_target (edict_t *self)
 
void target_laser_think (edict_t *self)
 
void target_laser_on (edict_t *self)
 
void target_laser_off (edict_t *self)
 
void target_laser_use (edict_t *self, edict_t *other, edict_t *activator)
 
void target_laser_start (edict_t *self)
 
void SP_target_laser (edict_t *self)
 
void target_lightramp_think (edict_t *self)
 
void target_lightramp_use (edict_t *self, edict_t *other, edict_t *activator)
 
void SP_target_lightramp (edict_t *self)
 
void target_earthquake_think (edict_t *self)
 
void target_earthquake_use (edict_t *self, edict_t *other, edict_t *activator)
 
void SP_target_earthquake (edict_t *self)
 

Function Documentation

◆ ED_CallSpawn()

void ED_CallSpawn ( edict_t ent)

Definition at line 278 of file g_spawn.c.

279 {
280  spawn_t *s;
281  gitem_t *item;
282  int i;
283 
284  if (!ent->classname)
285  {
286  gi.dprintf ("ED_CallSpawn: NULL classname\n");
287  return;
288  }
289 
290  // check item spawn functions
291  for (i=0,item=itemlist ; i<game.num_items ; i++,item++)
292  {
293  if (!item->classname)
294  continue;
295  if (!strcmp(item->classname, ent->classname))
296  { // found it
297  SpawnItem (ent, item);
298  return;
299  }
300  }
301 
302  // check normal spawn functions
303  for (s=spawns ; s->name ; s++)
304  {
305  if (!strcmp(s->name, ent->classname))
306  { // found it
307  s->spawn (ent);
308  return;
309  }
310  }
311  gi.dprintf ("%s doesn't have a spawn function\n", ent->classname);
312 }

Referenced by use_target_spawner().

◆ SP_target_blaster()

void SP_target_blaster ( edict_t self)

Definition at line 431 of file g_target.c.

432 {
433  self->use = use_target_blaster;
434  G_SetMovedir (self->s.angles, self->movedir);
435  self->noise_index = gi.soundindex ("weapons/laser2.wav");
436 
437  if (!self->dmg)
438  self->dmg = 15;
439  if (!self->speed)
440  self->speed = 1000;
441 
442  self->svflags = SVF_NOCLIENT;
443 }

◆ SP_target_changelevel()

void SP_target_changelevel ( edict_t ent)

Definition at line 302 of file g_target.c.

303 {
304  if (!ent->map)
305  {
306  gi.dprintf("target_changelevel with no map at %s\n", vtos(ent->s.origin));
307  G_FreeEdict (ent);
308  return;
309  }
310 
311  // ugly hack because *SOMEBODY* screwed up their map
312  if((Q_stricmp(level.mapname, "fact1") == 0) && (Q_stricmp(ent->map, "fact3") == 0))
313  ent->map = "fact3$secret1";
314 
316  ent->svflags = SVF_NOCLIENT;
317 }

◆ SP_target_crosslevel_target()

void SP_target_crosslevel_target ( edict_t self)

Definition at line 478 of file g_target.c.

479 {
480  if (! self->delay)
481  self->delay = 1;
482  self->svflags = SVF_NOCLIENT;
483 
484  self->think = target_crosslevel_target_think;
485  self->nextthink = level.time + self->delay;
486 }

◆ SP_target_crosslevel_trigger()

void SP_target_crosslevel_trigger ( edict_t self)

Definition at line 457 of file g_target.c.

458 {
459  self->svflags = SVF_NOCLIENT;
460  self->use = trigger_crosslevel_trigger_use;
461 }

◆ SP_target_earthquake()

void SP_target_earthquake ( edict_t self)

Definition at line 793 of file g_target.c.

794 {
795  if (!self->targetname)
796  gi.dprintf("untargeted %s at %s\n", self->classname, vtos(self->s.origin));
797 
798  if (!self->count)
799  self->count = 5;
800 
801  if (!self->speed)
802  self->speed = 200;
803 
804  self->svflags |= SVF_NOCLIENT;
805  self->think = target_earthquake_think;
806  self->use = target_earthquake_use;
807 
808  self->noise_index = gi.soundindex ("world/quake.wav");
809 }

◆ SP_target_explosion()

void SP_target_explosion ( edict_t ent)

Definition at line 258 of file g_target.c.

259 {
260  ent->use = use_target_explosion;
261  ent->svflags = SVF_NOCLIENT;
262 }

◆ SP_target_goal()

void SP_target_goal ( edict_t ent)

Definition at line 202 of file g_target.c.

203 {
204  if (deathmatch->value)
205  { // auto-remove for deathmatch
206  G_FreeEdict (ent);
207  return;
208  }
209 
210  ent->use = use_target_goal;
211  if (!st.noise)
212  st.noise = "misc/secret.wav";
213  ent->noise_index = gi.soundindex (st.noise);
214  ent->svflags = SVF_NOCLIENT;
215  level.total_goals++;
216 }

◆ SP_target_help()

void SP_target_help ( edict_t ent)

Definition at line 131 of file g_target.c.

132 {
133  if (deathmatch->value)
134  { // auto-remove for deathmatch
135  G_FreeEdict (ent);
136  return;
137  }
138 
139  if (!ent->message)
140  {
141  gi.dprintf ("%s with no message at %s\n", ent->classname, vtos(ent->s.origin));
142  G_FreeEdict (ent);
143  return;
144  }
145  ent->use = Use_Target_Help;
146 }

◆ SP_target_laser()

void SP_target_laser ( edict_t self)

Definition at line 642 of file g_target.c.

643 {
644  // let everything else get spawned before we start firing
645  self->think = target_laser_start;
646  self->nextthink = level.time + 1;
647 }

◆ SP_target_lightramp()

void SP_target_lightramp ( edict_t self)

Definition at line 715 of file g_target.c.

716 {
717  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])
718  {
719  gi.dprintf("target_lightramp has bad ramp (%s) at %s\n", self->message, vtos(self->s.origin));
720  G_FreeEdict (self);
721  return;
722  }
723 
724  if (deathmatch->value)
725  {
726  G_FreeEdict (self);
727  return;
728  }
729 
730  if (!self->target)
731  {
732  gi.dprintf("%s with no target at %s\n", self->classname, vtos(self->s.origin));
733  G_FreeEdict (self);
734  return;
735  }
736 
737  self->svflags |= SVF_NOCLIENT;
738  self->use = target_lightramp_use;
739  self->think = target_lightramp_think;
740 
741  self->movedir[0] = self->message[0] - 'a';
742  self->movedir[1] = self->message[1] - 'a';
743  self->movedir[2] = (self->movedir[1] - self->movedir[0]) / (self->speed / FRAMETIME);
744 }

◆ SP_target_secret()

void SP_target_secret ( edict_t ent)

Definition at line 164 of file g_target.c.

165 {
166  if (deathmatch->value)
167  { // auto-remove for deathmatch
168  G_FreeEdict (ent);
169  return;
170  }
171 
172  ent->use = use_target_secret;
173  if (!st.noise)
174  st.noise = "misc/secret.wav";
175  ent->noise_index = gi.soundindex (st.noise);
176  ent->svflags = SVF_NOCLIENT;
177  level.total_secrets++;
178  // map bug hack
179  if (!Q_stricmp(level.mapname, "mine3") && ent->s.origin[0] == 280 && ent->s.origin[1] == -2048 && ent->s.origin[2] == -624)
180  ent->message = "You have found a secret area.";
181 }

◆ SP_target_spawner()

void SP_target_spawner ( edict_t self)

Definition at line 396 of file g_target.c.

397 {
398  self->use = use_target_spawner;
399  self->svflags = SVF_NOCLIENT;
400  if (self->speed)
401  {
402  G_SetMovedir (self->s.angles, self->movedir);
403  VectorScale (self->movedir, self->speed, self->movedir);
404  }
405 }

◆ SP_target_speaker()

void SP_target_speaker ( edict_t ent)

Definition at line 81 of file g_target.c.

82 {
83  char buffer[MAX_QPATH];
84 
85  if(!st.noise)
86  {
87  gi.dprintf("target_speaker with no noise set at %s\n", vtos(ent->s.origin));
88  return;
89  }
90  if (!strstr (st.noise, ".wav"))
91  Com_sprintf (buffer, sizeof(buffer), "%s.wav", st.noise);
92  else
93  strncpy (buffer, st.noise, sizeof(buffer));
95 
96  if (!ent->volume)
97  ent->volume = 1.0;
98 
99  if (!ent->attenuation)
100  ent->attenuation = 1.0;
101  else if (ent->attenuation == -1) // use -1 so 0 defaults to 1
102  ent->attenuation = 0;
103 
104  // check for prestarted looping sound
105  if (ent->spawnflags & 1)
106  ent->s.sound = ent->noise_index;
107 
108  ent->use = Use_Target_Speaker;
109 
110  // must link the entity so we get areas and clusters so
111  // the server can determine who to send updates to
112  gi.linkentity (ent);
113 }

◆ SP_target_splash()

void SP_target_splash ( edict_t self)

Definition at line 352 of file g_target.c.

353 {
354  self->use = use_target_splash;
355  G_SetMovedir (self->s.angles, self->movedir);
356 
357  if (!self->count)
358  self->count = 32;
359 
360  self->svflags = SVF_NOCLIENT;
361 }

◆ SP_target_temp_entity()

void SP_target_temp_entity ( edict_t ent)

Definition at line 34 of file g_target.c.

35 {
36  ent->use = Use_Target_Tent;
37 }

◆ target_crosslevel_target_think()

void target_crosslevel_target_think ( edict_t self)

Definition at line 469 of file g_target.c.

470 {
472  {
473  G_UseTargets (self, self);
474  G_FreeEdict (self);
475  }
476 }

Referenced by SP_target_crosslevel_target().

◆ target_earthquake_think()

void target_earthquake_think ( edict_t self)

Definition at line 755 of file g_target.c.

756 {
757  int i;
758  edict_t *e;
759 
760  if (self->last_move_time < level.time)
761  {
762  gi.positioned_sound (self->s.origin, self, CHAN_AUTO, self->noise_index, 1.0, ATTN_NONE, 0);
763  self->last_move_time = level.time + 0.5;
764  }
765 
766  for (i=1, e=g_edicts+i; i < globals.num_edicts; i++,e++)
767  {
768  if (!e->inuse)
769  continue;
770  if (!e->client)
771  continue;
772  if (!e->groundentity)
773  continue;
774 
775  e->groundentity = NULL;
776  e->velocity[0] += crandom()* 150;
777  e->velocity[1] += crandom()* 150;
778  e->velocity[2] = self->speed * (100.0 / e->mass);
779  }
780 
781  if (level.time < self->timestamp)
782  self->nextthink = level.time + FRAMETIME;
783 }

Referenced by SP_target_earthquake().

◆ target_earthquake_use()

void target_earthquake_use ( edict_t self,
edict_t other,
edict_t activator 
)

Definition at line 785 of file g_target.c.

786 {
787  self->timestamp = level.time + self->count;
788  self->nextthink = level.time + FRAMETIME;
789  self->activator = activator;
790  self->last_move_time = 0;
791 }

Referenced by SP_target_earthquake().

◆ target_explosion_explode()

void target_explosion_explode ( edict_t self)

Definition at line 227 of file g_target.c.

228 {
229  float save;
230 
233  gi.WritePosition (self->s.origin);
234  gi.multicast (self->s.origin, MULTICAST_PHS);
235 
236  T_RadiusDamage (self, self->activator, self->dmg, NULL, self->dmg+40, MOD_EXPLOSIVE);
237 
238  save = self->delay;
239  self->delay = 0;
240  G_UseTargets (self, self->activator);
241  self->delay = save;
242 }

Referenced by use_target_explosion().

◆ target_laser_off()

void target_laser_off ( edict_t self)

Definition at line 569 of file g_target.c.

570 {
571  self->spawnflags &= ~1;
572  self->svflags |= SVF_NOCLIENT;
573  self->nextthink = 0;
574 }

Referenced by target_laser_start(), and target_laser_use().

◆ target_laser_on()

void target_laser_on ( edict_t self)

Definition at line 560 of file g_target.c.

561 {
562  if (!self->activator)
563  self->activator = self;
564  self->spawnflags |= 0x80000001;
565  self->svflags &= ~SVF_NOCLIENT;
566  target_laser_think (self);
567 }

Referenced by target_laser_start(), and target_laser_use().

◆ target_laser_start()

void target_laser_start ( edict_t self)

Definition at line 585 of file g_target.c.

586 {
587  edict_t *ent;
588 
589  self->movetype = MOVETYPE_NONE;
590  self->solid = SOLID_NOT;
591  self->s.renderfx |= RF_BEAM|RF_TRANSLUCENT;
592  self->s.modelindex = 1; // must be non-zero
593 
594  // set the beam diameter
595  if (self->spawnflags & 64)
596  self->s.frame = 16;
597  else
598  self->s.frame = 4;
599 
600  // set the color
601  if (self->spawnflags & 2)
602  self->s.skinnum = 0xf2f2f0f0;
603  else if (self->spawnflags & 4)
604  self->s.skinnum = 0xd0d1d2d3;
605  else if (self->spawnflags & 8)
606  self->s.skinnum = 0xf3f3f1f1;
607  else if (self->spawnflags & 16)
608  self->s.skinnum = 0xdcdddedf;
609  else if (self->spawnflags & 32)
610  self->s.skinnum = 0xe0e1e2e3;
611 
612  if (!self->enemy)
613  {
614  if (self->target)
615  {
616  ent = G_Find (NULL, FOFS(targetname), self->target);
617  if (!ent)
618  gi.dprintf ("%s at %s: %s is a bad target\n", self->classname, vtos(self->s.origin), self->target);
619  self->enemy = ent;
620  }
621  else
622  {
623  G_SetMovedir (self->s.angles, self->movedir);
624  }
625  }
626  self->use = target_laser_use;
627  self->think = target_laser_think;
628 
629  if (!self->dmg)
630  self->dmg = 1;
631 
632  VectorSet (self->mins, -8, -8, -8);
633  VectorSet (self->maxs, 8, 8, 8);
634  gi.linkentity (self);
635 
636  if (self->spawnflags & 1)
637  target_laser_on (self);
638  else
639  target_laser_off (self);
640 }

Referenced by SP_target_laser().

◆ target_laser_think()

void target_laser_think ( edict_t self)

Definition at line 495 of file g_target.c.

496 {
497  edict_t *ignore;
498  vec3_t start;
499  vec3_t end;
500  trace_t tr;
501  vec3_t point;
502  vec3_t last_movedir;
503  int count;
504 
505  if (self->spawnflags & 0x80000000)
506  count = 8;
507  else
508  count = 4;
509 
510  if (self->enemy)
511  {
512  VectorCopy (self->movedir, last_movedir);
513  VectorMA (self->enemy->absmin, 0.5, self->enemy->size, point);
514  VectorSubtract (point, self->s.origin, self->movedir);
515  VectorNormalize (self->movedir);
516  if (!VectorCompare(self->movedir, last_movedir))
517  self->spawnflags |= 0x80000000;
518  }
519 
520  ignore = self;
521  VectorCopy (self->s.origin, start);
522  VectorMA (start, 2048, self->movedir, end);
523  while(1)
524  {
526 
527  if (!tr.ent)
528  break;
529 
530  // hurt it if we can
531  if ((tr.ent->takedamage) && !(tr.ent->flags & FL_IMMUNE_LASER))
532  T_Damage (tr.ent, self, self->activator, self->movedir, tr.endpos, vec3_origin, self->dmg, 1, DAMAGE_ENERGY, MOD_TARGET_LASER);
533 
534  // if we hit something that's not a monster or player or is immune to lasers, we're done
535  if (!(tr.ent->svflags & SVF_MONSTER) && (!tr.ent->client))
536  {
537  if (self->spawnflags & 0x80000000)
538  {
539  self->spawnflags &= ~0x80000000;
542  gi.WriteByte (count);
543  gi.WritePosition (tr.endpos);
544  gi.WriteDir (tr.plane.normal);
545  gi.WriteByte (self->s.skinnum);
547  }
548  break;
549  }
550 
551  ignore = tr.ent;
552  VectorCopy (tr.endpos, start);
553  }
554 
555  VectorCopy (tr.endpos, self->s.old_origin);
556 
557  self->nextthink = level.time + FRAMETIME;
558 }

Referenced by target_laser_on(), and target_laser_start().

◆ target_laser_use()

void target_laser_use ( edict_t self,
edict_t other,
edict_t activator 
)

Definition at line 576 of file g_target.c.

577 {
578  self->activator = activator;
579  if (self->spawnflags & 1)
580  target_laser_off (self);
581  else
582  target_laser_on (self);
583 }

Referenced by target_laser_start().

◆ target_lightramp_think()

void target_lightramp_think ( edict_t self)

Definition at line 656 of file g_target.c.

657 {
658  char style[2];
659 
660  style[0] = 'a' + self->movedir[0] + (level.time - self->timestamp) / FRAMETIME * self->movedir[2];
661  style[1] = 0;
662  gi.configstring (CS_LIGHTS+self->enemy->style, style);
663 
664  if ((level.time - self->timestamp) < self->speed)
665  {
666  self->nextthink = level.time + FRAMETIME;
667  }
668  else if (self->spawnflags & 1)
669  {
670  char temp;
671 
672  temp = self->movedir[0];
673  self->movedir[0] = self->movedir[1];
674  self->movedir[1] = temp;
675  self->movedir[2] *= -1;
676  }
677 }

Referenced by SP_target_lightramp(), and target_lightramp_use().

◆ target_lightramp_use()

void target_lightramp_use ( edict_t self,
edict_t other,
edict_t activator 
)

Definition at line 679 of file g_target.c.

680 {
681  if (!self->enemy)
682  {
683  edict_t *e;
684 
685  // check all the targets
686  e = NULL;
687  while (1)
688  {
689  e = G_Find (e, FOFS(targetname), self->target);
690  if (!e)
691  break;
692  if (strcmp(e->classname, "light") != 0)
693  {
694  gi.dprintf("%s at %s ", self->classname, vtos(self->s.origin));
695  gi.dprintf("target %s (%s at %s) is not a light\n", self->target, e->classname, vtos(e->s.origin));
696  }
697  else
698  {
699  self->enemy = e;
700  }
701  }
702 
703  if (!self->enemy)
704  {
705  gi.dprintf("%s target %s not found at %s\n", self->classname, self->target, vtos(self->s.origin));
706  G_FreeEdict (self);
707  return;
708  }
709  }
710 
711  self->timestamp = level.time;
712  target_lightramp_think (self);
713 }

Referenced by SP_target_lightramp().

◆ trigger_crosslevel_trigger_use()

void trigger_crosslevel_trigger_use ( edict_t self,
edict_t other,
edict_t activator 
)

Definition at line 451 of file g_target.c.

452 {
453  game.serverflags |= self->spawnflags;
454  G_FreeEdict (self);
455 }

Referenced by SP_target_crosslevel_trigger().

◆ use_target_blaster()

void use_target_blaster ( edict_t self,
edict_t other,
edict_t activator 
)

Definition at line 416 of file g_target.c.

417 {
418  int effect;
419 
420  if (self->spawnflags & 2)
421  effect = 0;
422  else if (self->spawnflags & 1)
423  effect = EF_HYPERBLASTER;
424  else
425  effect = EF_BLASTER;
426 
427  fire_blaster (self, self->s.origin, self->movedir, self->dmg, self->speed, EF_BLASTER, MOD_TARGET_BLASTER);
428  gi.sound (self, CHAN_VOICE, self->noise_index, 1, ATTN_NORM, 0);
429 }

Referenced by SP_target_blaster().

◆ use_target_changelevel()

void use_target_changelevel ( edict_t self,
edict_t other,
edict_t activator 
)

Definition at line 270 of file g_target.c.

271 {
272  if (level.intermissiontime)
273  return; // already activated
274 
275  if (!deathmatch->value && !coop->value)
276  {
277  if (g_edicts[1].health <= 0)
278  return;
279  }
280 
281  // if noexit, do a ton of damage to other
282  if (deathmatch->value && !( (int)dmflags->value & DF_ALLOW_EXIT) && other != world)
283  {
284  T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, 10 * other->max_health, 1000, 0, MOD_EXIT);
285  return;
286  }
287 
288  // if multiplayer, let everyone know who hit the exit
289  if (deathmatch->value)
290  {
291  if (activator && activator->client)
292  gi.bprintf (PRINT_HIGH, "%s exited the level.\n", activator->client->pers.netname);
293  }
294 
295  // if going to a new unit, clear cross triggers
296  if (strstr(self->map, "*"))
298 
299  BeginIntermission (self);
300 }

Referenced by SP_target_changelevel().

◆ use_target_explosion()

void use_target_explosion ( edict_t self,
edict_t other,
edict_t activator 
)

Definition at line 244 of file g_target.c.

245 {
246  self->activator = activator;
247 
248  if (!self->delay)
249  {
251  return;
252  }
253 
254  self->think = target_explosion_explode;
255  self->nextthink = level.time + self->delay;
256 }

Referenced by SP_target_explosion().

◆ use_target_goal()

void use_target_goal ( edict_t ent,
edict_t other,
edict_t activator 
)

Definition at line 189 of file g_target.c.

190 {
191  gi.sound (ent, CHAN_VOICE, ent->noise_index, 1, ATTN_NORM, 0);
192 
193  level.found_goals++;
194 
195  if (level.found_goals == level.total_goals)
196  gi.configstring (CS_CDTRACK, "0");
197 
198  G_UseTargets (ent, activator);
199  G_FreeEdict (ent);
200 }

Referenced by SP_target_goal().

◆ Use_Target_Help()

void Use_Target_Help ( edict_t ent,
edict_t other,
edict_t activator 
)

Definition at line 118 of file g_target.c.

119 {
120  if (ent->spawnflags & 1)
121  strncpy (game.helpmessage1, ent->message, sizeof(game.helpmessage2)-1);
122  else
123  strncpy (game.helpmessage2, ent->message, sizeof(game.helpmessage1)-1);
124 
125  game.helpchanged++;
126 }

Referenced by SP_target_help().

◆ use_target_secret()

void use_target_secret ( edict_t ent,
edict_t other,
edict_t activator 
)

Definition at line 154 of file g_target.c.

155 {
156  gi.sound (ent, CHAN_VOICE, ent->noise_index, 1, ATTN_NORM, 0);
157 
158  level.found_secrets++;
159 
160  G_UseTargets (ent, activator);
161  G_FreeEdict (ent);
162 }

Referenced by SP_target_secret().

◆ use_target_spawner()

void use_target_spawner ( edict_t self,
edict_t other,
edict_t activator 
)

Definition at line 380 of file g_target.c.

381 {
382  edict_t *ent;
383 
384  ent = G_Spawn();
385  ent->classname = self->target;
386  VectorCopy (self->s.origin, ent->s.origin);
387  VectorCopy (self->s.angles, ent->s.angles);
388  ED_CallSpawn (ent);
389  gi.unlinkentity (ent);
390  KillBox (ent);
391  gi.linkentity (ent);
392  if (self->speed)
393  VectorCopy (self->movedir, ent->velocity);
394 }

Referenced by SP_target_spawner().

◆ Use_Target_Speaker()

void Use_Target_Speaker ( edict_t ent,
edict_t other,
edict_t activator 
)

Definition at line 58 of file g_target.c.

59 {
60  int chan;
61 
62  if (ent->spawnflags & 3)
63  { // looping sound toggles
64  if (ent->s.sound)
65  ent->s.sound = 0; // turn it off
66  else
67  ent->s.sound = ent->noise_index; // start it
68  }
69  else
70  { // normal sound
71  if (ent->spawnflags & 4)
73  else
74  chan = CHAN_VOICE;
75  // use a positioned_sound, because this entity won't normally be
76  // sent to any clients because it is invisible
77  gi.positioned_sound (ent->s.origin, ent, chan, ent->noise_index, ent->volume, ent->attenuation, 0);
78  }
79 }

Referenced by SP_target_speaker().

◆ use_target_splash()

void use_target_splash ( edict_t self,
edict_t other,
edict_t activator 
)

Definition at line 338 of file g_target.c.

339 {
342  gi.WriteByte (self->count);
343  gi.WritePosition (self->s.origin);
344  gi.WriteDir (self->movedir);
345  gi.WriteByte (self->sounds);
346  gi.multicast (self->s.origin, MULTICAST_PVS);
347 
348  if (self->dmg)
349  T_RadiusDamage (self, activator, self->dmg, NULL, self->dmg+40, MOD_SPLASH);
350 }

Referenced by SP_target_splash().

◆ Use_Target_Tent()

void Use_Target_Tent ( edict_t ent,
edict_t other,
edict_t activator 
)

Definition at line 26 of file g_target.c.

27 {
29  gi.WriteByte (ent->style);
30  gi.WritePosition (ent->s.origin);
32 }

Referenced by SP_target_temp_entity().

entity_state_s::old_origin
vec3_t old_origin
Definition: q_shared.h:1175
gi
game_import_t gi
Definition: g_main.c:25
RF_TRANSLUCENT
#define RF_TRANSLUCENT
Definition: q_shared.h:618
game_import_t::dprintf
void(* dprintf)(char *fmt,...)
Definition: game.h:106
cplane_s::normal
vec3_t normal
Definition: q_shared.h:411
edict_s::s
entity_state_t s
Definition: g_local.h:964
use_target_changelevel
void use_target_changelevel(edict_t *self, edict_t *other, edict_t *activator)
Definition: g_target.c:270
edict_s::groundentity
edict_t * groundentity
Definition: g_local.h:1073
MOD_TARGET_BLASTER
#define MOD_TARGET_BLASTER
Definition: g_local.h:496
deathmatch
cvar_t * deathmatch
Definition: g_main.c:35
edict_s::volume
float volume
Definition: g_local.h:1083
edict_s::timestamp
float timestamp
Definition: g_local.h:1008
CONTENTS_MONSTER
#define CONTENTS_MONSTER
Definition: qfiles.h:359
MAX_QPATH
#define MAX_QPATH
Definition: q_shared.h:73
game_import_t::trace
trace_t(* trace)(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, edict_t *passent, int contentmask)
Definition: game.h:128
game_locals_t::helpmessage1
char helpmessage1[512]
Definition: g_local.h:272
G_Spawn
edict_t * G_Spawn(void)
Definition: g_utils.c:420
VectorSubtract
#define VectorSubtract(a, b, c)
Definition: q_shared.h:156
edict_s::activator
edict_t * activator
Definition: g_local.h:1072
TE_EXPLOSION1
@ TE_EXPLOSION1
Definition: q_shared.h:940
game_import_t::WritePosition
void(* WritePosition)(vec3_t pos)
Definition: game.h:152
trace_t::plane
cplane_t plane
Definition: q_shared.h:455
game_import_t::multicast
void(* multicast)(vec3_t origin, multicast_t to)
Definition: game.h:144
edict_s::count
int count
Definition: g_local.h:1067
spawn_t::spawn
void(* spawn)(edict_t *ent)
Definition: g_spawn.c:26
edict_s::last_move_time
float last_move_time
Definition: g_local.h:1049
use_target_goal
void use_target_goal(edict_t *ent, edict_t *other, edict_t *activator)
Definition: g_target.c:189
FRAMETIME
#define FRAMETIME
Definition: g_local.h:73
TE_SPLASH
@ TE_SPLASH
Definition: q_shared.h:945
st
spawn_temp_t st
Definition: g_main.c:27
target_laser_on
void target_laser_on(edict_t *self)
Definition: g_target.c:560
use_target_blaster
void use_target_blaster(edict_t *self, edict_t *other, edict_t *activator)
Definition: g_target.c:416
entity_state_s::origin
vec3_t origin
Definition: q_shared.h:1173
game_locals_t::helpchanged
int helpchanged
Definition: g_local.h:274
SVF_NOCLIENT
#define SVF_NOCLIENT
Definition: game.h:27
CS_CDTRACK
#define CS_CDTRACK
Definition: q_shared.h:1126
edict_s::map
char * map
Definition: g_local.h:1059
DAMAGE_ENERGY
#define DAMAGE_ENERGY
Definition: g_local.h:659
MOD_SPLASH
#define MOD_SPLASH
Definition: g_local.h:492
MOD_TARGET_LASER
#define MOD_TARGET_LASER
Definition: g_local.h:493
ED_CallSpawn
void ED_CallSpawn(edict_t *ent)
Definition: g_spawn.c:278
CONTENTS_DEADMONSTER
#define CONTENTS_DEADMONSTER
Definition: qfiles.h:360
VectorScale
void VectorScale(vec3_t in, vec_t scale, vec3_t out)
Definition: q_shared.c:782
edict_s::inuse
qboolean inuse
Definition: g_local.h:970
target_explosion_explode
void target_explosion_explode(edict_t *self)
Definition: g_target.c:227
edict_s::targetname
char * targetname
Definition: g_local.h:1012
SpawnItem
void SpawnItem(edict_t *ent, gitem_t *item)
Definition: g_items.c:1061
trace_t
Definition: q_shared.h:449
Use_Target_Speaker
void Use_Target_Speaker(edict_t *ent, edict_t *other, edict_t *activator)
Definition: g_target.c:58
i
int i
Definition: q_shared.c:305
edict_s::max_health
int max_health
Definition: g_local.h:1052
G_Find
edict_t * G_Find(edict_t *from, int fieldofs, char *match)
Definition: g_utils.c:45
buffer
GLenum GLfloat * buffer
Definition: qgl_win.c:151
edict_s::client
struct gclient_s * client
Definition: g_local.h:965
game_import_t::sound
void(* sound)(edict_t *ent, int channel, int soundindex, float volume, float attenuation, float timeofs)
Definition: game.h:109
FOFS
#define FOFS(x)
Definition: g_local.h:504
edict_s::movedir
vec3_t movedir
Definition: g_local.h:1021
target_lightramp_use
void target_lightramp_use(edict_t *self, edict_t *other, edict_t *activator)
Definition: g_target.c:679
CONTENTS_SOLID
#define CONTENTS_SOLID
Definition: qfiles.h:333
edict_s::mins
vec3_t mins
Definition: g_local.h:984
DF_ALLOW_EXIT
#define DF_ALLOW_EXIT
Definition: q_shared.h:1060
g_edicts
edict_t * g_edicts
Definition: g_main.c:33
ATTN_NORM
#define ATTN_NORM
Definition: q_shared.h:1019
T_Damage
void T_Damage(edict_t *targ, edict_t *inflictor, edict_t *attacker, vec3_t dir, vec3_t point, vec3_t normal, int damage, int knockback, int dflags, int mod)
Definition: g_combat.c:378
CHAN_RELIABLE
#define CHAN_RELIABLE
Definition: q_shared.h:1014
itemlist
gitem_t itemlist[]
Definition: g_items.c:1134
edict_s::movetype
int movetype
Definition: g_local.h:995
BeginIntermission
void BeginIntermission(edict_t *targ)
Definition: p_hud.c:73
MOD_EXIT
#define MOD_EXIT
Definition: g_local.h:491
entity_state_s::sound
int sound
Definition: q_shared.h:1185
gclient_s::pers
client_persistant_t pers
Definition: g_local.h:884
game_locals_t::helpmessage2
char helpmessage2[512]
Definition: g_local.h:273
Use_Target_Tent
void Use_Target_Tent(edict_t *ent, edict_t *other, edict_t *activator)
Definition: g_target.c:26
ATTN_NONE
#define ATTN_NONE
Definition: q_shared.h:1018
edict_s::message
char * message
Definition: g_local.h:1004
CHAN_AUTO
#define CHAN_AUTO
Definition: q_shared.h:1007
MULTICAST_PHS
@ MULTICAST_PHS
Definition: q_shared.h:110
RF_BEAM
#define RF_BEAM
Definition: q_shared.h:620
edict_s::svflags
int svflags
Definition: g_local.h:983
CHAN_VOICE
#define CHAN_VOICE
Definition: q_shared.h:1009
edict_s::classname
char * classname
Definition: g_local.h:1005
SFL_CROSS_TRIGGER_MASK
#define SFL_CROSS_TRIGGER_MASK
Definition: g_local.h:176
edict_s::speed
float speed
Definition: g_local.h:1020
edict_s
Definition: g_local.h:962
MOD_EXPLOSIVE
#define MOD_EXPLOSIVE
Definition: g_local.h:488
edict_s::mass
int mass
Definition: g_local.h:1026
G_FreeEdict
void G_FreeEdict(edict_t *e)
Definition: g_utils.c:452
MOVETYPE_NONE
@ MOVETYPE_NONE
Definition: g_local.h:188
game_locals_t::num_items
int num_items
Definition: g_local.h:291
use_target_spawner
void use_target_spawner(edict_t *self, edict_t *other, edict_t *activator)
Definition: g_target.c:380
target_earthquake_use
void target_earthquake_use(edict_t *self, edict_t *other, edict_t *activator)
Definition: g_target.c:785
game_import_t::configstring
void(* configstring)(int num, char *string)
Definition: game.h:116
game_import_t::soundindex
int(* soundindex)(char *name)
Definition: game.h:122
edict_s::spawnflags
int spawnflags
Definition: g_local.h:1006
edict_s::sounds
int sounds
Definition: g_local.h:1066
EF_BLASTER
#define EF_BLASTER
Definition: q_shared.h:560
crandom
#define crandom()
Definition: g_local.h:510
client_persistant_t::netname
char netname[16]
Definition: g_local.h:830
game_import_t::positioned_sound
void(* positioned_sound)(vec3_t origin, edict_t *ent, int channel, int soundinedex, float volume, float attenuation, float timeofs)
Definition: game.h:110
cvar_s::value
float value
Definition: q_shared.h:324
vtos
char * vtos(vec3_t v)
Definition: g_utils.c:293
spawn_t::name
char * name
Definition: g_spawn.c:25
game
game_locals_t game
Definition: g_main.c:23
PRINT_HIGH
#define PRINT_HIGH
Definition: q_shared.h:92
target_laser_off
void target_laser_off(edict_t *self)
Definition: g_target.c:569
VectorNormalize
vec_t VectorNormalize(vec3_t v)
Definition: q_shared.c:681
edict_s::noise_index
int noise_index
Definition: g_local.h:1081
NULL
#define NULL
Definition: q_shared.h:60
globals
game_export_t globals
Definition: g_main.c:26
spawn_t
Definition: g_spawn.c:23
edict_s::attenuation
float attenuation
Definition: g_local.h:1084
Q_stricmp
int Q_stricmp(char *s1, char *s2)
Definition: q_shared.c:1192
SOLID_NOT
@ SOLID_NOT
Definition: game.h:35
edict_s::dmg
int dmg
Definition: g_local.h:1063
edict_s::velocity
vec3_t velocity
Definition: g_local.h:1024
target_laser_use
void target_laser_use(edict_t *self, edict_t *other, edict_t *activator)
Definition: g_target.c:576
game_import_t::unlinkentity
void(* unlinkentity)(edict_t *ent)
Definition: game.h:139
svc_temp_entity
@ svc_temp_entity
Definition: qcommon.h:210
target_laser_start
void target_laser_start(edict_t *self)
Definition: g_target.c:585
entity_state_s::skinnum
int skinnum
Definition: q_shared.h:1179
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:158
coop
cvar_t * coop
Definition: g_main.c:36
use_target_secret
void use_target_secret(edict_t *ent, edict_t *other, edict_t *activator)
Definition: g_target.c:154
edict_s::use
void(* use)(edict_t *self, edict_t *other, edict_t *activator)
Definition: g_local.h:1041
TE_LASER_SPARKS
@ TE_LASER_SPARKS
Definition: q_shared.h:950
game_locals_t::serverflags
int serverflags
Definition: g_local.h:288
trace_t::endpos
vec3_t endpos
Definition: q_shared.h:454
vec3_origin
vec3_t vec3_origin
Definition: q_shared.c:24
world
#define world
Definition: g_local.h:550
FL_IMMUNE_LASER
#define FL_IMMUNE_LASER
Definition: g_local.h:59
game_import_t::WriteDir
void(* WriteDir)(vec3_t pos)
Definition: game.h:153
edict_s::style
int style
Definition: g_local.h:1102
target_laser_think
void target_laser_think(edict_t *self)
Definition: g_target.c:495
game_import_t::WriteByte
void(* WriteByte)(int c)
Definition: game.h:147
edict_s::takedamage
int takedamage
Definition: g_local.h:1062
level
GLint level
Definition: qgl_win.c:116
G_UseTargets
void G_UseTargets(edict_t *ent, edict_t *activator)
Definition: g_utils.c:173
edict_s::flags
int flags
Definition: g_local.h:996
target_lightramp_think
void target_lightramp_think(edict_t *self)
Definition: g_target.c:656
trigger_crosslevel_trigger_use
void trigger_crosslevel_trigger_use(edict_t *self, edict_t *other, edict_t *activator)
Definition: g_target.c:451
VectorMA
void VectorMA(vec3_t veca, float scale, vec3_t vecb, vec3_t vecc)
Definition: q_shared.c:719
edict_s::maxs
vec3_t maxs
Definition: g_local.h:984
target_crosslevel_target_think
void target_crosslevel_target_think(edict_t *self)
Definition: g_target.c:469
trace_t::ent
struct edict_s * ent
Definition: q_shared.h:458
spawns
spawn_t spawns[]
Definition: g_spawn.c:148
G_SetMovedir
void G_SetMovedir(vec3_t angles, vec3_t movedir)
Definition: g_utils.c:314
KillBox
qboolean KillBox(edict_t *ent)
Definition: g_utils.c:549
SVF_MONSTER
#define SVF_MONSTER
Definition: game.h:29
fire_blaster
void fire_blaster(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int effect, qboolean hyper)
Definition: g_weapon.c:345
VectorSet
#define VectorSet(v, x, y, z)
Definition: q_shared.h:161
use_target_splash
void use_target_splash(edict_t *self, edict_t *other, edict_t *activator)
Definition: g_target.c:338
CS_LIGHTS
#define CS_LIGHTS
Definition: q_shared.h:1139
dmflags
cvar_t * dmflags
Definition: g_main.c:37
edict_s::delay
float delay
Definition: g_local.h:1088
Use_Target_Help
void Use_Target_Help(edict_t *ent, edict_t *other, edict_t *activator)
Definition: g_target.c:118
VectorCompare
int VectorCompare(vec3_t v1, vec3_t v2)
Definition: q_shared.c:672
use_target_explosion
void use_target_explosion(edict_t *self, edict_t *other, edict_t *activator)
Definition: g_target.c:244
spawn_temp_t::noise
char * noise
Definition: g_local.h:358
edict_s::enemy
edict_t * enemy
Definition: g_local.h:1070
game_import_t::linkentity
void(* linkentity)(edict_t *ent)
Definition: game.h:138
edict_s::size
vec3_t size
Definition: g_local.h:985
entity_state_s::angles
vec3_t angles
Definition: q_shared.h:1174
target_earthquake_think
void target_earthquake_think(edict_t *self)
Definition: g_target.c:755
EF_HYPERBLASTER
#define EF_HYPERBLASTER
Definition: q_shared.h:563
MULTICAST_PVS
@ MULTICAST_PVS
Definition: q_shared.h:111
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:127
Com_sprintf
void Com_sprintf(char *dest, int size, char *fmt,...)
Definition: q_shared.c:1236
edict_s::absmin
vec3_t absmin
Definition: g_local.h:985
edict_s::target
char * target
Definition: g_local.h:1011
game_export_t::num_edicts
int num_edicts
Definition: game.h:231
count
GLint GLsizei count
Definition: qgl_win.c:128
T_RadiusDamage
void T_RadiusDamage(edict_t *inflictor, edict_t *attacker, float damage, edict_t *ignore, float radius, int mod)
Definition: g_combat.c:548
gitem_s::classname
char * classname
Definition: g_local.h:236
gitem_s
Definition: g_local.h:234
game_import_t::bprintf
void(* bprintf)(int printlevel, char *fmt,...)
Definition: game.h:105