FS2_Open
Open source remastering of the Freespace 2 engine
hudtargetbox.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 "asteroid/asteroid.h"
13 #include "cmdline/cmdline.h"
14 #include "debris/debris.h"
15 #include "freespace2/freespace.h"
16 #include "gamesnd/gamesnd.h"
18 #include "hud/hudbrackets.h"
19 #include "hud/hudtargetbox.h"
20 #include "iff_defs/iff_defs.h"
21 #include "io/timer.h"
22 #include "jumpnode/jumpnode.h"
23 #include "localization/localize.h"
24 #include "mission/missionparse.h"
25 #include "model/model.h"
26 #include "network/multi.h"
27 #include "object/object.h"
28 #include "object/objectdock.h"
29 #include "parse/parselo.h"
30 #include "playerman/player.h"
31 #include "ship/ship.h"
32 #include "ship/subsysdamage.h"
34 #include "weapon/emp.h"
35 #include "weapon/weapon.h"
36 
37 #ifndef NDEBUG
38 #include "hud/hudets.h"
39 #endif
40 
41 
42 extern float View_zoom;
43 
45 {
46  { // GR_640
47  8, 362, 131, 112
48  },
49  { // GR_1024
50  8, 629, 131, 112
51  }
52 };
53 
54 object *Enemy_attacker = NULL;
55 
56 static int Target_static_next;
57 static int Target_static_playing;
59 
61 char Cargo_string[256] = "";
62 
63 #ifndef NDEBUG
64 extern int Show_target_debug_info;
65 extern int Show_target_weapons;
66 #endif
67 
68 // used to print out + or - after target distance and speed
69 char* modifiers[] = {
70 //XSTR:OFF
71 "+",
72 "-",
73 ""
74 //XSTR:ON
75 };
76 
77 #define NUM_TBOX_COORDS 11 // keep up to date
78 #define TBOX_BACKGROUND 0
79 #define TBOX_NAME 1
80 #define TBOX_CLASS 2
81 #define TBOX_DIST 3
82 #define TBOX_SPEED 4
83 #define TBOX_CARGO 5
84 #define TBOX_HULL 6
85 #define TBOX_EXTRA 7
86 #define TBOX_EXTRA_ORDERS 8
87 #define TBOX_EXTRA_TIME 9
88 #define TBOX_EXTRA_DOCK 10
89 
90 // cargo scanning extents
92  { // GR_640
93  7, 364, 130, 109
94  },
95  { // GR_1024
96  7, 635, 130, 109
97  }
98 };
99 
100 // first element is time flashing expires
102 
105 bool Lock_targetbox_mode = false;
106 
107 // Different target states. This drives the text display right below the hull integrity on the targetbox.
108 #define TS_DIS 0
109 #define TS_OK 1
110 #define TS_DMG 2
111 #define TS_CRT 3
112 
113 static int Current_ts; // holds current target status
114 static int Last_ts; // holds last target status.
115 
120 {
121  if(Lcl_gr){
122  if ( strstr(outstr, "communication") ) {
123  strcpy(outstr, "Komm");
124  } else if ( !stricmp(outstr, "weapons") ) {
125  strcpy(outstr, "Waffen");
126  } else if ( strstr(outstr, "engine") || strstr(outstr, "Engine")) {
127  strcpy(outstr, "Antrieb");
128  } else if ( !stricmp(outstr, "sensors") ) {
129  strcpy(outstr, "Sensoren");
130  } else if ( strstr(outstr, "navigat") ) {
131  strcpy(outstr, "Nav");
132  } else if ( strstr(outstr, "fighterbay") || strstr(outstr, "Fighterbay") ) {
133  strcpy(outstr, "J\x84gerhangar");
134  } else if ( strstr(outstr, "missile") ) {
135  strcpy(outstr, "Raketenwerfer");
136  } else if ( strstr(outstr, "laser") || strstr(outstr, "turret") ) {
137  strcpy(outstr, "Gesch\x81tzturm");
138  } else if ( strstr(outstr, "Command Tower") || strstr(outstr, "Bridge") ) {
139  strcpy(outstr, "Br\x81""cke");
140  } else if ( strstr(outstr, "Barracks") ) {
141  strcpy(outstr, "Quartiere");
142  } else if ( strstr(outstr, "Reactor") ) {
143  strcpy(outstr, "Reaktor");
144  } else if ( strstr(outstr, "RadarDish") ) {
145  strcpy(outstr, "Radarantenne");
146  } else if (!stricmp(outstr, "Gas Collector")) {
147  strcpy(outstr, "Sammler");
148  }
149  } else if(Lcl_fr){
150  if ( strstr(outstr, "communication") ) {
151  strcpy(outstr, "comm");
152  } else if ( !stricmp(outstr, "weapons") ) {
153  strcpy(outstr, "armes");
154  } else if ( strstr(outstr, "engine") ) {
155  strcpy(outstr, "moteur");
156  } else if ( !stricmp(outstr, "sensors") ) {
157  strcpy(outstr, "detecteurs");
158  } else if ( strstr(outstr, "navi") ) {
159  strcpy(outstr, "nav");
160  } else if ( strstr(outstr, "missile") ) {
161  strcpy(outstr, "lanceur de missiles");
162  } else if ( strstr(outstr, "fighter") ) {
163  strcpy(outstr, "baie de chasse");
164  } else if ( strstr(outstr, "laser") || strstr(outstr, "turret") || strstr(outstr, "missile") ) {
165  strcpy(outstr, "tourelle");
166  }
167  } else if(Lcl_pl){
168  if ( strstr(outstr, "communication") ) {
169  strcpy(outstr, "komunikacja");
170  } else if ( !stricmp(outstr, "weapons") ) {
171  strcpy(outstr, "uzbrojenie");
172  } else if ( strstr(outstr, "engine") || strstr(outstr, "Engine")) {
173  strcpy(outstr, "silnik");
174  } else if ( !stricmp(outstr, "sensors") ) {
175  strcpy(outstr, "sensory");
176  } else if ( strstr(outstr, "navigat") ) {
177  strcpy(outstr, "nawigacja");
178  } else if ( strstr(outstr, "fighterbay") || strstr(outstr, "Fighterbay") ) {
179  strcpy(outstr, "dok my\x9Cliw.");
180  } else if ( strstr(outstr, "missile") ) {
181  strcpy(outstr, "wie\xBF. rakiet.");
182  } else if ( strstr(outstr, "laser") || strstr(outstr, "turret") ) {
183  strcpy(outstr, "wie\xBFyczka");
184  } else if ( strstr(outstr, "Command Tower") || strstr(outstr, "Bridge") ) {
185  strcpy(outstr, "mostek");
186  } else if ( strstr(outstr, "Barracks") ) {
187  strcpy(outstr, "koszary");
188  } else if ( strstr(outstr, "Reactor") ) {
189  strcpy(outstr, "reaktor");
190  } else if ( strstr(outstr, "RadarDish") || strstr(outstr, "Radar Dish") ) {
191  strcpy(outstr, "antena radaru");
192  } else if (!stricmp(outstr, "Gas Collector")) {
193  strcpy(outstr, "zbieracz gazu");
194  }
195  } else {
196  if (strstr(outstr, XSTR("communication", 333))) {
197  strcpy(outstr, XSTR("comm", 334));
198  } else if (strstr(outstr, XSTR("navigation", 335))) {
199  strcpy(outstr, XSTR("nav", 336));
200  } else if (strstr(outstr, "gas collector")) {
201  strcpy(outstr, "collector");
202  }
203  }
204 }
205 
208  Monitor_mask(-1),
209  Use_subsys_name_offsets(false),
210  Use_subsys_integrity_offsets(false),
211  Use_disabled_status_offsets(false)
212 {
213 }
214 
216 {
217  Viewport_offsets[0] = x;
218  Viewport_offsets[1] = y;
219 }
220 
222 {
223  Viewport_w = w;
224  Viewport_h = h;
225 }
226 
228 {
229  Integrity_bar_offsets[0] = x;
230  Integrity_bar_offsets[1] = y;
231 }
232 
234 {
235  integrity_bar_h = h;
236 }
237 
239 {
240  Status_offsets[0] = x;
241  Status_offsets[1] = y;
242 }
243 
245 {
246  Name_offsets[0] = x;
247  Name_offsets[1] = y;
248 }
249 
251 {
252  Class_offsets[0] = x;
253  Class_offsets[1] = y;
254 }
255 
257 {
258  Dist_offsets[0] = x;
259  Dist_offsets[1] = y;
260 }
261 
263 {
264  Speed_offsets[0] = x;
265  Speed_offsets[1] = y;
266 }
267 
269 {
270  Cargo_string_offsets[0] = x;
271  Cargo_string_offsets[1] = y;
272 }
273 
275 {
276  Hull_offsets[0] = x;
277  Hull_offsets[1] = y;
278 }
279 
281 {
282  Cargo_scan_start_offsets[0] = x;
283  Cargo_scan_start_offsets[1] = y;
284 }
285 
287 {
288  Cargo_scan_w = w;
289  Cargo_scan_h = h;
290 }
291 
292 void HudGaugeTargetBox::initSubsysNameOffsets(int x, int y, bool activate)
293 {
294  Subsys_name_offsets[0] = x;
295  Subsys_name_offsets[1] = y;
296  Use_subsys_name_offsets = activate;
297 }
298 
299 void HudGaugeTargetBox::initSubsysIntegrityOffsets(int x, int y, bool activate)
300 {
301  Subsys_integrity_offsets[0] = x;
302  Subsys_integrity_offsets[1] = y;
303  Use_subsys_integrity_offsets = activate;
304 }
305 
306 void HudGaugeTargetBox::initDisabledStatusOffsets(int x, int y, bool activate)
307 {
308  Disabled_status_offsets[0] = x;
309  Disabled_status_offsets[1] = y;
310  Use_disabled_status_offsets = activate;
311 }
312 
314 {
315  Desaturated = desaturate;
316 }
317 
318 void HudGaugeTargetBox::initBitmaps(char *fname_monitor, char *fname_monitor_mask, char *fname_integrity, char *fname_static)
319 {
320  Monitor_frame.first_frame = bm_load_animation(fname_monitor, &Monitor_frame.num_frames);
321  if ( Monitor_frame.first_frame < 0 ) {
322  Warning(LOCATION,"Cannot load hud ani: %s\n", fname_monitor);
323  }
324 
325  Integrity_bar.first_frame = bm_load_animation(fname_integrity, &Integrity_bar.num_frames);
326  if ( Integrity_bar.first_frame < 0 ) {
327  Warning(LOCATION,"Cannot load hud ani: %s\n", fname_integrity);
328  }
329 
330  if ( strlen(fname_monitor_mask) > 0 ) {
331  Monitor_mask = bm_load_animation(fname_monitor_mask);
332 
333  if ( Monitor_mask < 0 ) {
334  Warning(LOCATION, "Cannot load bitmap hud mask: %s\n", fname_monitor_mask);
335  }
336  }
337 
338  strcpy_s(static_fname, fname_static);
339 }
340 
342 {
343  hud_anim_init(&Monitor_static, position[0] + Viewport_offsets[0], position[1] + Viewport_offsets[1], NOX(static_fname));
344 
345  for(int i = 0; i < NUM_TBOX_FLASH_TIMERS; i++) {
346  initFlashTimer(i);
347  }
348 
350 }
351 
353 {
354  Next_flash_timers[index] = 1;
355  flash_flags &= ~(1<<index);
356 }
357 
358 void HudGaugeTargetBox::render(float frametime)
359 {
360  object *target_objp;
361 
362  if ( Player_ai->target_objnum == -1)
363  return;
364 
365  if ( Target_static_playing )
366  return;
367 
368  target_objp = &Objects[Player_ai->target_objnum];
369 
370  setGaugeColor();
371 
372  // blit the background frame
373  renderBitmap(Monitor_frame.first_frame, position[0], position[1]);
374 
375  if ( Monitor_mask >= 0 ) {
376  // render the alpha mask
377  gr_alpha_mask_set(1, 0.5f);
381 
382  renderBitmapColor(Monitor_mask, position[0], position[1]);
383 
386  gr_alpha_mask_set(0, 1.0f);
387  }
388 
389  switch ( target_objp->type ) {
390  case OBJ_SHIP:
391  renderTargetShip(target_objp);
392  break;
393 
394  case OBJ_DEBRIS:
395  renderTargetDebris(target_objp);
396  break;
397 
398  case OBJ_WEAPON:
399  renderTargetWeapon(target_objp);
400  break;
401 
402  case OBJ_ASTEROID:
403  renderTargetAsteroid(target_objp);
404  break;
405 
406  case OBJ_JUMP_NODE:
407  renderTargetJumpNode(target_objp);
408  break;
409 
410  default:
412  break;
413  } // end switch
414 
415  if ( Target_static_playing ) {
416  setGaugeColor();
418  hud_anim_render(&Monitor_static, frametime, 1);
420  } else {
421  showTargetData(frametime);
422  }
423 
425  // Print out what the cargo is
426  if ( maybeFlashSexp() == 1 ) {
428  } else {
430  }
431 
432  renderString(position[0] + Cargo_string_offsets[0], position[1] + Cargo_string_offsets[1], EG_TBOX_CARGO, Cargo_string);
433  }
434 }
435 
437 {
438  setGaugeColor();
439 
440  renderBitmap(Monitor_frame.first_frame+1, position[0], position[1]);
441 }
442 
446 void HudGaugeTargetBox::renderTargetIntegrity(int disabled,int force_obj_num)
447 {
448  int clip_h,w,h;
449  char buf[16];
450 
451  if ( Integrity_bar.first_frame == -1 )
452  return;
453 
454  if ( disabled ) {
455  renderBitmap(Integrity_bar.first_frame, position[0] + Integrity_bar_offsets[0], position[1] + Integrity_bar_offsets[1]);
456  return;
457  }
458 
459  if(force_obj_num == -1)
461 
462  clip_h = fl2i( (1 - Pl_target_integrity) * integrity_bar_h );
463 
464  // print out status of ship
465  switch(Current_ts) {
466  case TS_DIS:
467  strcpy_s(buf,XSTR( "dis", 344));
468  break;
469  case TS_OK:
470  strcpy_s(buf,XSTR( "ok", 345));
471  break;
472  case TS_DMG:
473  strcpy_s(buf,XSTR( "dmg", 346));
474  break;
475  case TS_CRT:
476  strcpy_s(buf,XSTR( "crt", 347));
477  break;
478  }
479 
481 
482  // finally print out the status of this ship
483  renderString(position[0] + Status_offsets[0], position[1] + Status_offsets[1], EG_TBOX_INTEG, buf);
484 
485  setGaugeColor();
486 
487  bm_get_info(Integrity_bar.first_frame,&w,&h);
488 
489  if ( clip_h > 0 ) {
490  // draw the dark portion
491  renderBitmapEx(Integrity_bar.first_frame, position[0] + Integrity_bar_offsets[0], position[1] + Integrity_bar_offsets[1], w, clip_h,0,0);
492  }
493 
494  if ( clip_h <= integrity_bar_h ) {
495  // draw the bright portion
496  renderBitmapEx(Integrity_bar.first_frame+1, position[0] + Integrity_bar_offsets[0], position[1] + Integrity_bar_offsets[1]+clip_h,w,h-clip_h,0,clip_h);
497  }
498 }
499 
500 void HudGaugeTargetBox::renderTargetSetup(vec3d *camera_eye, matrix *camera_orient, float zoom)
501 {
502  // JAS: g3_start_frame uses clip_width and clip_height to determine the
503  // size to render to. Normally, you would set this by using gr_set_clip,
504  // but because of the hacked in hud jittering, I couldn't. So come talk
505  // to me before modifying or reusing the following code. Thanks.
506 
507  int clip_width = Viewport_w;
508  int clip_height = Viewport_h;
509 
510  gr_screen.clip_width = clip_width;
511  gr_screen.clip_height = clip_height;
512  g3_start_frame(1); // Turn on zbuffering
514  g3_set_view_matrix( camera_eye, camera_orient, zoom);
515  model_set_detail_level(1); // use medium detail level
516 
517  setClip(position[0] + Viewport_offsets[0], position[1] + Viewport_offsets[1], Viewport_w, Viewport_h);
518 
519  if (!Cmdline_nohtl) {
522  }
523 
524 }
525 
526 extern bool Interp_desaturate;
527 void HudGaugeTargetBox::renderTargetShip(object *target_objp)
528 {
529  vec3d obj_pos = ZERO_VECTOR;
530  vec3d camera_eye = ZERO_VECTOR;
531  matrix camera_orient = IDENTITY_MATRIX;
532  ship *target_shipp;
533  ship_info *target_sip;
534  vec3d orient_vec, up_vector;
535  int sx, sy;
536  int subsys_in_view;
537  float factor;
538 
539  target_shipp = &Ships[target_objp->instance];
540  target_sip = &Ship_info[target_shipp->ship_info_index];
541 
542  int flags=0;
543  if ( Detail.targetview_model ) {
544  // take the forward orientation to be the vector from the player to the current target
545  vm_vec_sub(&orient_vec, &target_objp->pos, &Player_obj->pos);
546  vm_vec_normalize(&orient_vec);
547 
548  factor = -target_sip->closeup_pos.xyz.z;
549 
550  // use the player's up vector, and construct the viewers orientation matrix
551  if (Player_obj->type == OBJ_SHIP) {
552  vec3d tempv;
553  ship_get_eye(&tempv, &camera_orient, Player_obj, false, false);
554  } else {
555  camera_orient = Player_obj->orient;
556  }
557 
558  up_vector = camera_orient.vec.uvec;
559  vm_vector_2_matrix(&camera_orient,&orient_vec,&up_vector,NULL);
560 
561  // normalize the vector from the player to the current target, and scale by a factor to calculate
562  // the objects position
563  vm_vec_copy_scale(&obj_pos,&orient_vec,factor);
564 
565  // RT, changed scaling here
566  renderTargetSetup(&camera_eye, &camera_orient, target_sip->closeup_zoom);
567 
568  // IMPORTANT NOTE! Code handling the case 'missile_view == TRUE' in rendering section of renderTargetWeapon()
569  // is largely copied over from renderTargetShip(). To keep the codes similar please update
570  // both if and when needed
571  model_render_params render_info;
572  render_info.set_object_number(OBJ_INDEX(target_objp));
573 
574  switch (Targetbox_wire) {
575  case 0:
576  flags |= MR_NO_LIGHTING;
577 
578  break;
579  case 1:
580  if (ship_is_tagged(target_objp))
581  render_info.set_color(*iff_get_color(IFF_COLOR_TAGGED, 1));
582  else
583  render_info.set_color(*iff_get_color_by_team_and_object(target_shipp->team, Player_ship->team, 1, target_objp));
584 
585  if (target_sip->uses_team_colors) {
586  render_info.set_team_color(target_shipp->team_name, target_shipp->secondary_team_name, target_shipp->team_change_timestamp, target_shipp->team_change_time);
587  }
588 
591 
592  break;
593  case 2:
594  break;
595  case 3:
596  if (ship_is_tagged(target_objp))
597  render_info.set_color(*iff_get_color(IFF_COLOR_TAGGED, 1));
598  else
599  render_info.set_color(*iff_get_color_by_team_and_object(target_shipp->team, Player_ship->team, 1, target_objp));
600 
601  flags |= MR_NO_LIGHTING | MR_NO_TEXTURING;
602 
603  break;
604  }
605 
606  if (target_sip->hud_target_lod >= 0) {
607  render_info.set_detail_level_lock(target_sip->hud_target_lod);
608  }
609 
610  if(Targetbox_shader_effect > -1) {
612  }
613 
614  if ( Monitor_mask >= 0 ) {
616  }
617 
618  if ( Desaturated ) {
619  flags |= MR_DESATURATED;
620  render_info.set_color(gauge_color);
621  }
622 
623  if (!Glowpoint_override)
624  Glowpoint_override = true;
625 
626  // set glowmap flag here since model_render (etc) require an objnum to handle glowmaps
627  // if we did pass the objnum, we'd also have thrusters drawn in the targetbox
628  if (target_shipp->flags2 & SF2_GLOWMAPS_DISABLED) {
629  flags |= MR_NO_GLOWMAPS;
630  }
631 
632  render_info.set_flags(flags | MR_AUTOCENTER | MR_NO_FOGGING);
633 
634  // maybe render a special hud-target-only model
635  if(target_sip->model_num_hud >= 0){
636  model_render_immediate( &render_info, target_sip->model_num_hud, &target_objp->orient, &obj_pos);
637  } else {
638  render_info.set_replacement_textures(target_shipp->ship_replacement_textures);
639 
640  model_render_immediate( &render_info, target_sip->model_num, &target_objp->orient, &obj_pos);
641  }
642 
643  Interp_desaturate = false;
644  Glowpoint_override = false;
645 
646  if ( Monitor_mask >= 0 ) {
648  }
649 
650  sx = 0;
651  sy = 0;
652  // check if subsystem target has changed
654  vec3d save_pos;
655 
657  save_pos = target_objp->pos;
658  target_objp->pos = obj_pos;
659  subsys_in_view = hud_targetbox_subsystem_in_view(target_objp, &sx, &sy);
660  target_objp->pos = save_pos;
661 
662  if ( subsys_in_view != -1 ) {
663 
664  // AL 29-3-98: If subsystem is destroyed, draw gray brackets
665  // Goober5000 - hm, caught a tricky bug for destroyable fighterbays
668  } else {
669  hud_set_iff_color( target_objp, 1 );
670  }
671 
672  if ( subsys_in_view ) {
673  draw_brackets_square_quick(sx - 10, sy - 10, sx + 10, sy + 10);
674  } else {
675  draw_brackets_diamond_quick(sx - 10, sy - 10, sx + 10, sy + 10);
676  }
677  }
678  }
680  }
682  renderTargetIntegrity(0,OBJ_INDEX(target_objp));
683 
684  setGaugeColor();
685 
686  renderTargetShipInfo(target_objp);
687  maybeRenderCargoScan(target_sip);
688 }
689 
693 void HudGaugeTargetBox::renderTargetDebris(object *target_objp)
694 {
695  vec3d obj_pos = ZERO_VECTOR;
696  vec3d camera_eye = ZERO_VECTOR;
697  matrix camera_orient = IDENTITY_MATRIX;
698  debris *debrisp;
699  vec3d orient_vec, up_vector;
700  float factor;
701  int flags=0;
702 
703  debrisp = &Debris[target_objp->instance];
704 
705  if ( Detail.targetview_model ) {
706  // take the forward orientation to be the vector from the player to the current target
707  vm_vec_sub(&orient_vec, &target_objp->pos, &Player_obj->pos);
708  vm_vec_normalize(&orient_vec);
709 
710  factor = 2*target_objp->radius;
711 
712  // use the player's up vector, and construct the viewers orientation matrix
713  if (Player_obj->type == OBJ_SHIP) {
714  vec3d tempv;
715  ship_get_eye(&tempv, &camera_orient, Player_obj, false, false);
716  } else {
717  camera_orient = Player_obj->orient;
718  }
719 
720  up_vector = camera_orient.vec.uvec;
721  vm_vector_2_matrix(&camera_orient,&orient_vec,&up_vector,NULL);
722 
723  // normalize the vector from the player to the current target, and scale by a factor to calculate
724  // the objects position
725  vm_vec_copy_scale(&obj_pos,&orient_vec,factor);
726 
727  renderTargetSetup(&camera_eye, &camera_orient, 0.5f);
729 
730  model_render_params render_info;
731 
732  switch (Targetbox_wire) {
733  case 0:
734  flags |= MR_NO_LIGHTING;
735 
736  break;
737  case 1:
738  render_info.set_color(255, 255, 255);
739 
742 
743  break;
744  case 2:
745  break;
746  case 3:
747  render_info.set_color(255, 255, 255);
748 
749  flags |= MR_NO_LIGHTING | MR_NO_TEXTURING;
750 
751  break;
752  }
753 
754  if(Targetbox_shader_effect > -1) {
756  }
757 
758  if ( Monitor_mask >= 0 ) {
760  }
761 
762  if ( Desaturated ) {
763  flags |= MR_DESATURATED;
764  render_info.set_color(gauge_color);
765  }
766 
767  render_info.set_flags(flags | MR_NO_FOGGING);
768 
769  // This calls the colour that doesn't get reset
770  submodel_render_immediate( &render_info, debrisp->model_num, debrisp->submodel_num, &target_objp->orient, &obj_pos);
771 
772  if ( Monitor_mask >= 0 ) {
774  }
775 
777  }
780 
781  // print out ship class that debris came from
782  char printable_ship_class[NAME_LENGTH];
783  if (debrisp->parent_alt_name >= 0)
784  mission_parse_lookup_alt_index(debrisp->parent_alt_name, printable_ship_class);
785  else
786  strcpy_s(printable_ship_class, Ship_info[debrisp->ship_info_index].name);
787 
788  end_string_at_first_hash_symbol(printable_ship_class);
789 
790  renderString(position[0] + Class_offsets[0], position[1] + Class_offsets[1], EG_TBOX_CLASS, printable_ship_class);
791  renderString(position[0] + Name_offsets[0], position[1] + Name_offsets[1], EG_TBOX_NAME, XSTR("Debris", 348));
792 }
793 
797 void HudGaugeTargetBox::renderTargetWeapon(object *target_objp)
798 {
799  vec3d obj_pos = ZERO_VECTOR;
800  vec3d camera_eye = ZERO_VECTOR;
801  matrix camera_orient = IDENTITY_MATRIX;
802  vec3d orient_vec, up_vector;
803  vec3d projection_vec;
804  weapon_info *target_wip = NULL;
805  weapon *wp = NULL;
806  object *viewer_obj, *viewed_obj;
807  int *replacement_textures = NULL;
808  int target_team, is_homing, is_player_missile, missile_view, viewed_model_num, hud_target_lod, w, h;
809  float factor;
810  char outstr[100]; // temp buffer
811  int flags=0;
812 
813  target_team = obj_team(target_objp);
814 
815  wp = &Weapons[target_objp->instance];
816  target_wip = &Weapon_info[wp->weapon_info_index];
817 
818  if (target_wip->model_num == -1)
819  return;
820 
821  is_homing = FALSE;
822  if ( target_wip->wi_flags & WIF_HOMING && wp->homing_object != &obj_used_list )
823  is_homing = TRUE;
824 
825  is_player_missile = FALSE;
826  if ( target_objp->parent_sig == Player_obj->signature ) {
827  is_player_missile = TRUE;
828  }
829 
830  if ( Detail.targetview_model ) {
831  ship *homing_shipp = NULL;
832  ship_info *homing_sip = NULL;
833 
834  viewer_obj = Player_obj;
835  viewed_obj = target_objp;
836  missile_view = FALSE;
837  viewed_model_num = target_wip->model_num;
838  hud_target_lod = target_wip->hud_target_lod;
839  // adding a check here to make sure the homing object is a ship, technically it could be some other object just as well
840  if ( is_homing && is_player_missile && (wp->homing_object->type == OBJ_SHIP)) {
841  homing_shipp = &Ships[wp->homing_object->instance];
842  homing_sip = &Ship_info[homing_shipp->ship_info_index];
843 
844  viewer_obj = target_objp;
845  viewed_obj = wp->homing_object;
846  missile_view = TRUE;
847  viewed_model_num = homing_sip->model_num;
848  replacement_textures = homing_shipp->ship_replacement_textures;
849  hud_target_lod = homing_sip->hud_target_lod;
850  }
851 
852  // take the forward orientation to be the vector from the player to the current target
853  vm_vec_sub(&orient_vec, &viewed_obj->pos, &viewer_obj->pos);
854  vm_vec_normalize(&orient_vec);
855 
856  if (missile_view == TRUE) {
857  vm_vec_sub(&projection_vec, &wp->homing_pos, &viewer_obj->pos);
858  vm_vec_normalize(&projection_vec);
859  }
860 
861  if ( missile_view == FALSE )
862  factor = 2*target_objp->radius;
863  else
864  factor = vm_vec_dist_quick(&viewer_obj->pos, &viewed_obj->pos);
865 
866  // use the viewer's up vector, and construct the viewers orientation matrix
867  if (viewer_obj == Player_obj && Player_obj->type == OBJ_SHIP) {
868  vec3d tempv;
869  ship_get_eye(&tempv, &camera_orient, Player_obj, false, false);
870  } else {
871  camera_orient = viewer_obj->orient;
872  }
873 
874  up_vector = camera_orient.vec.uvec;
875 
876  if (missile_view == FALSE)
877  vm_vector_2_matrix(&camera_orient,&orient_vec,&up_vector,NULL);
878  else
879  vm_vector_2_matrix(&camera_orient,&projection_vec,&up_vector,NULL);
880 
881  // normalize the vector from the viewer to the viwed target, and scale by a factor to calculate
882  // the objects position
883  if (missile_view == FALSE) {
884  vm_vec_copy_scale(&obj_pos,&orient_vec,factor);
885  } else {
886  vm_vec_sub(&obj_pos, &viewed_obj->pos, &viewer_obj->pos);
887  }
888 
889  renderTargetSetup(&camera_eye, &camera_orient, View_zoom/3);
890  model_clear_instance(viewed_model_num);
891 
892  model_render_params render_info;
893 
894  // IMPORTANT NOTE! Code handling the rendering when 'missile_view == TRUE' is largely copied over from
895  // renderTargetShip(). To keep the codes similar please update both if and when needed
896  if (missile_view == FALSE) {
897  switch (Targetbox_wire) {
898  case 0:
899  flags |= MR_NO_LIGHTING;
900 
901  break;
902  case 1:
903  render_info.set_color(*iff_get_color_by_team_and_object(target_team, Player_ship->team, 0, target_objp));
904 
907 
908  break;
909  case 2:
910  break;
911  case 3:
912  render_info.set_color(*iff_get_color_by_team_and_object(target_team, Player_ship->team, 0, target_objp));
913 
914  flags |= MR_NO_LIGHTING | MR_NO_TEXTURING;
915 
916  break;
917  }
918  } else {
919  render_info.set_object_number(OBJ_INDEX(viewed_obj));
920 
921  switch (Targetbox_wire) {
922  case 0:
923  flags |= MR_NO_LIGHTING;
924 
925  break;
926  case 1:
927  if (ship_is_tagged(viewed_obj))
928  render_info.set_color(*iff_get_color(IFF_COLOR_TAGGED, 1));
929  else
930  render_info.set_color(*iff_get_color_by_team_and_object(homing_shipp->team, Player_ship->team, 1, viewed_obj));
931 
932  if (homing_sip->uses_team_colors) {
933  render_info.set_team_color(homing_shipp->team_name, homing_shipp->secondary_team_name, homing_shipp->team_change_timestamp, homing_shipp->team_change_time);
934  }
935 
938 
939  break;
940  case 2:
941  break;
942  case 3:
943  if (ship_is_tagged(viewed_obj))
944  render_info.set_color(*iff_get_color(IFF_COLOR_TAGGED, 1));
945  else
946  render_info.set_color(*iff_get_color_by_team_and_object(homing_shipp->team, Player_ship->team, 1, viewed_obj));
947 
948  flags |= MR_NO_LIGHTING | MR_NO_TEXTURING;
949 
950  break;
951  }
952  }
953 
954  if (hud_target_lod >= 0) {
955  render_info.set_detail_level_lock(hud_target_lod);
956  }
957 
958  if(Targetbox_shader_effect > -1) {
960  }
961 
962  if ( Monitor_mask >= 0 ) {
964  }
965 
966  if ( Desaturated ) {
967  flags |= MR_DESATURATED;
968  render_info.set_color(gauge_color);
969  }
970 
971  if (missile_view == TRUE) {
972  if (!Glowpoint_override)
973  Glowpoint_override = true;
974 
975  // set glowmap flag here since model_render (etc) require an objnum to handle glowmaps
976  // if we did pass the objnum, we'd also have thrusters drawn in the targetbox
977  if (homing_shipp->flags2 & SF2_GLOWMAPS_DISABLED) {
978  flags |= MR_NO_GLOWMAPS;
979  }
980  }
981 
982  if (missile_view == FALSE ) {
983  render_info.set_flags(flags | MR_AUTOCENTER | MR_IS_MISSILE | MR_NO_FOGGING);
984  render_info.set_replacement_textures(replacement_textures);
985 
986  model_render_immediate( &render_info, viewed_model_num, &viewed_obj->orient, &obj_pos );
987  } else {
988  // maybe render a special hud-target-only model
989  // autocentering is bad in this one
990  if(homing_sip->model_num_hud >= 0){
991  render_info.set_flags(flags | MR_NO_FOGGING);
992 
993  model_render_immediate( &render_info, homing_sip->model_num_hud, &viewed_obj->orient, &obj_pos);
994  } else {
995  render_info.set_flags(flags | MR_NO_FOGGING);
996  render_info.set_replacement_textures(homing_shipp->ship_replacement_textures);
997 
998  model_render_immediate( &render_info, homing_sip->model_num, &viewed_obj->orient, &obj_pos );
999  }
1000  }
1001 
1002  if (missile_view == TRUE) {
1003  Glowpoint_override = false;
1004  }
1005 
1006  if ( Monitor_mask >= 0 ) {
1008  }
1009 
1011  }
1013 
1015  setGaugeColor();
1016 
1017  // print out the weapon class name
1018  sprintf( outstr,"%s", target_wip->name );
1019  gr_get_string_size(&w,&h,outstr);
1020 
1021  // drop name past the # sign
1023 
1024  renderString(position[0] + Name_offsets[0], position[1] + Name_offsets[1], EG_TBOX_NAME, outstr);
1025 
1026  // If a homing weapon, show time to impact
1027  if ( is_homing ) {
1028  float dist, speed;
1029 
1030  speed = vm_vec_mag(&target_objp->phys_info.vel);
1031 
1032  // do the extra math only if it won't lead to null vec issues
1033  if(!(IS_VEC_NULL_SQ_SAFE(&target_objp->phys_info.vel))){
1034  vec3d unit_vec, component_vec;
1035 
1036  // in other words substract the magnitude of the target's velocity vectors parallel component from the speed of the weapon
1037  vm_vec_copy_normalize(&unit_vec, &target_objp->phys_info.vel);
1038  speed -= vm_vec_projection_parallel(&component_vec, &wp->homing_object->phys_info.vel, &unit_vec);
1039  }
1040 
1041  dist = vm_vec_dist(&target_objp->pos, &wp->homing_pos);
1042 
1043  if ( speed > 0 ) {
1044  sprintf(outstr, NOX("impact: %.1f sec"), dist/speed);
1045  } else {
1046  strcpy_s(outstr, XSTR( "unknown", 349));
1047  }
1048 
1049  renderString(position[0] + Class_offsets[0], position[1] + Class_offsets[1], EG_TBOX_CLASS, outstr);
1050  }
1051 }
1052 
1057 {
1058  vec3d obj_pos = ZERO_VECTOR;
1059  vec3d camera_eye = ZERO_VECTOR;
1060  matrix camera_orient = IDENTITY_MATRIX;
1061  asteroid *asteroidp;
1062  vec3d orient_vec, up_vector;
1063  float time_to_impact, factor;
1064  int pof;
1065 
1066  int flags=0; //draw flags for wireframe
1067  asteroidp = &Asteroids[target_objp->instance];
1068 
1069  pof = asteroidp->asteroid_subtype;
1070 
1071  time_to_impact = asteroid_time_to_impact(target_objp);
1072 
1073  if ( Detail.targetview_model ) {
1074  // take the forward orientation to be the vector from the player to the current target
1075  vm_vec_sub(&orient_vec, &target_objp->pos, &Player_obj->pos);
1076  vm_vec_normalize(&orient_vec);
1077 
1078  factor = 2*target_objp->radius;
1079 
1080  // use the player's up vector, and construct the viewers orientation matrix
1081  if (Player_obj->type == OBJ_SHIP) {
1082  vec3d tempv;
1083  ship_get_eye(&tempv, &camera_orient, Player_obj, false, false);
1084  } else {
1085  camera_orient = Player_obj->orient;
1086  }
1087 
1088  up_vector = camera_orient.vec.uvec;
1089  vm_vector_2_matrix(&camera_orient,&orient_vec,&up_vector,NULL);
1090 
1091  // normalize the vector from the player to the current target, and scale by a factor to calculate
1092  // the objects position
1093  vm_vec_copy_scale(&obj_pos,&orient_vec,factor);
1094 
1095  renderTargetSetup(&camera_eye, &camera_orient, 0.5f);
1096  model_clear_instance(Asteroid_info[asteroidp->asteroid_type].model_num[pof]);
1097 
1098  model_render_params render_info;
1099 
1100  switch (Targetbox_wire) {
1101  case 0:
1102  flags |= MR_NO_LIGHTING;
1103 
1104  break;
1105  case 1:
1106  if (time_to_impact>=0)
1107  render_info.set_color(255,255,255);
1108  else
1109  render_info.set_color(64,64,0);
1110 
1113 
1114  break;
1115  case 2:
1116  break;
1117  case 3:
1118  if (time_to_impact>=0)
1119  render_info.set_color(255,255,255);
1120  else
1121  render_info.set_color(64,64,0);
1122 
1123  flags |= MR_NO_LIGHTING | MR_NO_TEXTURING;
1124 
1125  break;
1126  }
1127 
1128  if(Targetbox_shader_effect > -1) {
1130  }
1131 
1132  if ( Monitor_mask >= 0 ) {
1134  }
1135 
1136  if ( Desaturated ) {
1137  flags |= MR_DESATURATED;
1138  render_info.set_color(gauge_color);
1139  }
1140 
1141  render_info.set_flags(flags | MR_NO_FOGGING);
1142 
1143  model_render_immediate( &render_info, Asteroid_info[asteroidp->asteroid_type].model_num[pof], &target_objp->orient, &obj_pos );
1144 
1145  if ( Monitor_mask >= 0 ) {
1147  }
1148 
1150  }
1153  setGaugeColor();
1154 
1155  // hud print type of Asteroid (debris)
1156  char hud_name[64];
1157  switch (asteroidp->asteroid_type) {
1158  case ASTEROID_TYPE_SMALL:
1159  case ASTEROID_TYPE_MEDIUM:
1160  case ASTEROID_TYPE_LARGE:
1161  strcpy_s(hud_name, NOX("asteroid"));
1162  break;
1163 
1164  default:
1165  sprintf(hud_name, NOX("%s debris"), Species_info[(asteroidp->asteroid_type / NUM_DEBRIS_SIZES) - 1].species_name);
1166  break;
1167  }
1168 
1169  renderString(position[0] + Name_offsets[0], position[1] + Name_offsets[1], EG_TBOX_NAME, hud_name);
1170 
1171 
1172  if ( time_to_impact >= 0.0f ) {
1173  renderPrintf(position[0] + Class_offsets[0], position[1] + Class_offsets[1], EG_TBOX_CLASS, NOX("impact: %.1f sec"), time_to_impact);
1174  }
1175 }
1176 
1182 {
1183  char outstr[256];
1184  vec3d obj_pos = ZERO_VECTOR;
1185  vec3d camera_eye = ZERO_VECTOR;
1186  matrix camera_orient = IDENTITY_MATRIX;
1187  vec3d orient_vec, up_vector;
1188  float factor, dist;
1189  int hx, hy, w, h;
1191 
1192  for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
1193  if(jnp->GetSCPObject() != target_objp)
1194  continue;
1195 
1196  if ( jnp->IsHidden() ) {
1198  return;
1199  }
1200 
1201  if ( Detail.targetview_model ) {
1202  // take the forward orientation to be the vector from the player to the current target
1203  vm_vec_sub(&orient_vec, &target_objp->pos, &Player_obj->pos);
1204  vm_vec_normalize(&orient_vec);
1205 
1206  factor = target_objp->radius*4.0f;
1207 
1208  // use the player's up vector, and construct the viewers orientation matrix
1209  if (Player_obj->type == OBJ_SHIP) {
1210  vec3d tempv;
1211  ship_get_eye(&tempv, &camera_orient, Player_obj, false, false);
1212  } else {
1213  camera_orient = Player_obj->orient;
1214  }
1215 
1216  up_vector = camera_orient.vec.uvec;
1217  vm_vector_2_matrix(&camera_orient,&orient_vec,&up_vector,NULL);
1218 
1219  // normalize the vector from the player to the current target, and scale by a factor to calculate
1220  // the objects position
1221  vm_vec_copy_scale(&obj_pos,&orient_vec,factor);
1222 
1223  renderTargetSetup(&camera_eye, &camera_orient, 0.5f);
1224 
1225  if ( Monitor_mask >= 0 ) {
1227  }
1228 
1229  jnp->Render( &obj_pos );
1230 
1231  if ( Monitor_mask >= 0 ) {
1233  }
1234 
1236  }
1237 
1240  setGaugeColor();
1241 
1242  strcpy_s(outstr, jnp->GetName());
1244  renderString(position[0] + Name_offsets[0], position[1] + Name_offsets[1], EG_TBOX_NAME, outstr);
1245 
1246  dist = vm_vec_dist_quick(&target_objp->pos, &Player_obj->pos);
1247  if ( Hud_unit_multiplier > 0.0f ) { // use a different displayed distance scale
1248  dist = dist * Hud_unit_multiplier;
1249  }
1250 
1251  // account for hud shaking
1252  hx = fl2i(HUD_offset_x);
1253  hy = fl2i(HUD_offset_y);
1254 
1255  sprintf(outstr,XSTR( "d: %.0f", 340), dist);
1256  hud_num_make_mono(outstr, font_num);
1257  gr_get_string_size(&w,&h,outstr);
1258 
1259  renderPrintf(position[0] + Dist_offsets[0]+hx, position[1] + Dist_offsets[1]+hy, EG_TBOX_DIST, outstr);
1260  }
1261 }
1262 
1271 {
1272 
1273  Targetbox_wire++;
1274  if (Targetbox_wire==3)
1275  Targetbox_wire=0;
1276 }
1277 
1282 {
1284 }
1285 
1293 {
1294  for(int i = 0; i < NUM_TBOX_FLASH_TIMERS; i++) {
1296  }
1297 
1298  Last_ts = -1;
1299  Current_ts = -1;
1300 }
1301 
1303 {
1304  int draw_bright=0;
1305 
1306  setGaugeColor();
1307  if ( !timestamp_elapsed(Targetbox_flash_timers[index]) ) {
1308  if ( timestamp_elapsed(Next_flash_timers[index]) ) {
1309  if ( flash_fast ) {
1310  Next_flash_timers[index] = timestamp(fl2i(TBOX_FLASH_INTERVAL/2.0f));
1311  } else {
1312  Next_flash_timers[index] = timestamp(TBOX_FLASH_INTERVAL);
1313  }
1314  flash_flags ^= (1<<index); // toggle between default and bright frames
1315  }
1316 
1317  if ( flash_flags & (1<<index) ) {
1319  draw_bright=1;
1320  } else {
1322  }
1323  }
1324 
1325  return draw_bright;
1326 }
1327 
1329 {
1330  if (!Cmdline_nohtl) {
1333  }
1334 
1335  g3_end_frame();
1337  resetClip();
1338 }
1339 
1347 void hud_get_target_strength(object *objp, float *shields, float *integrity)
1348 {
1349  *shields = get_shield_pct(objp);
1350  *integrity = get_hull_pct(objp);
1351 }
1352 
1355 {
1357 }
1358 
1360 {
1362 
1364 }
1365 
1367 {
1368  bracket_offsets[0] = x;
1369  bracket_offsets[1] = y;
1370 }
1371 
1373 {
1374  dock_offsets[0] = x;
1375  dock_offsets[1] = y;
1376 }
1377 
1379 {
1380  dock_max_w = width;
1381 }
1382 
1384 {
1385  time_offsets[0] = x;
1386  time_offsets[1] = y;
1387 }
1388 
1390 {
1391  order_offsets[0] = x;
1392  order_offsets[1] = y;
1393 }
1394 
1396 {
1397  order_max_w = width;
1398 }
1399 
1401 {
1402  bracket.first_frame = bm_load_animation(fname, &bracket.num_frames);
1403  if ( bracket.first_frame < 0 ) {
1404  Warning(LOCATION,"Cannot load hud ani: %s\n", fname);
1405  }
1406 }
1407 
1409 {
1410  bm_page_in_aabitmap( bracket.first_frame, bracket.num_frames );
1411 }
1412 
1416 void HudGaugeExtraTargetData::render(float frametime)
1417 {
1418  char outstr[256], tmpbuf[256];
1419  int has_orders = 0;
1420  int not_training;
1421  int extra_data_shown=0;
1422 
1423  if(!canRender())
1424  return;
1425 
1426  if ( Player_ai->target_objnum == -1)
1427  return;
1428 
1429  if ( Target_static_playing )
1430  return;
1431 
1432  object *target_objp;
1433  target_objp = &Objects[Player_ai->target_objnum];
1434 
1435  // only render if this the current target is type OBJ_SHIP
1436  if(target_objp->type != OBJ_SHIP)
1437  return;
1438 
1439  ship* target_shipp = &Ships[target_objp->instance];
1440 
1441  setGaugeColor();
1442 
1443  not_training = !(The_mission.game_type & MISSION_TYPE_TRAINING);
1444  if ( not_training) {
1445  // Print out current orders if the targeted ship is friendly
1446  // AL 12-26-97: only show orders and time to target for friendly ships
1447  // Backslash: actually let's consult the IFF table. Maybe we want to show orders for certain teams, or hide orders for friendlies
1448  if ( ((Player_ship->team == target_shipp->team) || ((Iff_info[target_shipp->team].flags & IFFF_ORDERS_SHOWN) && !(Iff_info[target_shipp->team].flags & IFFF_ORDERS_HIDDEN)) ) && !(ship_get_SIF(target_shipp) & SIF_NOT_FLYABLE) ) {
1449  extra_data_shown=1;
1450  if ( ship_return_orders(outstr, target_shipp) ) {
1451  gr_force_fit_string(outstr, 255, order_max_w);
1452  has_orders = 1;
1453  } else {
1454  strcpy_s(outstr, XSTR( "no orders", 337));
1455  }
1456 
1457  renderString(position[0] + order_offsets[0], position[1] + order_offsets[1], EG_TBOX_EXTRA1, outstr);
1458  }
1459 
1460  if ( has_orders ) {
1461  strcpy_s(outstr, XSTR( "time to: ", 338));
1462  if ( ship_return_time_to_goal(tmpbuf, target_shipp) ) {
1463  strcat_s(outstr, tmpbuf);
1464 
1465  renderString(position[0] + time_offsets[0], position[1] + time_offsets[1], EG_TBOX_EXTRA2, outstr);
1466  }
1467  }
1468  }
1469 
1471  endFlashDock();
1472  }
1473 
1474  // Print out dock status
1475  if ( object_is_docked(target_objp) )
1476  {
1477  startFlashDock(2000);
1478  // count the objects directly docked to me
1479  int dock_count = dock_count_direct_docked_objects(target_objp);
1480 
1481  // docked to only one object
1482  if (dock_count == 1)
1483  {
1484  sprintf(outstr, XSTR("Docked: %s", 339), Ships[dock_get_first_docked_object(target_objp)->instance].ship_name);
1486  }
1487  // docked to multiple objects
1488  else
1489  {
1490  sprintf(outstr, XSTR("Docked: %d objects", 1623), dock_count);
1491  }
1492 
1493  gr_force_fit_string(outstr, 255, dock_max_w);
1494  maybeFlashDock();
1495 
1496  renderString(position[0] + dock_offsets[0], position[1] + dock_offsets[1], EG_TBOX_EXTRA3, outstr);
1497  extra_data_shown=1;
1498  }
1499 
1500  if ( extra_data_shown ) {
1501  renderBitmap(bracket.first_frame, position[0] + bracket_offsets[0], position[1] + bracket_offsets[1]);
1502  }
1503 }
1504 
1506 {
1507  flash_timer[0] = 1;
1508  flash_timer[1] = 1;
1509  flash_flags = false;
1510 }
1511 
1513 {
1514  flash_timer[0] = timestamp(duration);
1515 }
1516 
1518 {
1519  int draw_bright=0;
1520 
1521  setGaugeColor();
1522  if ( !timestamp_elapsed(flash_timer[0]) ) {
1523  if ( timestamp_elapsed(flash_timer[1]) ) {
1524  if ( flash_fast ) {
1525  flash_timer[1] = timestamp(fl2i(TBOX_FLASH_INTERVAL/2.0f));
1526  } else {
1527  flash_timer[1] = timestamp(TBOX_FLASH_INTERVAL);
1528  }
1529 
1530  // toggle between default and bright frames
1531  if(flash_flags)
1532  flash_flags = false;
1533  else
1534  flash_flags = true;
1535  }
1536 
1537  if (flash_flags) {
1539  draw_bright=1;
1540  } else {
1542  }
1543  }
1544 
1545  return draw_bright;
1546 }
1547 
1549 {
1550  flash_timer[0] = timestamp(0);
1551 }
1552 
1553 //from aicode.cpp. Less include...problems...this way.
1556 extern bool turret_weapon_has_subtype(ship_weapon *swp, int subtype);
1557 void get_turret_subsys_name(ship_weapon *swp, char *outstr)
1558 {
1559  Assert(swp != NULL); // Goober5000 //WMC
1560 
1561  //WMC - find the first weapon, if there is one
1562  if (swp->num_primary_banks || swp->num_secondary_banks) {
1564  int flags2 = turret_weapon_aggregate_flags2(swp);
1565 
1566  // check if beam or flak using weapon flags
1567  if (flags & WIF_BEAM) {
1568  sprintf(outstr, "%s", XSTR("Beam turret", 1567));
1569  } else if (flags & WIF_FLAK) {
1570  sprintf(outstr, "%s", XSTR("Flak turret", 1566));
1571  } else {
1573  sprintf(outstr, "%s", XSTR("Missile lnchr", 1569));
1574  } else if (turret_weapon_has_subtype(swp, WP_LASER)) {
1575  // ballistic too! - Goober5000
1576  if (flags2 & WIF2_BALLISTIC)
1577  {
1578  sprintf(outstr, "%s", XSTR("Turret", 1487));
1579  }
1580  // the TVWP has some primaries flagged as bombs
1581  else if (flags & WIF_BOMB)
1582  {
1583  sprintf(outstr, "%s", XSTR("Missile lnchr", 1569));
1584  }
1585  else
1586  {
1587  sprintf(outstr, "%s", XSTR("Laser turret", 1568));
1588  }
1589  } else {
1590  // Mantis #2226: find out if there are any weapons here at all
1591  if (flags == 0 && flags2 == 0) {
1592  sprintf(outstr, "%s", NOX("Unused"));
1593  } else {
1594  // Illegal subtype
1595  static bool Turret_illegal_subtype_warned = false;
1596  if (!Turret_illegal_subtype_warned) {
1597  Turret_illegal_subtype_warned = true;
1598  Warning(LOCATION, "This turret has an illegal subtype! Trace out and fix!");
1599  }
1600  sprintf(outstr, "%s", XSTR("Turret", 1487));
1601  }
1602  }
1603  }
1604  } else if(swp->num_tertiary_banks) {
1605  //TODO: add tertiary turret code stuff here
1606  sprintf(outstr, "%s", NOX("Unknown"));
1607  } else {
1608  // This should not happen
1609  sprintf(outstr, "%s", NOX("Unused"));
1610  }
1611 }
1612 
1614 {
1615  ship *target_shipp;
1616  int w, h, screen_integrity = 1;
1617  char outstr[NAME_LENGTH];
1618  char outstr_name[NAME_LENGTH*2+3];
1619  char outstr_class[NAME_LENGTH];
1620  float ship_integrity, shield_strength;
1621 
1622  Assert(target_objp); // Goober5000
1623  Assert(target_objp->type == OBJ_SHIP);
1624  target_shipp = &Ships[target_objp->instance];
1625 
1626  // set up colors
1627  if ( HudGauge::maybeFlashSexp() == 1 ) {
1628  hud_set_iff_color(target_objp, 1);
1629  } else {
1630  // Print out ship name, with wing name if it exists
1632  hud_set_iff_color(target_objp, 1);
1633  } else {
1634  hud_set_iff_color(target_objp);
1635  }
1636  }
1637 
1638  // set up lines
1639  hud_stuff_ship_name(outstr_name, target_shipp);
1640  hud_stuff_ship_class(outstr_class, target_shipp);
1641 
1642  // maybe concatenate the callsign
1643  if (*outstr_name)
1644  {
1645  char outstr_callsign[NAME_LENGTH];
1646 
1647  hud_stuff_ship_callsign(outstr_callsign, target_shipp);
1648  if (*outstr_callsign)
1649  sprintf(&outstr_name[strlen(outstr_name)], " (%s)", outstr_callsign);
1650  }
1651  // maybe substitute the callsign
1652  else
1653  {
1654  hud_stuff_ship_callsign(outstr_name, target_shipp);
1655  }
1656 
1657  // print lines based on current coords
1658  renderString(position[0] + Name_offsets[0], position[1] + Name_offsets[1], EG_TBOX_NAME, outstr_name);
1659  renderString(position[0] + Class_offsets[0], position[1] + Class_offsets[1], EG_TBOX_CLASS, outstr_class);
1660 
1661  // ----------
1662 
1663  ship_integrity = 1.0f;
1664  shield_strength = 1.0f;
1665  hud_get_target_strength(target_objp, &shield_strength, &ship_integrity);
1666 
1667  // convert to values of 0->100
1668  shield_strength *= 100.0f;
1669  ship_integrity *= 100.0f;
1670 
1671  screen_integrity = fl2i(ship_integrity+0.5f);
1672  if ( screen_integrity == 0 ) {
1673  if ( ship_integrity > 0 ) {
1674  screen_integrity = 1;
1675  }
1676  }
1677  // Print out right-justified integrity
1678  sprintf(outstr, XSTR( "%d%%", 341), screen_integrity);
1679  gr_get_string_size(&w,&h,outstr);
1680 
1681  if ( HudGauge::maybeFlashSexp() == 1 ) {
1683  } else {
1685  }
1686 
1687  renderPrintf(position[0] + Hull_offsets[0]-w, position[1] + Hull_offsets[1], EG_TBOX_HULL, "%s", outstr);
1688  setGaugeColor();
1689 
1690  // print out the targeted sub-system and % integrity
1691  if (Player_ai->targeted_subsys != NULL) {
1693  screen_integrity = fl2i(shield_strength+0.5f);
1694 
1695  if ( screen_integrity < 0 ) {
1696  screen_integrity = 0;
1697  }
1698 
1699  if ( screen_integrity == 0 ) {
1700  if ( shield_strength > 0 ) {
1701  screen_integrity = 1;
1702  }
1703  }
1704 
1706 
1707  // get turret subsys name
1710  } else {
1712  }
1713 
1714  char *p_line;
1715  // hence pipe shall be the linebreak
1716  char linebreak[2] = "|";
1717  int n_linebreaks = 0;
1718  p_line = strpbrk(outstr,linebreak);
1719 
1720  // figure out how many linebreaks we actually have
1721  while (p_line != NULL) {
1722  n_linebreaks++;
1723  p_line = strpbrk(p_line+1,linebreak);
1724  }
1725 
1726  int subsys_name_pos_x;
1727  int subsys_name_pos_y;
1728 
1729  if ( Use_subsys_name_offsets ) {
1730  subsys_name_pos_x = position[0] + Subsys_name_offsets[0];
1731  subsys_name_pos_y = position[1] + Subsys_name_offsets[1];
1732  } else {
1733  subsys_name_pos_x = position[0] + Viewport_offsets[0] + 2;
1734  subsys_name_pos_y = position[1] + Viewport_offsets[1] + Viewport_h;
1735  }
1736 
1737  if (n_linebreaks) {
1738  p_line = strtok(outstr,linebreak);
1739  while (p_line != NULL) {
1740  renderPrintf(subsys_name_pos_x, subsys_name_pos_y-h-((h+1)*n_linebreaks), p_line);
1741  p_line = strtok(NULL,linebreak);
1742  n_linebreaks--;
1743  }
1744  } else {
1746  renderPrintf(subsys_name_pos_x, subsys_name_pos_y-h, outstr);
1747  }
1748 
1749  int subsys_integrity_pos_x;
1750  int subsys_integrity_pos_y;
1751 
1752  if ( Use_subsys_integrity_offsets ) {
1753  subsys_integrity_pos_x = position[0] + Subsys_integrity_offsets[0];
1754  subsys_integrity_pos_y = position[1] + Subsys_integrity_offsets[1];
1755  } else {
1756  subsys_integrity_pos_x = position[0] + Viewport_offsets[0] + Viewport_w - 1;
1757  subsys_integrity_pos_y = position[1] + Viewport_offsets[1] + Viewport_h;
1758  }
1759 
1760  // AL 23-3-98: Fighter bays are a special case. Player cannot destroy them, so don't
1761  // show the subsystem strength
1762  // Goober5000: don't display any strength if we can't destroy this subsystem - but sometimes
1763  // fighterbays can be destroyed
1765  {
1766  sprintf(outstr,XSTR( "%d%%", 341),screen_integrity);
1767  gr_get_string_size(&w,&h,outstr);
1768  renderPrintf(subsys_integrity_pos_x - w, subsys_integrity_pos_y - h, "%s", outstr);
1769  }
1770 
1771  setGaugeColor();
1772  }
1773 
1774  // print out 'disabled' on the monitor if the target is disabled
1775  if ( (target_shipp->flags & SF_DISABLED) || (ship_subsys_disrupted(target_shipp, SUBSYSTEM_ENGINE)) ) {
1776  if ( target_shipp->flags & SF_DISABLED ) {
1777  strcpy_s(outstr, XSTR( "DISABLED", 342));
1778  } else {
1779  strcpy_s(outstr, XSTR( "DISRUPTED", 343));
1780  }
1781  gr_get_string_size(&w,&h,outstr);
1782 
1783  int disabled_status_pos_x;
1784  int disabled_status_pos_y;
1785 
1786  if ( Use_disabled_status_offsets ) {
1787  disabled_status_pos_x = position[0] + Disabled_status_offsets[0];
1788  disabled_status_pos_y = position[1] + Disabled_status_offsets[1];
1789  } else {
1790  disabled_status_pos_x = position[0] + Viewport_offsets[0] + Viewport_w/2 - w/2 - 1;
1791  disabled_status_pos_y = position[1] + Viewport_offsets[1] + Viewport_h - 2*h;
1792  }
1793 
1794  renderPrintf(disabled_status_pos_x, disabled_status_pos_y, "%s", outstr);
1795  }
1796 }
1797 
1802 int hud_targetbox_subsystem_in_view(object *target_objp, int *sx, int *sy)
1803 {
1804  ship_subsys *subsys;
1805  vec3d subobj_pos;
1806  vertex subobj_vertex;
1807  int rval = -1;
1808  polymodel *pm;
1809 
1810  subsys = Player_ai->targeted_subsys;
1811  if (subsys != NULL ) {
1812  get_subsystem_pos(&subobj_pos, target_objp, subsys);
1813 
1814  // is it subsystem in view
1815  if ( Player->subsys_in_view == -1 ) {
1816  rval = ship_subsystem_in_sight(target_objp, subsys, &View_position, &subobj_pos, 0);
1817  } else {
1818  rval = Player->subsys_in_view;
1819  }
1820 
1821  // get screen coords, adjusting for autocenter
1822  Assert(target_objp->type == OBJ_SHIP);
1823  if (target_objp->type == OBJ_SHIP) {
1824  pm = model_get(Ship_info[Ships[target_objp->instance].ship_info_index].model_num);
1825  if (pm->flags & PM_FLAG_AUTOCEN) {
1826  vec3d temp, delta;
1827  vm_vec_copy_scale(&temp, &pm->autocenter, -1.0f);
1828  vm_vec_unrotate(&delta, &temp, &target_objp->orient);
1829  vm_vec_add2(&subobj_pos, &delta);
1830  }
1831  }
1832 
1833  g3_rotate_vertex(&subobj_vertex, &subobj_pos);
1834  g3_project_vertex(&subobj_vertex);
1835  *sx = (int) subobj_vertex.screen.xyw.x;
1836  *sy = (int) subobj_vertex.screen.xyw.y;
1837  }
1838 
1839  return rval;
1840 }
1841 
1842 void hud_cargo_scan_update(object *targetp, float frametime)
1843 {
1844  // update cargo inspection status
1845  Cargo_string[0] = 0;
1846  if ( targetp->type == OBJ_SHIP ) {
1848  if ( Target_display_cargo ) {
1849  if ( Player->cargo_inspect_time > 0 ) {
1851  }
1852  }
1853  }
1854 }
1855 
1857 {
1858  if ( Player->cargo_inspect_time <= 0 ) {
1860  return;
1861  }
1863 
1864 }
1865 
1870 {
1871  int x1, y1, x2, y2;
1872  int scan_time; // time required to scan ship
1873 
1874  if ( Player->cargo_inspect_time <= 0 ) {
1875  return;
1876  }
1877 
1878  scan_time = target_sip->scan_time;
1880 
1881  // draw horizontal scan line
1882  x1 = position[0] + Cargo_scan_start_offsets[0]; // Cargo_scan_coords[gr_screen.res][0];
1883  y1 = fl2i(0.5f + position[1] + Cargo_scan_start_offsets[1] + ( (i2fl(Player->cargo_inspect_time) / scan_time) * Cargo_scan_h ));
1884  x2 = x1 + Cargo_scan_w;
1885 
1886  renderLine(x1, y1, x2, y1);
1887 
1888  // RT Changed this to be optional
1889  if(Cmdline_dualscanlines) {
1890  // added 2nd horizontal scan line - phreak
1891  y1 = fl2i(position[1] + Cargo_scan_start_offsets[1] + Cargo_scan_h - ( (i2fl(Player->cargo_inspect_time) / scan_time) * Cargo_scan_h ));
1892  renderLine(x1, y1, x2, y1);
1893  }
1894 
1895  // draw vertical scan line
1896  x1 = fl2i(0.5f + position[0] + Cargo_scan_start_offsets[0] + ( (i2fl(Player->cargo_inspect_time) / scan_time) * Cargo_scan_w ));
1897  y1 = position[1] + Cargo_scan_start_offsets[1];
1898  y2 = y1 + Cargo_scan_h;
1899 
1900  renderLine(x1, y1-3, x1, y2-1);
1901 
1902  // RT Changed this to be optional
1903  if(Cmdline_dualscanlines) {
1904  // added 2nd vertical scan line - phreak
1905  x1 = fl2i(0.5f + Cargo_scan_w + position[0] + Cargo_scan_start_offsets[0] - ( (i2fl(Player->cargo_inspect_time) / scan_time) * Cargo_scan_w ));
1906  renderLine(x1, y1-3, x1, y2-1);
1907  }
1908 }
1909 
1911 {
1912  char outstr[256]; // temp buffer for sprintf'ing hud output
1913  int w,h; // width and height of string about to print
1914  object *target_objp;
1915  ship *shipp = NULL;
1916  debris *debrisp = NULL;
1917  ship_info *sip = NULL;
1918  int is_ship = 0;
1919  float displayed_target_distance, displayed_target_speed, current_target_distance, current_target_speed;
1920 
1921  setGaugeColor();
1922 
1923  target_objp = &Objects[Player_ai->target_objnum];
1924 
1925  current_target_distance = Player_ai->current_target_distance;
1926 
1927  if ( Hud_unit_multiplier > 0.0f ) { // use a different displayed distance scale
1928  displayed_target_distance = current_target_distance * Hud_unit_multiplier;
1929  } else {
1930  displayed_target_distance = current_target_distance;
1931  }
1932 
1933  switch( Objects[Player_ai->target_objnum].type ) {
1934  case OBJ_SHIP:
1935  shipp = &Ships[target_objp->instance];
1936  sip = &Ship_info[shipp->ship_info_index];
1937  is_ship = 1;
1938  break;
1939 
1940  case OBJ_DEBRIS:
1941  debrisp = &Debris[target_objp->instance];
1942  sip = &Ship_info[debrisp->ship_info_index];
1943  break;
1944 
1945  case OBJ_WEAPON:
1946  sip = NULL;
1947  break;
1948 
1949  case OBJ_ASTEROID:
1950  sip = NULL;
1951  break;
1952 
1953  case OBJ_JUMP_NODE:
1954  return;
1955 
1956  default:
1957  Int3(); // can't happen
1958  break;
1959  }
1960 
1961  int hx, hy;
1962 
1963  // Account for HUD shaking
1964  hx = fl2i(HUD_offset_x);
1965  hy = fl2i(HUD_offset_y);
1966 
1967  // print out the target distance and speed
1968  sprintf(outstr,XSTR( "d: %.0f%s", 350), displayed_target_distance, modifiers[Player_ai->current_target_dist_trend]);
1969 
1970  hud_num_make_mono(outstr, font_num);
1971  gr_get_string_size(&w,&h,outstr);
1972 
1973  renderString(position[0] + Dist_offsets[0]+hx, position[1] + Dist_offsets[1]+hy, EG_TBOX_DIST, outstr);
1974 
1975 #if 0
1976  current_target_speed = vm_vec_dist(&target_objp->pos, &target_objp->last_pos) / frametime;
1977 #endif
1978  // 7/28/99 DKA: Do not use vec_mag_quick -- the error is too big
1979  current_target_speed = vm_vec_mag(&target_objp->phys_info.vel);
1980  if ( current_target_speed < 0.1f ) {
1981  current_target_speed = 0.0f;
1982  }
1983  // if the speed is 0, determine if we are docked with something -- if so, get the docked velocity
1984  if ( (current_target_speed == 0.0f) && is_ship ) {
1985  current_target_speed = dock_calc_docked_fspeed(&Objects[shipp->objnum]);
1986 
1987  if ( current_target_speed < 0.1f ) {
1988  current_target_speed = 0.0f;
1989  }
1990  }
1991 
1992  if ( Hud_speed_multiplier > 0.0f ) { // use a different displayed speed scale
1993  displayed_target_speed = current_target_speed * Hud_speed_multiplier;
1994  } else {
1995  displayed_target_speed = current_target_speed;
1996  }
1997 
1998  sprintf(outstr, XSTR( "s: %.0f%s", 351), displayed_target_speed, (displayed_target_speed>1)?modifiers[Player_ai->current_target_speed_trend]:"");
1999  hud_num_make_mono(outstr, font_num);
2000 
2001  renderString(position[0] + Speed_offsets[0]+hx, position[1] + Speed_offsets[1]+hy, EG_TBOX_SPEED, outstr);
2002 
2003  //
2004  // output target info for debug purposes only, this will be removed later
2005  //
2006 
2007 #ifndef NDEBUG
2008  //XSTR:OFF
2009  char outstr2[256];
2010  if ( Show_target_debug_info && (is_ship == 1) ) {
2011  int sx, sy, dy;
2012  sx = gr_screen.center_offset_x + 5;
2013  dy = gr_get_font_height() + 1;
2014  sy = gr_screen.center_offset_y + 300 - 7*dy;
2015 
2017 
2018  if ( shipp->ai_index >= 0 ) {
2019  ai_info *aip = &Ai_info[shipp->ai_index];
2020 
2021  sprintf(outstr,"AI: %s",Ai_behavior_names[aip->mode]);
2022 
2023  switch (aip->mode) {
2024  case AIM_CHASE:
2025  Assert(aip->submode <= SM_BIG_PARALLEL); // Must be <= largest chase submode value.
2026  sprintf(outstr2," / %s",Submode_text[aip->submode]);
2027  strcat_s(outstr,outstr2);
2028  break;
2029  case AIM_STRAFE:
2030  Assert(aip->submode <= AIS_STRAFE_POSITION); // Must be <= largest chase submode value.
2031  sprintf(outstr2," / %s",Strafe_submode_text[aip->submode-AIS_STRAFE_ATTACK]);
2032  strcat_s(outstr,outstr2);
2033  break;
2034  case AIM_WAYPOINTS:
2035  break;
2036  default:
2037  break;
2038  }
2039 
2040  gr_printf_no_resize(sx, sy, outstr);
2041  sy += dy;
2042 
2043  gr_printf_no_resize(sx, sy, "Max speed = %d, (%d%%)", (int) shipp->current_max_speed, (int) (100.0f * vm_vec_mag(&target_objp->phys_info.vel)/shipp->current_max_speed));
2044  sy += dy;
2045 
2046  // data can be found in target montior
2047  if (aip->target_objnum != -1) {
2048  char target_str[32];
2049  float dot, dist;
2050  vec3d v2t;
2051 
2052  if (aip->target_objnum == Player_obj-Objects)
2053  strcpy_s(target_str, "Player!");
2054  else
2055  sprintf(target_str, "%s", Ships[Objects[aip->target_objnum].instance].ship_name);
2056 
2057  gr_printf_no_resize(sx, sy, "Targ: %s", target_str);
2058  sy += dy;
2059 
2060  dist = vm_vec_dist_quick(&Objects[Player_ai->target_objnum].pos, &Objects[aip->target_objnum].pos);
2061  vm_vec_normalized_dir(&v2t,&Objects[aip->target_objnum].pos, &Objects[Player_ai->target_objnum].pos);
2062 
2063  dot = vm_vec_dot(&v2t, &Objects[Player_ai->target_objnum].orient.vec.fvec);
2064 
2065  // data can be found in target monitor
2066  gr_printf_no_resize(sx, sy, "Targ dot: %3.2f", dot);
2067  sy += dy;
2068  gr_printf_no_resize(sx, sy, "Targ dst: %3.2f", dist);
2069  sy += dy;
2070 
2071  if ( aip->targeted_subsys != NULL ) {
2072  sprintf(outstr, "Subsys: %s", aip->targeted_subsys->system_info->subobj_name);
2073  gr_printf_no_resize(sx, sy, outstr);
2074  }
2075  sy += dy;
2076  }
2077 
2078  // print out energy transfer information on the ship
2079  sy = gr_screen.center_offset_y + 70;
2080 
2081  sprintf(outstr,"MAX G/E: %.0f/%.0f",shipp->weapon_energy,shipp->current_max_speed);
2082  gr_printf_no_resize(sx, sy, outstr);
2083  sy += dy;
2084 
2086  gr_printf_no_resize(sx, sy, outstr);
2087  sy += dy;
2088 
2089  // Show information about attacker.
2090  {
2091  int found = 0;
2092 
2093  if (Enemy_attacker != NULL)
2094  if (Enemy_attacker->type == OBJ_SHIP) {
2095  ship *eshipp;
2096  ai_info *eaip;
2097  float dot, dist;
2098  vec3d v2t;
2099 
2100  eshipp = &Ships[Enemy_attacker->instance];
2101  eaip = &Ai_info[eshipp->ai_index];
2102 
2103  if (eaip->target_objnum == Player_obj-Objects) {
2104  found = 1;
2105  dist = vm_vec_dist_quick(&Enemy_attacker->pos, &Player_obj->pos);
2106  vm_vec_normalized_dir(&v2t,&Objects[eaip->target_objnum].pos, &Enemy_attacker->pos);
2107 
2108  dot = vm_vec_dot(&v2t, &Enemy_attacker->orient.vec.fvec);
2109 
2110  gr_printf_no_resize(sx, sy, "#%i: %s", Enemy_attacker-Objects, Ships[Enemy_attacker->instance].ship_name);
2111  sy += dy;
2112  gr_printf_no_resize(sx, sy, "Targ dist: %5.1f", dist);
2113  sy += dy;
2114  gr_printf_no_resize(sx, sy, "Targ dot: %3.2f", dot);
2115  sy += dy;
2116  }
2117  }
2118 
2119  if (Player_ai->target_objnum == Enemy_attacker - Objects)
2120  found = 0;
2121 
2122  if (!found) {
2123  int i;
2124 
2125  Enemy_attacker = NULL;
2126  for (i=0; i<MAX_OBJECTS; i++)
2127  if (Objects[i].type == OBJ_SHIP) {
2128  int enemy;
2129 
2130  if (i != Player_ai->target_objnum) {
2132 
2133  if (enemy == Player_obj-Objects) {
2134  Enemy_attacker = &Objects[i];
2135  break;
2136  }
2137  }
2138  }
2139  }
2140  }
2141 
2142  // Show target size
2143  // hud_target_w
2144  gr_printf_no_resize(sx, sy, "Targ size: %dx%d", Hud_target_w, Hud_target_h );
2145  sy += dy;
2146 
2147  polymodel *pm = model_get(sip->model_num);
2148  gr_printf_no_resize(sx, sy, "POF:%s", pm->filename );
2149  sy += dy;
2150 
2151  gr_printf_no_resize(sx, sy, "Mass: %.2f\n", pm->mass);
2152  sy += dy;
2153  }
2154  }
2155 
2156  // display the weapons for the target on the HUD. Include ammo counts.
2157  if ( Show_target_weapons && (is_ship == 1) ) {
2158  int sx, sy, dy, i;
2159  ship_weapon *swp;
2160 
2161  swp = &shipp->weapons;
2162  sx = gr_screen.center_offset_x + 400;
2163  sy = gr_screen.center_offset_y + 100;
2164  dy = gr_get_font_height();
2165 
2166  sprintf(outstr,"Num primaries: %d", swp->num_primary_banks);
2167  gr_printf_no_resize(sx,sy,outstr);
2168  sy += dy;
2169  for ( i = 0; i < swp->num_primary_banks; i++ ) {
2170  sprintf(outstr,"%d. %s", i+1, Weapon_info[swp->primary_bank_weapons[i]].name);
2171  gr_printf_no_resize(sx,sy,outstr);
2172  sy += dy;
2173  }
2174 
2175  sy += dy;
2176  sprintf(outstr,"Num secondaries: %d", swp->num_secondary_banks);
2177  gr_printf_no_resize(sx,sy,outstr);
2178  sy += dy;
2179  for ( i = 0; i < swp->num_secondary_banks; i++ ) {
2180  sprintf(outstr,"%d. %s", i+1, Weapon_info[swp->secondary_bank_weapons[i]].name);
2181  gr_printf_no_resize(sx,sy,outstr);
2182  sy += dy;
2183  }
2184  }
2185  //XSTR:ON
2186 
2187 #endif
2188 }
2189 
2194 {
2195  Target_static_next = 0;
2196  Target_static_playing = 0;
2197 }
2198 
2203 {
2204  float sensors_str;
2205 
2206  // on lowest skill level, don't show static on target monitor
2207  if ( Game_skill_level == 0 )
2208  return;
2209 
2210  // if multiplayer observer, don't show static
2212  return;
2213 
2215 
2217  sensors_str = SENSOR_STR_TARGET_NO_EFFECTS-1;
2218  }
2219 
2220  if ( sensors_str > SENSOR_STR_TARGET_NO_EFFECTS ) {
2221  Target_static_playing = 0;
2222  Target_static_next = 0;
2223  } else {
2224  if ( Target_static_next == 0 )
2225  Target_static_next = 1;
2226  }
2227 
2228  if ( timestamp_elapsed(Target_static_next) ) {
2229  Target_static_playing ^= 1;
2230  Target_static_next = timestamp_rand(50, 750);
2231  }
2232 
2233  if ( Target_static_playing ) {
2234  if ( Target_static_looping == -1 ) {
2236  }
2237  } else {
2238  if ( Target_static_looping != -1 ) {
2240  Target_static_looping = -1;
2241  }
2242  }
2243 }
2244 
2254 void hud_update_ship_status(object *targetp)
2255 {
2256  Assert( targetp != NULL );
2257  Assert( (targetp->instance >= 0) && (targetp->instance < MAX_SHIPS) );
2258 
2259  if ( (targetp->instance >= 0) && (targetp->instance < MAX_SHIPS) ) {
2260  // print out status of ship for the targetbox
2261  if ( (Ships[targetp->instance].flags & SF_DISABLED) || (ship_subsys_disrupted(&Ships[targetp->instance], SUBSYSTEM_ENGINE)) ) {
2262  Current_ts = TS_DIS;
2263  } else {
2264  if ( Pl_target_integrity > 0.9 ) {
2265  Current_ts = TS_OK;
2266  } else if ( Pl_target_integrity > 0.2 ) {
2267  Current_ts = TS_DMG;
2268  } else {
2269  Current_ts = TS_CRT;
2270  }
2271  }
2272 
2273  if ( Last_ts != -1 && Current_ts != Last_ts ) {
2275  }
2276  }
2277 
2278  Last_ts = Current_ts;
2279 }
2280 
2287 void hud_targetbox_start_flash(int index, int duration)
2288 {
2289  Targetbox_flash_timers[index] = timestamp(duration);
2290 }
2291 
2296 {
2298 }
2299 
2301 {
2302  bm_page_in_aabitmap( Monitor_frame.first_frame, Monitor_frame.num_frames);
2303 
2304  bm_page_in_aabitmap( Integrity_bar.first_frame, Integrity_bar.num_frames );
2305 }
void hud_get_target_strength(object *objp, float *shields, float *integrity)
bool uses_team_colors
Definition: ship.h:1365
virtual void initialize()
Definition: hud.cpp:1049
int timestamp(int delta_ms)
Definition: timer.cpp:226
void submodel_render_immediate(model_render_params *render_info, int model_num, int submodel_num, matrix *orient, vec3d *pos)
int targetview_model
Definition: systemvars.h:177
struct screen3d::@234::@236 xyw
int flags
Definition: iff_defs.h:45
int i
Definition: multi_pxo.cpp:466
void get_turret_subsys_name(ship_weapon *swp, char *outstr)
fix team_change_timestamp
Definition: ship.h:814
void renderBitmapEx(int frame, int x, int y, int w, int h, int sx, int sy)
Definition: hud.cpp:818
void initViewportOffsets(int x, int y)
model_subsystem * system_info
Definition: ship.h:314
weapon Weapons[MAX_WEAPONS]
Definition: weapons.cpp:78
int primary_bank_weapons[MAX_SHIP_PRIMARY_BANKS]
Definition: ship.h:103
#define MR_SHOW_OUTLINE_HTL
Definition: model.h:885
#define gr_alpha_mask_set
Definition: 2d.h:823
void initDesaturate(bool desaturate)
float Proj_fov
Definition: 3dsetup.cpp:31
void hud_targetbox_init_flash_timer(int index)
#define EG_TBOX_SPEED
Definition: emp.h:50
ai_info * Player_ai
Definition: ai.cpp:24
SCP_string secondary_team_name
Definition: ship.h:813
int team
Definition: ship.h:606
#define TBOX_FLASH_CARGO
Definition: hudtargetbox.h:27
char * ship_subsys_get_name(ship_subsys *ss)
Definition: ship.cpp:15001
#define HUD_C_BRIGHT
Definition: hud.h:162
char name[NAME_LENGTH]
Definition: weapon.h:322
vec3d View_position
Definition: 3dsetup.cpp:20
int num_primary_banks
Definition: ship.h:99
object * homing_object
Definition: weapon.h:177
int objnum
Definition: ship.h:537
float dock_calc_docked_fspeed(object *objp)
Definition: objectdock.cpp:261
int Game_mode
Definition: systemvars.cpp:24
GLfloat GLfloat GLfloat GLfloat h
Definition: Glext.h:7280
void renderTargetShipInfo(object *target_objp)
int game_type
Definition: missionparse.h:138
void renderTargetAsteroid(object *target_objp)
float View_zoom
Definition: 3dsetup.cpp:30
void renderTargetForeground()
void hud_update_cargo_scan_sound()
int Cmdline_dualscanlines
Definition: cmdline.cpp:364
polymodel * model_get(int model_num)
Definition: modelread.cpp:3134
weapon_info Weapon_info[MAX_WEAPON_TYPES]
Definition: weapons.cpp:79
int obj_team(object *objp)
Definition: object.cpp:1843
ship_weapon weapons
Definition: ship.h:658
net_player * Net_player
Definition: multi.cpp:94
SCP_vector< game_snd > Snds
Definition: gamesnd.cpp:19
float vm_vec_mag(const vec3d *v)
Definition: vecmat.cpp:325
#define gr_end_view_matrix
Definition: 2d.h:896
bool Glowpoint_override
Definition: systemvars.cpp:75
void hud_num_make_mono(char *num_str, int font_num)
Convert a number string to use mono-spaced 1 character.
Definition: hud.cpp:2275
Definition: weapon.h:163
GLuint index
Definition: Glext.h:5608
asteroid Asteroids[MAX_ASTEROIDS]
Definition: asteroid.cpp:63
void renderTargetShip(object *target_objp)
#define VM_WARP_CHASE
Definition: systemvars.h:37
physics_info phys_info
Definition: object.h:157
void initTimeOffsets(int x, int y)
void initBracketOffsets(int x, int y)
#define MAX_SHIPS
Definition: globals.h:37
#define SENSOR_STR_TARGET_NO_EFFECTS
Definition: subsysdamage.h:33
#define GR_STENCIL_WRITE
Definition: 2d.h:679
bool ship_subsys_has_instance_name(ship_subsys *ss)
Definition: ship.cpp:15009
int hud_anim_render(hud_anim *ha, float frametime, int draw_alpha, int loop, int hold_last, int reverse, int resize_mode, bool mirror)
Render out a frame of the targetbox static animation, based on how much time has elapsed.
Definition: hud.cpp:2228
void setGaugeColor(int bright_index=-4)
Definition: hud.cpp:445
color * iff_get_color_by_team_and_object(int team, int seen_from_team, int is_bright, object *objp)
Definition: iff_defs.cpp:678
int model_num
Definition: ship.h:1189
#define EG_TBOX_HULL
Definition: emp.h:52
int cargo_inspect_time
Definition: player.h:171
float max_hits
Definition: ship.h:320
#define NUM_TBOX_FLASH_TIMERS
Definition: hudtargetbox.h:25
#define EG_TBOX_EXTRA3
Definition: emp.h:47
void mission_parse_lookup_alt_index(int index, char *out)
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
Assert(pm!=NULL)
#define EG_TBOX_DIST
Definition: emp.h:49
int target_objnum
Definition: ai.h:339
int submode
Definition: ai.h:394
#define MR_NO_POLYS
Definition: model.h:866
void hud_stuff_ship_name(char *ship_name_text, ship *shipp)
Definition: hudtarget.cpp:5269
int Targetbox_shader_effect
Definition: pstypes.h:88
#define ASTEROID_TYPE_SMALL
Definition: asteroid.h:29
#define GR_NUM_RESOLUTIONS
Definition: 2d.h:651
int ai_index
Definition: ship.h:538
#define NETINFO_FLAG_OBSERVER
Definition: multi.h:605
ship_weapon weapons
Definition: ship.h:362
void hud_init_target_static()
int weapon_recharge_index
Definition: ship.h:638
#define OBJ_ASTEROID
Definition: object.h:44
void player_stop_cargo_scan_sound()
#define VM_EXTERNAL
Definition: systemvars.h:31
int subsys_in_view
Definition: player.h:168
matrix Eye_matrix
Definition: 3dsetup.cpp:26
void renderBitmapColor(int frame, int x, int y)
Definition: hud.cpp:752
int bm_get_info(int handle, int *w, int *h, ubyte *flags, int *nframes, int *fps)
Gets info on the bitmap indexed by handle.
Definition: bmpman.cpp:769
void set_flags(uint flags)
#define MR_NO_LIGHTING
Definition: model.h:867
int Lcl_pl
Definition: localize.cpp:49
struct vec3d::@225::@227 xyz
void hud_targetbox_end_flash(int index)
#define NUM_DEBRIS_SIZES
Definition: asteroid.h:26
int maybeFlashElement(int index, int flash_fast=0)
int base_h
Definition: hud.h:205
void model_render_immediate(model_render_params *render_info, int model_num, matrix *orient, vec3d *pos, int render, bool sort)
GLclampf f
Definition: Glext.h:7097
#define MAX_OBJECTS
Definition: globals.h:83
int ship_subsystem_in_sight(object *objp, ship_subsys *subsys, vec3d *eye_pos, vec3d *subsys_pos, int do_facing_check, float *dot_out, vec3d *vec_out)
Definition: ship.cpp:14881
int model_num
Definition: debris.h:34
#define TRUE
Definition: pstypes.h:399
void hud_cease_targeting()
Definition: hudtarget.cpp:4367
int num_tertiary_banks
Definition: ship.h:101
ai_info Ai_info[MAX_AI_INFO]
Definition: ai.cpp:23
int center_offset_y
Definition: 2d.h:364
void initCargoStringOffsets(int x, int y)
float factor
Definition: lua.cpp:440
object obj_used_list
Definition: object.cpp:53
#define MR_SHOW_OUTLINE
Definition: model.h:859
void set_detail_level_lock(int detail_level_lock)
ship_subsys * targeted_subsys
Definition: ai.h:472
int ship_is_tagged(object *objp)
Definition: ship.cpp:17263
void gr_set_screen_scale(int w, int h, int zoom_w, int zoom_h, int max_w, int max_h, int center_w, int center_h, bool force_stretch)
Definition: 2d.cpp:104
void renderLine(int x1, int y1, int x2, int y2)
Definition: hud.cpp:850
int Target_display_cargo
Definition: ai.h:329
void gr_set_color_fast(color *dst)
Definition: 2d.cpp:1197
float weapon_energy
Definition: ship.h:640
uint flags
Definition: ship.h:644
#define IFF_COLOR_TAGGED
Definition: iff_defs.h:21
void initIntegrityOffsets(int x, int y)
int flags
Definition: multi.h:463
void initSubsysNameOffsets(int x, int y, bool activate)
object * objp
Definition: lua.cpp:3105
#define Int3()
Definition: pstypes.h:292
void initOrderOffsets(int x, int y)
void initSubsysIntegrityOffsets(int x, int y, bool activate)
float current_target_distance
Definition: ai.h:489
ship * shipp
Definition: lua.cpp:9162
vec3d pos
Definition: object.h:152
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: Glext.h:7308
int asteroid_subtype
Definition: asteroid.h:103
#define gr_end_proj_matrix
Definition: 2d.h:894
void setClip(int x, int y, int w, int h)
Definition: hud.cpp:942
void ship_get_eye(vec3d *eye_pos, matrix *eye_orient, object *obj, bool do_slew, bool from_origin)
Definition: ship.cpp:13227
int signature
Definition: object.h:145
void initDockMaxWidth(int width)
int clip_height
Definition: 2d.h:378
SCP_list< CJumpNode > Jump_nodes
Definition: jumpnode.cpp:16
GLenum type
Definition: Gl.h:1492
float mass
Definition: model.h:787
char * ship_return_time_to_goal(char *outbuf, ship *sp)
Definition: ship.cpp:15294
int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *keyframe, int can_drop_frames, int dir_type)
Loads a bitmap sequance so we can draw with it.
Definition: bmpman.cpp:1420
#define IS_VEC_NULL_SQ_SAFE(v)
Definition: vecmat.h:24
#define HUD_OBJECT_TARGET_MONITOR
Definition: hudparse.h:136
#define AIM_WAYPOINTS
Definition: ai.h:173
GLint GLsizei width
Definition: Gl.h:1505
Definition: hud.h:201
iff_info Iff_info[MAX_IFFS]
Definition: iff_defs.cpp:20
int weapon_info_index
Definition: weapon.h:164
int asteroid_type
Definition: asteroid.h:102
int submodel_num
Definition: debris.h:35
#define HUD_TARGET_MONITOR
Definition: hudgauges.h:26
int object_is_docked(object *objp)
Definition: object.cpp:2019
#define gr_set_view_matrix
Definition: 2d.h:895
vec3d homing_pos
Definition: weapon.h:179
#define EG_TBOX_NAME
Definition: emp.h:53
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
int turret_weapon_aggregate_flags(ship_weapon *swp)
Definition: aiturret.cpp:360
int current_target_speed_trend
Definition: ai.h:492
int instance
Definition: object.h:150
hud gauge static
Definition: gamesnd.h:116
#define WIF_FLAK
Definition: weapon.h:75
matrix * vm_vector_2_matrix(matrix *m, const vec3d *fvec, const vec3d *uvec, const vec3d *rvec)
Definition: vecmat.cpp:850
float ship_get_subsystem_strength(ship *shipp, int type)
Definition: ship.cpp:13446
Definition: debris.h:23
void vm_vec_add2(vec3d *dest, const vec3d *src)
Definition: vecmat.cpp:178
int Cmdline_nohtl
Definition: cmdline.cpp:438
#define VM_DEAD_VIEW
Definition: systemvars.h:33
vec3d last_pos
Definition: object.h:155
#define gr_set_proj_matrix
Definition: 2d.h:893
vec3d autocenter
Definition: model.h:755
void hud_update_target_static()
struct matrix::@228::@230 vec
screen3d screen
Definition: pstypes.h:173
int subtype
Definition: lua.cpp:9763
bool Interp_desaturate
int font_num
Definition: hud.h:210
#define GM_MULTIPLAYER
Definition: systemvars.h:18
detail_levels Detail
Definition: systemvars.cpp:478
#define AIS_STRAFE_POSITION
Definition: ai.h:292
#define TBOX_FLASH_SUBSYS
Definition: hudtargetbox.h:30
void draw_brackets_square_quick(int x1, int y1, int x2, int y2, int thick)
Definition: hudbrackets.cpp:92
float clip_aspect
Definition: 2d.h:372
#define MR_NO_TEXTURING
Definition: model.h:868
int * ship_replacement_textures
Definition: ship.h:751
#define SM_BIG_PARALLEL
Definition: ai.h:262
int ship_subsys_disrupted(ship_subsys *ss)
Definition: ship.cpp:9033
void initStatusOffsets(int x, int y)
void g3_set_view_matrix(const vec3d *view_pos, const matrix *view_matrix, float zoom)
Definition: 3dsetup.cpp:152
void initBitmaps(char *fname_monitor, char *fname_monitor_mask, char *fname_integrity, char *fname_static)
float get_hull_pct(object *objp)
Definition: object.cpp:271
void model_clear_instance(int model_num)
Definition: modelread.cpp:4624
int num_frames
Definition: hud.h:34
void renderTargetSetup(vec3d *camera_eye, matrix *camera_orient, float zoom)
int hud_target_lod
Definition: weapon.h:332
int num_secondary_banks
Definition: ship.h:100
#define OBJ_WEAPON
Definition: object.h:33
int mode
Definition: ai.h:336
#define WP_LASER
Definition: weapon.h:27
int ship_get_SIF(ship *shipp)
Definition: ship.cpp:16096
ship_subsys * last_subsys_target
Definition: ai.h:473
void showTargetData(float frametime)
int base_w
Definition: hud.h:205
float Max_draw_distance
Definition: 2d.cpp:85
int Show_target_weapons
Definition: fredstubs.cpp:199
char Cargo_string[256]
#define OBJ_DEBRIS
Definition: object.h:37
int last_target
Definition: ai.h:497
#define w(p)
Definition: modelsinc.h:68
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
void set_team_color(team_color &clr)
#define IFF_COLOR_MESSAGE
Definition: iff_defs.h:20
void initDisabledStatusOffsets(int x, int y, bool activate)
#define SUBSYSTEM_TURRET
Definition: model.h:54
void initCargoScanStartOffsets(int x, int y)
float current_max_speed
Definition: ship.h:641
ubyte g3_rotate_vertex(vertex *dest, const vec3d *src)
Definition: 3dmath.cpp:97
uint flags
Definition: model.h:736
void initHullOffsets(int x, int y)
int ship_info_index
Definition: debris.h:29
int engine_recharge_index
Definition: ship.h:639
#define TS_OK
int secondary_bank_weapons[MAX_SHIP_SECONDARY_BANKS]
Definition: ship.h:104
void renderTargetDebris(object *target_objp)
#define AIM_CHASE
Definition: ai.h:166
float vm_vec_normalized_dir(vec3d *dest, const vec3d *end, const vec3d *start)
Definition: vecmat.cpp:591
object * dock_get_first_docked_object(object *objp)
Definition: objectdock.cpp:47
float vm_vec_dist(const vec3d *v0, const vec3d *v1)
Definition: vecmat.cpp:355
char * Ai_behavior_names[MAX_AI_BEHAVIORS]
vec3d closeup_pos
Definition: ship.h:1327
int Cargo_scan_coords[GR_NUM_RESOLUTIONS][4]
float current_hits
Definition: ship.h:319
Definition: ship.h:534
void hud_targetbox_truncate_subsys_name(char *outstr)
void renderTargetJumpNode(object *target_objp)
char * Strafe_submode_text[5]
Definition: aicode.cpp:154
color HUD_color_debug
Definition: hud.cpp:85
#define delta
Definition: fvi.cpp:418
void set_color(color &clr)
int g3_project_vertex(vertex *point)
Definition: 3dmath.cpp:202
void resetClip()
Definition: hud.cpp:978
debris Debris[MAX_DEBRIS_PIECES]
Definition: debris.cpp:41
void hud_update_ship_status(object *targetp)
vec3d * vm_vec_unrotate(vec3d *dest, const vec3d *src, const matrix *m)
Definition: vecmat.cpp:959
void renderString(int x, int y, const char *str)
Definition: hud.cpp:665
void render(float frametime)
#define SF_DISABLED
Definition: ship.h:448
#define IFFF_ORDERS_HIDDEN
Definition: iff_defs.h:27
int get_subsystem_pos(vec3d *pos, object *objp, ship_subsys *subsysp)
Definition: ship.cpp:12975
object Objects[MAX_OBJECTS]
Definition: object.cpp:62
GLint GLint GLint GLint GLint x
Definition: Glext.h:5182
int wi_flags
Definition: weapon.h:384
int Target_window_coords[GR_NUM_RESOLUTIONS][4]
const char * XSTR(const char *str, int index)
Definition: localize.cpp:851
void set_replacement_textures(int *textures)
void initFlashTimer(int index)
void initIntegrityHeight(int h)
#define ZERO_VECTOR
Definition: vecmat.h:60
float Energy_levels[NUM_ENERGY_LEVELS]
Definition: hudets.cpp:26
#define OBJ_INDEX(objp)
Definition: object.h:235
void render(float frametime)
#define GR_STENCIL_NONE
Definition: 2d.h:677
ship * Player_ship
Definition: ship.cpp:124
int parent_alt_name
Definition: debris.h:47
SCP_string team_name
Definition: ship.h:812
matrix orient
Definition: object.h:153
#define gr_stencil_set
Definition: 2d.h:820
int hud_target_lod
Definition: ship.h:1191
#define NOX(s)
Definition: pstypes.h:473
bool end_string_at_first_hash_symbol(char *src)
Definition: parselo.cpp:3833
#define ASTEROID_TYPE_MEDIUM
Definition: asteroid.h:30
void vm_vec_copy_scale(vec3d *dest, const vec3d *src, float s)
Definition: vecmat.cpp:257
int turret_weapon_aggregate_flags2(ship_weapon *swp)
Definition: aiturret.cpp:384
#define WIF_BOMB
Definition: weapon.h:63
#define IFFF_ORDERS_SHOWN
Definition: iff_defs.h:28
#define OBJ_SHIP
Definition: object.h:32
float asteroid_time_to_impact(object *asteroid_objp)
Definition: asteroid.cpp:1790
int Hud_target_w
Definition: hudtarget.cpp:52
GLbitfield flags
Definition: Glext.h:6722
float vm_vec_projection_parallel(vec3d *component, const vec3d *src, const vec3d *unit_vec)
Definition: vecmat.cpp:97
void draw_brackets_diamond_quick(int x1, int y1, int x2, int y2)
#define TBOX_FLASH_HULL
Definition: hudtargetbox.h:28
void hud_anim_init(hud_anim *ha, int sx, int sy, const char *filename)
Initialise the members of the hud_anim struct to default values.
Definition: hud.cpp:2169
#define gr_set_color_buffer
Definition: 2d.h:839
int maybeFlashSexp()
Definition: hud.cpp:617
int dock_count_direct_docked_objects(object *objp)
Definition: objectdock.cpp:77
int Show_target_debug_info
Definition: fredstubs.cpp:200
int first_frame
Definition: hud.h:33
#define IDENTITY_MATRIX
Definition: vecmat.h:64
#define EG_TBOX_EXTRA1
Definition: emp.h:45
void vm_vec_sub(vec3d *dest, const vec3d *src0, const vec3d *src1)
Definition: vecmat.cpp:168
#define SUBSYSTEM_ENGINE
Definition: model.h:53
vec3d vel
Definition: physics.h:77
void initDistOffsets(int x, int y)
virtual bool canRender()
Definition: hud.cpp:1059
#define MISSION_TYPE_TRAINING
Definition: missionparse.h:63
vec3d Eye_position
Definition: 3dsetup.cpp:27
color * iff_get_color(int color_index, int is_bright)
Definition: iff_defs.cpp:636
ship Ships[MAX_SHIPS]
Definition: ship.cpp:122
float get_shield_pct(object *objp)
Definition: object.cpp:308
void startFlashDock(int duration=TBOX_FLASH_DURATION)
color gauge_color
Definition: hud.h:206
float vm_vec_dist_quick(const vec3d *v0, const vec3d *v1)
Definition: vecmat.cpp:417
#define EG_TBOX_INTEG
Definition: emp.h:54
#define strcat_s(...)
Definition: safe_strings.h:68
int model_num_hud
Definition: ship.h:1190
#define NAME_LENGTH
Definition: globals.h:15
GLubyte GLubyte GLubyte GLubyte w
Definition: Glext.h:5679
#define WP_MISSILE
Definition: weapon.h:28
int position[2]
Definition: hud.h:204
int set_target_objnum(ai_info *aip, int objnum)
Definition: aicode.cpp:1250
void bm_page_in_aabitmap(int bitmapnum, int nframes)
Marks a texture as being used for this level, and is anti-aliased.
Definition: bmpman.cpp:2354
bool turret_weapon_has_subtype(ship_weapon *swp, int subtype)
Definition: aiturret.cpp:411
#define SUBSYSTEM_SENSORS
Definition: model.h:59
object * Enemy_attacker
#define fl2i(fl)
Definition: floating.h:33
player * Player
int gr_force_fit_string(char *str, int max_str, int max_width)
Definition: font.cpp:48
float Hud_speed_multiplier
Definition: hudparse.cpp:41
void hud_targetbox_start_flash(int index, int duration)
#define g3_end_frame()
Definition: 3d.h:49
#define HUD_OBJECT_EXTRA_TARGET_DATA
Definition: hudparse.h:139
#define ASTEROID_TYPE_LARGE
Definition: asteroid.h:31
int clip_width
Definition: 2d.h:378
char * modifiers[]
screen gr_screen
Definition: 2d.cpp:46
float Min_draw_distance
Definition: 2d.cpp:84
void gr_get_string_size(int *w, int *h, const char *text, int len=9999)
Definition: font.cpp:196
#define WIF_BEAM
Definition: weapon.h:76
int snd_play_looping(game_snd *gs, float pan, int start_loop, int stop_loop, float vol_scale, int scriptingUpdateVolume)
Definition: sound.cpp:822
void player_maybe_start_cargo_scan_sound()
void initDockOffsets(int x, int y)
#define SF2_GLOWMAPS_DISABLED
Definition: ship.h:494
void initNameOffsets(int x, int y)
char subobj_name[MAX_NAME_LEN]
Definition: model.h:172
float vm_vec_copy_normalize(vec3d *dest, const vec3d *src)
Definition: vecmat.cpp:427
int gr_get_font_height()
Definition: font.cpp:187
int ship_info_index
Definition: ship.h:539
int center_offset_x
Definition: 2d.h:364
#define MR_IS_MISSILE
Definition: model.h:872
SCP_vector< ship_info > Ship_info
Definition: ship.cpp:164
#define LOCATION
Definition: pstypes.h:245
#define VM_PADLOCK_ANY
Definition: systemvars.h:46
void gr_reset_screen_scale()
Definition: 2d.cpp:176
#define WIF_HOMING
Definition: weapon.h:129
#define timestamp_elapsed(stamp)
Definition: timer.h:102
SCP_vector< species_info > Species_info
float Hud_unit_multiplier
Definition: hudparse.cpp:40
int Target_static_looping
#define MR_DESATURATED
Definition: model.h:861
int Targetbox_flash_timers[NUM_TBOX_FLASH_TIMERS]
int Game_skill_level
Definition: fredstubs.cpp:170
void initSpeedOffsets(int x, int y)
float HUD_offset_x
Definition: hud.cpp:90
#define TBOX_FLASH_INTERVAL
Definition: hudtargetbox.h:22
int maybeFlashDock(int flash_fast=0)
void renderPrintf(int x, int y, const char *format,...)
Definition: hud.cpp:724
float vm_vec_dot(const vec3d *v0, const vec3d *v1)
Definition: vecmat.cpp:312
char * Submode_text[]
Definition: aicode.cpp:133
float Pl_target_integrity
Definition: hud.cpp:97
void hud_stuff_ship_class(char *ship_class_text, ship *shipp)
Definition: hudtarget.cpp:5325
int model_num
Definition: weapon.h:329
#define SIF_NOT_FLYABLE
Definition: ship.h:946
#define i2fl(i)
Definition: floating.h:32
void initViewportSize(int w, int h)
void renderTargetIntegrity(int disabled, int force_obj_num=-1)
#define GR_STENCIL_READ
Definition: 2d.h:678
char * ship_return_orders(char *outbuf, ship *sp)
Definition: ship.cpp:15201
int player_inspect_cargo(float frametime, char *outstr)
#define HUD_TARGET_MONITOR_EXTRA_DATA
Definition: hudgauges.h:28
#define timestamp_rand(a, b)
Definition: timer.h:92
#define PM_FLAG_AUTOCEN
Definition: model.h:621
object * Player_obj
Definition: object.cpp:56
void set_animated_effect(int effect_num, float timer)
uint flags2
Definition: ship.h:645
int Hud_target_h
Definition: hudtarget.cpp:52
int temp
Definition: lua.cpp:4996
int team_change_time
Definition: ship.h:815
#define WIF2_BALLISTIC
Definition: weapon.h:84
polymodel * pm
Definition: lua.cpp:1598
#define TBOX_FLASH_NAME
Definition: hudtargetbox.h:26
float closeup_zoom
Definition: ship.h:1328
float HUD_offset_y
Definition: hud.cpp:91
int current_target_dist_trend
Definition: ai.h:491
int scan_time
Definition: ship.h:1351
#define EG_TBOX_CLASS
Definition: emp.h:48
false
Definition: lua.cpp:6789
void initClassOffsets(int x, int y)
float radius
Definition: object.h:154
void snd_stop(int sig)
Definition: sound.cpp:875
void hud_stuff_ship_callsign(char *ship_callsign_text, ship *shipp)
Definition: hudtarget.cpp:5290
void _cdecl gr_printf_no_resize(int x, int y, const char *format,...)
Definition: font.cpp:342
mission The_mission
int Lcl_fr
Definition: localize.cpp:47
#define TBOX_FLASH_STATUS
Definition: hudtargetbox.h:29
void hud_targetbox_init_flash()
void hud_targetbox_switch_wireframe_mode()
#define EG_TBOX_CARGO
Definition: emp.h:51
void set_object_number(int num)
char type
Definition: object.h:146
void renderTargetWeapon(object *target_objp)
#define MR_NO_GLOWMAPS
Definition: model.h:886
#define FALSE
Definition: pstypes.h:400
char filename[FILESPEC_LENGTH]
Definition: model.h:734
#define wp(p)
Definition: modelsinc.h:69
#define TS_CRT
#define AIS_STRAFE_ATTACK
Definition: ai.h:288
SCP_vector< asteroid_info > Asteroid_info
Definition: asteroid.cpp:62
void initBitmaps(char *fname)
void hud_cargo_scan_update(object *targetp, float frametime)
#define HUD_C_DIM
Definition: hud.h:163
bool ship_subsys_takes_damage(ship_subsys *ss)
Definition: ship.cpp:17545
#define MR_NO_FOGGING
Definition: model.h:884
void hud_set_iff_color(object *objp, int is_bright)
Will set the color to the IFF color based on the team.
Definition: hud.cpp:2950
int shield_recharge_index
Definition: ship.h:637
#define stricmp(s1, s2)
Definition: config.h:271
#define OBJ_JUMP_NODE
Definition: object.h:45
int hud_targetbox_subsystem_in_view(object *target_objp, int *sx, int *sy)
bool Lock_targetbox_mode
int parent_sig
Definition: object.h:148
char ship_name[NAME_LENGTH]
Definition: ship.h:604
void maybeRenderCargoScan(ship_info *target_sip)
void initOrderMaxWidth(int width)
void initCargoScanSize(int w, int h)
#define TS_DIS
void model_set_detail_level(int n)
int Lcl_gr
Definition: localize.cpp:48
#define EG_TBOX_EXTRA2
Definition: emp.h:46
void hud_save_restore_camera_data(int save)
Called to save and restore the 3D camera settings.
Definition: hud.cpp:3656
#define AIM_STRAFE
Definition: ai.h:181
GLint y
Definition: Gl.h:1505
#define gr_stencil_clear
Definition: 2d.h:821
#define g3_start_frame(zbuffer_flag)
Definition: 3d.h:39
float vm_vec_normalize(vec3d *v)
Definition: vecmat.cpp:460
#define strcpy_s(...)
Definition: safe_strings.h:67
int Targetbox_wire
void renderBitmap(int x, int y)
Definition: hud.cpp:782
#define TS_DMG
#define MR_AUTOCENTER
Definition: model.h:875