FS2_Open
Open source remastering of the Freespace 2 engine
emp.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 
12 #include <stdarg.h>
13 
14 
15 #include "debugconsole/console.h"
16 #include "freespace2/freespace.h"
17 #include "globalincs/linklist.h"
18 #include "hud/hud.h"
19 #include "hud/hudlock.h"
20 #include "hud/hudtarget.h"
21 #include "iff_defs/iff_defs.h"
22 #include "io/timer.h"
23 #include "network/multi.h"
24 #include "network/multimsgs.h"
25 #include "object/object.h"
26 #include "parse/parselo.h"
27 #include "ship/ship.h"
28 #include "weapon/emp.h"
29 #include "weapon/weapon.h"
30 
31 
32 
33 
34 // ----------------------------------------------------------------------------------------------------
35 // EMP EFFECT DEFINES/VARS
36 //
37 
38 // intensity of the playing effect
39 float Emp_intensity = -1.0f; // current intensity of the EMP effect (normalized to EMP_INTENSITY_MAX)
40 float Emp_decr = 0.0f; // how much to decrement the effect per second
41 
42 // timestamp until we should randomly choose another target
44 
45 // max time we'll disrupt turrets on big ships
46 #define MAX_TURRET_DISRUPT_TIME 7500
47 
48 // conventient for determining if EMP is active
49 #define EMP_ACTIVE_LOCAL() (Emp_intensity > 0.0f)
50 
51 // for keeping track of messed up text
52 #define EMP_WACKY_TEXT_LEN 256
53 typedef struct wacky_text {
55  int stamp;
56 } wacky_text;
58 
59 // for randomly inserting characters
60 #define NUM_RANDOM_CHARS 51
62  { 'a', 'b', 'c', 'd', 'e', 'f', 'g', '4', 'h', '8', '_', '$', ')', '-', '~', 'u', 'q',
63  '.', 'x', 'h', '&', '%', '*', '1', '3', 't', 'h', 'o', 'p', '@', 'h', 'i','v', '+', '=',
64  '|', '{', '}', ':', ';', '^', 'l', 'z', 'u', 'v', '<', '>', '?', '5', '8' };
65 
66 // EMP EFFECTS ON PLAYERS -----
67 // 1.) Lose target lock if any, along with ability to lock on
68 // 2.) Display EMP-BLAST icon or something (maybe flash it)
69 // 3.) at wacky intervals, target random ships (which he cannot lock on)
70 // 4.) Randomly flicker HUD gauges
71 // 5.) Randomly swap/mess-up HUD text
72 
73 // EMP EFFECTS ON SHIPS -------
74 // 1.) Lightning effect proportional to the emp effect
75 
76 // ----------------------------------------------------------------------------------------------------
77 // EMP EFFECT FUNCTIONS
78 //
79 
80 // maybe reformat a string
81 void emp_maybe_reformat_text(char *text, int max_len, int gauge_id);
82 
83 // randomize the chars in a string
84 void emp_randomize_chars(char *str);
85 
86 
87 // initialize the EMP effect for the mission
89 {
90  int idx;
91 
92  // reset all vars
93  Emp_intensity = 0.0f;
95 
96  for(idx=0; idx<NUM_TEXT_STAMPS; idx++){
97  memset(Emp_wacky_text[idx].str, 0, EMP_WACKY_TEXT_LEN);
98  Emp_wacky_text[idx].stamp = -1;
99  }
100 }
101 
102 // apply the EMP effect to all relevant ships
103 void emp_apply(vec3d *pos, float inner_radius, float outer_radius, float emp_intensity, float emp_time, bool use_emp_time_for_capship_turrets)
104 {
105  float actual_intensity, actual_time;
106  vec3d dist;
107  float dist_mag;
108  float scale_factor;
109  object *target;
110  ship_obj *so;
111  missile_obj *mo;
112  ship_subsys *moveup;
113  weapon_info *wip_target;
114 
115  // all machines check to see if the blast hit a bomb. if so, shut it down (can't move anymore)
116  for( mo = GET_FIRST(&Missile_obj_list); mo != END_OF_LIST(&Missile_obj_list); mo = GET_NEXT(mo) ) {
117  target = &Objects[mo->objnum];
118  if(target->type != OBJ_WEAPON){
119  continue;
120  }
121 
122  Assert(target->instance >= 0);
123  if(target->instance < 0){
124  continue;
125  }
126  Assert(Weapons[target->instance].weapon_info_index >= 0);
127  if(Weapons[target->instance].weapon_info_index < 0){
128  continue;
129  }
130 
131  // if we have a bomb weapon
132  wip_target = &Weapon_info[Weapons[target->instance].weapon_info_index];
133  if((wip_target->weapon_hitpoints > 0) && !(wip_target->wi_flags2 & WIF2_NO_EMP_KILL)) {
134  // get the distance between the detonation and the target object
135  vm_vec_sub(&dist, &target->pos, pos);
136  dist_mag = vm_vec_mag(&dist);
137 
138  // if the bomb was within 1/4 of the outer radius, castrate it
139  if(dist_mag <= (outer_radius * 0.25f)){
140  // memset(&target->phys_info, 0, sizeof(physics_info));
141  Weapons[target->instance].weapon_flags |= WF_DEAD_IN_WATER;
142  mprintf(("EMP killing weapon\n"));
143  }
144  }
145  }
146 
147  // if I'm only a client in a multiplayer game, do nothing
148  if(MULTIPLAYER_CLIENT){
149  return;
150  }
151 
152  // See if there are any friendly ships present, if so return without preventing msg
153  for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
154  target = &Objects[so->objnum];
155  if(target->type != OBJ_SHIP){
156  continue;
157  }
158 
159  Assert(Objects[so->objnum].instance >= 0);
160  if(Objects[so->objnum].instance < 0){
161  continue;
162  }
165  continue;
166  }
167 
168  // if the ship is a cruiser or cap ship, only apply the EMP effect to turrets
170  float capship_emp_time = use_emp_time_for_capship_turrets ? emp_time : MAX_TURRET_DISRUPT_TIME;
171 
172  moveup = &Ships[target->instance].subsys_list;
173  if(moveup->next != NULL){
174  moveup = moveup->next;
175  }
176  while(moveup != &Ships[target->instance].subsys_list){
177  // if this is a turret, disrupt it
178  if((moveup->system_info != NULL) && (moveup->system_info->type == SUBSYSTEM_TURRET)){
179  vec3d actual_pos;
180 
181  // get the distance to the subsys
182  vm_vec_unrotate(&actual_pos, &moveup->system_info->pnt, &target->orient);
183  vm_vec_add2(&actual_pos, &target->pos);
184  vm_vec_sub(&dist, &actual_pos, pos);
185  dist_mag = vm_vec_mag(&dist);
186 
187  // if for some reason, the object was outside the blast, radius
188  if(dist_mag > outer_radius){
189  // next item
190  moveup = moveup->next;
191  continue;
192  }
193 
194  // compute a scale factor for the emp effect
195  scale_factor = 1.0f;
196  if(dist_mag >= inner_radius){
197  scale_factor = 1.0f - (dist_mag / outer_radius);
198  }
199 
200  scale_factor -= Ship_info[Ships[target->instance].ship_info_index].emp_resistance_mod;
201 
202  if (scale_factor < 0.0f) {
203  moveup = moveup->next;
204  continue;
205  }
206 
207  // disrupt the turret
208  ship_subsys_set_disrupted(moveup, (int)(capship_emp_time * scale_factor));
209 
210  mprintf(("EMP disrupting subsys %s on ship %s (%f, %f)\n", moveup->system_info->subobj_name, Ships[Objects[so->objnum].instance].ship_name, scale_factor, capship_emp_time * scale_factor));
211  }
212 
213  // next item
214  moveup = moveup->next;
215  }
216  }
217  // otherwise coat the whole ship with the effect. mmmmmmmmm.
218  else {
219  // get the distance between the detonation and the target object
220  vm_vec_sub(&dist, &target->pos, pos);
221  dist_mag = vm_vec_mag(&dist);
222 
223  // if for some reason, the object was outside the blast, radius
224  if(dist_mag > outer_radius){
225  continue;
226  }
227 
228  // compute a scale factor for the emp effect
229  scale_factor = 1.0f;
230  if(dist_mag >= inner_radius){
231  scale_factor = 1.0f - (dist_mag / outer_radius);
232  }
233 
234  scale_factor -= Ship_info[Ships[target->instance].ship_info_index].emp_resistance_mod;
235 
236  if (scale_factor < 0.0f) {
237  continue;
238  }
239 
240  // calculate actual EMP effect values
241  actual_intensity = emp_intensity * scale_factor;
242  actual_time = emp_time * scale_factor;
243  mprintf(("EMP effect s : %f, i : %f, t : %f\n", scale_factor, actual_intensity, actual_time));
244 
245  // if this effect happened to be on me, start it now
246  if((target == Player_obj) && !(Game_mode & GM_STANDALONE_SERVER)){
247  emp_start_local(actual_intensity, actual_time);
248  }
249 
250  // if this is a multiplayer game, notify other players of the effect
251  if(Game_mode & GM_MULTIPLAYER){
253  send_emp_effect(target->net_signature, actual_intensity, actual_time);
254  }
255 
256  // now be sure to start the emp effect for the ship itself
257  emp_start_ship(target, actual_intensity, actual_time);
258  }
259  }
260 }
261 
262 // start the emp effect for the passed ship (setup lightning arcs, timestamp, etc)
263 // NOTE : if this ship is also me, I should call emp_start_local() as well
264 void emp_start_ship(object *ship_objp, float intensity, float time)
265 {
266  ship *shipp;
267  ai_info *aip;
268  float start_intensity;
269 
270  // make sure this is a ship
271  Assert(ship_objp->type == OBJ_SHIP);
272  Assert(ship_objp->instance >= 0);
273  shipp = &Ships[ship_objp->instance];
274 
275  // determining pre-existing EMP intensity (if any)
276  start_intensity = shipp->emp_intensity < 0.0f ? 0.0f : shipp->emp_intensity;
277 
278  // setup values (capping them if necessary) (make sure that we un-normalize start_intensity)
279  if(intensity + (start_intensity * EMP_INTENSITY_MAX) >= EMP_INTENSITY_MAX){
280  intensity = EMP_INTENSITY_MAX - 1.0f;
281  } else {
282  intensity += (start_intensity * EMP_INTENSITY_MAX);
283  }
284  intensity /= EMP_INTENSITY_MAX;
285 
286  if(time >= EMP_TIME_MAX){
287  time = EMP_TIME_MAX - 0.1f;
288  }
289  shipp->emp_intensity = intensity;
290  shipp->emp_decr = intensity / time;
291 
292  // multiplayer clients should bail now
293  if(MULTIPLAYER_CLIENT){
294  return;
295  }
296 
297  // do any initial AI effects
298  Assert(shipp->ai_index >= 0);
299  aip = &Ai_info[shipp->ai_index];
300 
301  // lose his current target
302  set_target_objnum(aip, -1);
303  set_targeted_subsys(aip, NULL, -1);
304 }
305 
306 // process a ship for this frame
307 int mod_val = 7;
309 {
310  object *objp;
311  ai_info *aip;
312 
313  Assert(shipp != NULL);
314  if(shipp == NULL){
315  return;
316  }
317  Assert(shipp->objnum >= 0);
318  if(shipp->objnum < 0){
319  return;
320  }
321  objp = &Objects[shipp->objnum];
322 
323  // if the emp intensity is < 0, there is no effect
324  if(shipp->emp_intensity < 0.0f){
325  shipp->emp_intensity = -1.0f;
326 
327  return;
328  }
329 
330  // reduce the emp effect
331  shipp->emp_intensity -= shipp->emp_decr * flFrametime;
332 
333  // multiplayer clients should bail here
334  if(MULTIPLAYER_CLIENT){
335  return;
336  }
337 
338  // if this is a player ship, don't do anything wacky
339  if(objp->flags & OF_PLAYER_SHIP){
340  return;
341  }
342 
343  // lose lock time, etc, etc.
344  Assert(shipp->ai_index >= 0);
345  aip = &Ai_info[shipp->ai_index];
346  aip->aspect_locked_time = 0.0f; // hasn't gotten aspect lock at all
347  aip->current_target_is_locked = 0; // isn't locked on his current target
348  aip->ai_flags &= ~AIF_SEEK_LOCK;
349  aip->nearest_locked_object = -1; // nothing near me, so I won't launch countermeasures
350 
351  // if he's not a fighter or bomber, bail now
352  if(!(Ship_info[shipp->ship_info_index].flags & (SIF_FIGHTER | SIF_BOMBER))){
353  return;
354  }
355 
356  // if he's docked, or ordered to not move, bail now
357  if (object_is_docked(objp) || (aip->mode == AIM_STILL) || (aip->mode == AIM_PLAY_DEAD)){
358  return;
359  }
360 
361  // pick targets randomly and wackily so that the ship flies crazily :)
362  if(((int)f2fl(Missiontime) + (int)(EMP_INTENSITY_MAX * shipp->emp_intensity)) % mod_val == 0){
363  int ship_lookup = ship_get_random_team_ship(iff_get_attackee_mask(shipp->team));
364 
365  // if we got a valid ship object to target
366  if((ship_lookup >= 0) && (Ships[ship_lookup].objnum >= 0) && !(Objects[Ships[ship_lookup].objnum].flags & OF_PROTECTED)){
367  // attack the object
368  ai_attack_object(objp, &Objects[Ships[ship_lookup].objnum], NULL);
369  }
370  }
371 }
372 
373 // start the emp effect for MYSELF (intensity == arbitrary intensity variable, time == time the effect will last)
374 // NOTE : time should be in seconds
375 void emp_start_local(float intensity, float time)
376 {
377  int idx;
378  float start_intensity;
379 
380  // determine pre-existing EMP intensity (if any)
381  start_intensity = Emp_intensity < 0.0f ? 0.0f : Emp_intensity;
382 
383  // cap all values (make sure that we un-normalize start_intensity)
384  if(intensity + (start_intensity * EMP_INTENSITY_MAX) >= EMP_INTENSITY_MAX){
385  intensity = EMP_INTENSITY_MAX - 1.0f;
386  } else {
387  intensity += (start_intensity * EMP_INTENSITY_MAX);
388  }
389  if(time >= EMP_TIME_MAX){
390  time = EMP_TIME_MAX - 0.1f;
391  }
392 
393  // setup all vars
394  Emp_intensity = intensity / EMP_INTENSITY_MAX;
395 
396  // lose my current target if any
397  if(Player_ai != NULL){
398  Player_ai->target_objnum = -1;
399  }
400  // lose any lock we have or are getting
401  hud_lock_reset();
402 
403  // reset HUD gauge text wackiness stuff
404  for(idx=0; idx<NUM_TEXT_STAMPS; idx++){
405  memset(Emp_wacky_text[idx].str, 0, 256);
406  Emp_wacky_text[idx].stamp = -1;
407  }
408 
409  // start the emp icon flashing
410  hud_start_text_flash(NOX("Emp"), 5000);
411 
412  // determine how much we have to decrement the effect per second
413  Emp_decr = Emp_intensity / time;
414 
415  // play a flash
416  game_flash( 1.0f, 1.0f, 0.5f );
417 }
418 
419 // stop the emp effect cold
421 {
422  // kill off various EMP stuff
423  Emp_intensity = -1.0f;
425 }
426 
427 // if the EMP effect is active
429 {
430  return EMP_ACTIVE_LOCAL();
431 }
432 
433 // process some stuff every frame (before frame is rendered)
435 {
436  if(!emp_active_local()){
437  return;
438  }
439 
440  // decrement the intensity a bit
442 
443  // see if we should choose a random target
445  // choose a target (if not the "first" time)
446  if(Emp_wacky_target_timestamp != -1){
448  }
449 
450  // reset the timestamp
451  Emp_wacky_target_timestamp = timestamp((int)frand_range(100.0f, 750.0f * (1.0f - Emp_intensity)));
452  }
453 }
454 
455 // randomly say yes or no to a gauge, if emp is not active, always say yes
457 {
458  // if the EMP effect is not active, always blit
459  if(!emp_active_local()){
460  return 1;
461  }
462 
463  // otherwise, randomly say no
464  return frand_range(0.0f, 1.0f) > Emp_intensity;
465 }
466 
467 // emp hud string
468 void emp_hud_string(int x, int y, int gauge_id, const char *str, int resize_mode)
469 {
470  char tmp[256] = "";
471 
472  // maybe bail
473  if (!*str)
474  return;
475 
476  // copy the string
477  strcpy_s(tmp, str);
478 
479  // if the emp effect is not active, don't even bother messing with the text
480  if(emp_active_local()){
481  emp_maybe_reformat_text(tmp, 256, gauge_id);
482 
483  // jitter the coords
484  emp_hud_jitter(&x, &y);
485  }
486 
487  // print the string out
488  gr_string(x, y, tmp, resize_mode);
489 }
490 
491 // emp hud printf
492 void emp_hud_printf(int x, int y, int gauge_id, const char *format, ...)
493 {
494  char tmp[256];
495  va_list args;
496 
497  // format the text
498  va_start(args, format);
499  vsnprintf(tmp, sizeof(tmp)-1, format, args);
500  va_end(args);
501  tmp[sizeof(tmp)-1] = '\0';
502 
503  // if the emp effect is not active, don't even bother messing with the text
504  if(emp_active_local()){
505  emp_maybe_reformat_text(tmp, 256, gauge_id);
506 
507  // jitter the coords
508  emp_hud_jitter(&x, &y);
509  }
510 
511  // print the string out
512  gr_string(x, y, tmp);
513 }
514 
515 // maybe reformat a string
516 void emp_maybe_reformat_text(char *text, int max_len, int gauge_id)
517 {
518  wacky_text *wt;
519 
520  // if the EMP effect is not active, never reformat it
521  if(!emp_active_local()){
522  return;
523  }
524 
525  // randomly _don't_ apply text craziness
526  if(frand_range(0.0f, 1.0f) > Emp_intensity){
527  return;
528  }
529 
530  // if the gauge is EG_NULL, empty the string
531  if(gauge_id == EG_NULL){
532  strcpy(text, "");
533  return;
534  }
535 
536  // if this gauge has not been wacked out, or if the timestamp has expired, we
537  // neeed to wack it out again
538  Assert((gauge_id >= EG_NULL) && (gauge_id < NUM_TEXT_STAMPS));
539  wt = &Emp_wacky_text[gauge_id];
540  if((wt->stamp == -1) || timestamp_elapsed(wt->stamp)){
541  // reformat specific gauges differently
542  switch(gauge_id){
543  // weapons
545  int wep_index;
546  wep_index = (int)frand_range(0.0f, (float)(MAX_WEAPON_TYPES - 1));
547  strcpy_s(wt->str, Weapon_info[ wep_index >= MAX_WEAPON_TYPES ? 0 : wep_index ].name);
548  break;
549 
550  // escort list
551  case EG_ESCORT1: case EG_ESCORT2: case EG_ESCORT3:
552  // choose a random ship
553  int shipnum;
555  if(shipnum >= 0){
556  strcpy_s(wt->str, Ships[shipnum].ship_name);
557  }
558  break;
559 
560  // directives title
561  case EG_OBJ_TITLE:
562  strcpy_s(wt->str, "");
563  break;
564 
565  // directives themselves
566  case EG_OBJ1: case EG_OBJ2: case EG_OBJ3: case EG_OBJ4: case EG_OBJ5:
567  strcpy_s(wt->str, text);
569  break;
570 
571  // target box info
574  strcpy_s(wt->str, text);
576  break;
577 
578  // squadmsg menu
579  case EG_SQ1: case EG_SQ2: case EG_SQ3: case EG_SQ4: case EG_SQ5: case EG_SQ6: case EG_SQ7:
580  case EG_SQ8: case EG_SQ9: case EG_SQ10:
581  strcpy_s(wt->str, text);
583  break;
584 
585  // default
586  default :
587  return;
588  }
589 
590  // recalculate the timestamp
591  wt->stamp = timestamp((int)frand_range(100.0f, 750.0f * (1.0f - Emp_intensity)));
592 
593  // copy the text
594  strcpy(text, wt->str);
595  }
596  // otherwise, use what we calculated last time
597  else {
598  strcpy(text, wt->str);
599  }
600 
601  // watch out for '#' - Goober5000
603 }
604 
605 // randomize the chars in a string
606 void emp_randomize_chars(char *str)
607 {
608  int idx;
609  int char_index;
610 
611  // shuffle chars around
612  for(idx=0; idx<(int)(strlen(str)-1); idx++){
613  if(frand_range(0.0f, 1.0f) < Emp_intensity){
614  char_index = (int)frand_range(0.0f, (float)(NUM_RANDOM_CHARS - 1));
615  str[idx] = Emp_random_char[char_index];
616  }
617  }
618 }
619 
620 // throw some jitter into HUD x and y coords
621 void emp_hud_jitter(int *x, int *y)
622 {
623  // if the emp effect is not active, don't jitter anything
624  if(!emp_active_local()){
625  return;
626  }
627 
628  // some movement
629  *x += (int)frand_range(-8.0f * Emp_intensity, 8.0f * Emp_intensity);
630  *y += (int)frand_range(-8.0f * Emp_intensity, 8.0f * Emp_intensity);
631 }
632 
633 // current intensity of the EMP effect (0.0 - 1.0)
635 {
636  return Emp_intensity;
637 }
638 
639 DCF(zap, "zap a ship with an EMP effect")
640 {
641  int shipnum;
642  SCP_string ship_str;
643 
644  dc_stuff_string_white(ship_str);
645  shipnum = ship_name_lookup(ship_str.c_str(), 1);
646 
647  if(shipnum >= 0){
648  emp_start_ship(&Objects[Ships[shipnum].objnum], 500.0f, 10.0f);
649  }
650 }
GLenum GLsizei GLenum format
Definition: Gl.h:1509
void game_flash(float r, float g, float b)
Definition: fredstubs.cpp:40
#define EG_SQ3
Definition: emp.h:57
int timestamp(int delta_ms)
Definition: timer.cpp:226
#define MULTIPLAYER_CLIENT
Definition: multi.h:132
#define NUM_RANDOM_CHARS
Definition: emp.cpp:60
fix Missiontime
Definition: systemvars.cpp:19
model_subsystem * system_info
Definition: ship.h:314
weapon Weapons[MAX_WEAPONS]
Definition: weapons.cpp:78
ai_info * Player_ai
Definition: ai.cpp:24
#define EG_SQ5
Definition: emp.h:59
int team
Definition: ship.h:606
char name[NAME_LENGTH]
Definition: weapon.h:322
int objnum
Definition: ship.h:537
int Game_mode
Definition: systemvars.cpp:24
void ai_attack_object(object *attacker, object *attacked, ship_subsys *ssp)
Definition: aicode.cpp:2257
float frand_range(float min, float max)
Return a floating point number in the range min..max.
Definition: floating.cpp:50
weapon_info Weapon_info[MAX_WEAPON_TYPES]
Definition: weapons.cpp:79
#define EG_SQ6
Definition: emp.h:60
#define EG_SQ8
Definition: emp.h:62
#define EG_SQ9
Definition: emp.h:63
float vm_vec_mag(const vec3d *v)
Definition: vecmat.cpp:325
#define EG_WEAPON_P1
Definition: emp.h:31
#define EMP_ACTIVE_LOCAL()
Definition: emp.cpp:49
float flFrametime
Definition: fredstubs.cpp:22
#define NUM_TEXT_STAMPS
Definition: emp.h:28
float Emp_decr
Definition: emp.cpp:40
#define EG_TBOX_HULL
Definition: emp.h:52
void emp_stop_local()
Definition: emp.cpp:420
#define EG_TBOX_EXTRA3
Definition: emp.h:47
Assert(pm!=NULL)
#define EG_TBOX_DIST
Definition: emp.h:49
int target_objnum
Definition: ai.h:339
#define EG_OBJ3
Definition: emp.h:42
Definition: pstypes.h:88
void emp_level_init()
Definition: emp.cpp:88
#define mprintf(args)
Definition: pstypes.h:238
#define EG_WEAPON_S2
Definition: emp.h:35
int ai_index
Definition: ship.h:538
ushort net_signature
Definition: object.h:163
__inline void gr_string(int x, int y, const char *string, int resize_mode=GR_RESIZE_FULL)
Definition: 2d.h:769
void ship_subsys_set_disrupted(ship_subsys *ss, int time)
Definition: ship.cpp:9053
GLclampf f
Definition: Glext.h:7097
#define EG_ESCORT1
Definition: emp.h:36
ai_info Ai_info[MAX_AI_INFO]
Definition: ai.cpp:23
float emp_decr
Definition: ship.h:718
#define EG_ESCORT2
Definition: emp.h:37
#define f2fl(fx)
Definition: floating.h:37
#define EG_OBJ1
Definition: emp.h:40
void emp_process_local()
Definition: emp.cpp:434
int Emp_wacky_target_timestamp
Definition: emp.cpp:43
#define AIF_SEEK_LOCK
Definition: ai.h:42
Definition: ai.h:329
#define EG_SQ1
Definition: emp.h:55
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
Definition: vmallocator.h:21
#define OF_PLAYER_SHIP
Definition: object.h:109
object * objp
Definition: lua.cpp:3105
#define EG_SQ4
Definition: emp.h:58
#define EG_WEAPON_TITLE
Definition: emp.h:30
ship * shipp
Definition: lua.cpp:9162
vec3d pos
Definition: object.h:152
float emp_intensity
Definition: ship.h:717
int ai_flags
Definition: ai.h:330
void emp_randomize_chars(char *str)
Definition: emp.cpp:606
#define EMP_TIME_MAX
Definition: emp.h:23
int iff_get_attackee_mask(int attacker_team)
Definition: iff_defs.cpp:561
int weapon_info_index
Definition: weapon.h:164
DCF(zap,"zap a ship with an EMP effect")
Definition: emp.cpp:639
#define EG_SQ10
Definition: emp.h:64
int objnum
Definition: ship.h:1483
ship_subsys subsys_list
Definition: ship.h:630
void send_emp_effect(ushort net_sig, float intensity, float time)
Definition: multimsgs.cpp:7414
int mod_val
Definition: emp.cpp:307
int objnum
Definition: weapon.h:561
int object_is_docked(object *objp)
Definition: object.cpp:2019
#define EG_TBOX_NAME
Definition: emp.h:53
#define SIF_BOMBER
Definition: ship.h:886
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
int instance
Definition: object.h:150
int weapon_hitpoints
Definition: weapon.h:530
void vm_vec_add2(vec3d *dest, const vec3d *src)
Definition: vecmat.cpp:178
class ship_subsys * next
Definition: ship.h:313
#define SIF_BIG_SHIP
Definition: ship.h:944
#define EG_ESCORT3
Definition: emp.h:38
#define GM_MULTIPLAYER
Definition: systemvars.h:18
#define MAX_TURRET_DISRUPT_TIME
Definition: emp.cpp:46
char str[EMP_WACKY_TEXT_LEN]
Definition: emp.cpp:54
void emp_start_local(float intensity, float time)
Definition: emp.cpp:375
#define EG_OBJ5
Definition: emp.h:44
#define OBJ_WEAPON
Definition: object.h:33
int mode
Definition: ai.h:336
int emp_should_blit_gauge()
Definition: emp.cpp:456
#define MAX_WEAPON_TYPES
Definition: globals.h:73
void hud_lock_reset(float lock_time_scale)
Definition: hudlock.cpp:271
float emp_current_intensity()
Definition: emp.cpp:634
#define OF_PROTECTED
Definition: object.h:108
#define SUBSYSTEM_TURRET
Definition: model.h:54
void emp_hud_jitter(int *x, int *y)
Definition: emp.cpp:621
#define EG_OBJ_TITLE
Definition: emp.h:39
void emp_process_ship(ship *shipp)
Definition: emp.cpp:308
#define EMP_WACKY_TEXT_LEN
Definition: emp.cpp:52
#define EG_OBJ4
Definition: emp.h:43
Definition: ship.h:534
void emp_apply(vec3d *pos, float inner_radius, float outer_radius, float emp_intensity, float emp_time, bool use_emp_time_for_capship_turrets)
Definition: emp.cpp:103
int idx
Definition: multiui.cpp:761
#define EG_WEAPON_P3
Definition: emp.h:33
vec3d * vm_vec_unrotate(vec3d *dest, const vec3d *src, const matrix *m)
Definition: vecmat.cpp:959
GLint GLint GLint GLint GLint x
Definition: Glext.h:5182
object Objects[MAX_OBJECTS]
Definition: object.cpp:62
matrix orient
Definition: object.h:153
int wi_flags2
Definition: weapon.h:385
#define NOX(s)
Definition: pstypes.h:473
#define EG_NULL
Definition: emp.h:29
bool end_string_at_first_hash_symbol(char *src)
Definition: parselo.cpp:3833
#define EG_WEAPON_S1
Definition: emp.h:34
#define WF_DEAD_IN_WATER
Definition: weapon.h:141
#define OBJ_SHIP
Definition: object.h:32
#define GM_STANDALONE_SERVER
Definition: systemvars.h:27
GLbitfield flags
Definition: Glext.h:6722
#define SIF_HUGE_SHIP
Definition: ship.h:945
#define EG_TBOX_EXTRA1
Definition: emp.h:45
void vm_vec_sub(vec3d *dest, const vec3d *src0, const vec3d *src1)
Definition: vecmat.cpp:168
void dc_stuff_string_white(char *out_str, size_t maxlen)
Stuffs a whitespace delimited string to out_str from the command line, stopping at the end of the com...
ship Ships[MAX_SHIPS]
Definition: ship.cpp:122
#define EG_OBJ2
Definition: emp.h:41
vec3d pnt
Definition: model.h:178
#define EG_TBOX_INTEG
Definition: emp.h:54
char Emp_random_char[NUM_RANDOM_CHARS]
Definition: emp.cpp:61
int set_target_objnum(ai_info *aip, int objnum)
Definition: aicode.cpp:1250
void hud_start_text_flash(char *txt, int t, int interval)
void hud_target_random_ship()
Definition: hudtarget.cpp:5221
GLenum target
Definition: Glext.h:6872
#define WIF2_NO_EMP_KILL
Definition: weapon.h:97
char subobj_name[MAX_NAME_LEN]
Definition: model.h:172
int ship_get_random_targetable_ship()
Definition: ship.cpp:16876
ship_obj Ship_obj_list
Definition: ship.cpp:162
wacky_text Emp_wacky_text[NUM_TEXT_STAMPS]
Definition: emp.cpp:57
int stamp
Definition: emp.cpp:55
int ship_info_index
Definition: ship.h:539
#define MULTIPLAYER_MASTER
Definition: multi.h:130
#define EG_SQ7
Definition: emp.h:61
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
SCP_vector< ship_info > Ship_info
Definition: ship.cpp:164
#define SIF_FIGHTER
Definition: ship.h:885
int nearest_locked_object
Definition: ai.h:486
#define timestamp_elapsed(stamp)
Definition: timer.h:102
hull_check pos
Definition: lua.cpp:5050
void emp_hud_string(int x, int y, int gauge_id, const char *str, int resize_mode)
Definition: emp.cpp:468
#define EMP_INTENSITY_MAX
Definition: emp.h:22
float Emp_intensity
Definition: emp.cpp:39
object * Player_obj
Definition: object.cpp:56
#define EG_WEAPON_P2
Definition: emp.h:32
int emp_active_local()
Definition: emp.cpp:428
#define EG_TBOX_CLASS
Definition: emp.h:48
int ship_name_lookup(const char *name, int inc_players)
Definition: ship.cpp:12900
int ship_get_random_team_ship(int team_mask, int flags, float max_dist)
Definition: ship.cpp:14682
uint flags
Definition: object.h:151
struct wacky_text wacky_text
missile_obj Missile_obj_list
Definition: weapons.cpp:84
void emp_maybe_reformat_text(char *text, int max_len, int gauge_id)
Definition: emp.cpp:516
#define EG_TBOX_CARGO
Definition: emp.h:51
void emp_start_ship(object *ship_objp, float intensity, float time)
Definition: emp.cpp:264
char type
Definition: object.h:146
#define AIM_PLAY_DEAD
Definition: ai.h:182
#define AIM_STILL
Definition: ai.h:170
char ship_name[NAME_LENGTH]
Definition: ship.h:604
ship_subsys * set_targeted_subsys(ai_info *aip, ship_subsys *new_subsys, int parent_objnum)
Definition: aicode.cpp:1289
#define EG_TBOX_EXTRA2
Definition: emp.h:46
void emp_hud_printf(int x, int y, int gauge_id, const char *format,...)
Definition: emp.cpp:492
GLint y
Definition: Gl.h:1505
int current_target_is_locked
Definition: ai.h:490
float aspect_locked_time
Definition: ai.h:476
#define EG_SQ2
Definition: emp.h:56
#define strcpy_s(...)
Definition: safe_strings.h:67