FS2_Open
Open source remastering of the Freespace 2 engine
hud.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 #include "ai/aigoals.h"
12 #include "asteroid/asteroid.h"
13 #include "bmpman/bmpman.h"
14 #include "cmdline/cmdline.h"
15 #include "freespace2/freespace.h"
16 #include "gamesnd/eventmusic.h"
17 #include "gamesnd/gamesnd.h"
18 #include "globalincs/alphacolors.h"
19 #include "globalincs/linklist.h"
20 #include "hud/hud.h"
21 #include "hud/hudconfig.h"
22 #include "hud/hudescort.h"
23 #include "hud/hudets.h"
24 #include "hud/hudlock.h"
25 #include "hud/hudmessage.h"
26 #include "hud/hudnavigation.h" //kazan
27 #include "hud/hudobserver.h"
28 #include "hud/hudreticle.h"
29 #include "hud/hudshield.h"
30 #include "hud/hudsquadmsg.h"
31 #include "hud/hudtarget.h"
32 #include "hud/hudtargetbox.h"
33 #include "hud/hudwingmanstatus.h"
34 #include "iff_defs/iff_defs.h"
35 #include "io/timer.h"
36 #include "localization/localize.h"
37 #include "mission/missiongoals.h"
38 #include "mission/missionmessage.h"
39 #include "mission/missionparse.h"
41 #include "missionui/redalert.h"
42 #include "model/model.h"
43 #include "network/multi_pmsg.h"
44 #include "network/multi_voice.h"
45 #include "network/multiutil.h"
46 #include "object/object.h"
47 #include "object/objectdock.h"
48 #include "playerman/player.h"
49 #include "radar/radar.h"
50 #include "radar/radarsetup.h"
51 #include "render/3d.h"
52 #include "ship/ship.h"
53 #include "starfield/supernova.h"
54 #include "weapon/emp.h"
55 #include "weapon/weapon.h"
56 
58 
59 // new values for HUD alpha
60 #define HUD_NEW_ALPHA_DIM 80
61 #define HUD_NEW_ALPHA_NORMAL 120
62 #define HUD_NEW_ALPHA_BRIGHT 220
63 
64 // high contrast
65 #define HUD_NEW_ALPHA_DIM_HI 130
66 #define HUD_NEW_ALPHA_NORMAL_HI 190
67 #define HUD_NEW_ALPHA_BRIGHT_HI 255
68 
69 // Externals not related to the HUD code itself
70 extern float View_zoom;
71 
72 // globals that will control the color of the HUD gauges
73 int HUD_color_red = 0;
74 int HUD_color_green = 255;
76 int HUD_color_alpha = HUD_COLOR_ALPHA_DEFAULT; // 1 -> HUD_COLOR_ALPHA_USER_MAX
77 
78 int HUD_draw = 1;
79 int HUD_contrast = 0; // high or lo contrast (for nebula, etc)
80 
81 // Goober5000
83 
84 color HUD_color_defaults[HUD_NUM_COLOR_LEVELS]; // array of colors with different alpha blending
85 color HUD_color_debug; // grey debug text shown on HUD
86 
87 static int Player_engine_snd_loop = -1;
88 
89 // HUD render frame offsets
90 float HUD_offset_x = 0.0f;
91 float HUD_offset_y = 0.0f;
92 
93 // the offset of the player's view vector and the ship forward vector in pixels (Swifty)
96 // Global: integrity of player's target
98 
100 
101 static int Hud_last_can_target; // whether Player is able to target in the last frame
102 static int Hud_can_target_timer; // timestamp to allow target gauge to draw static once targeting functions are not allowed
103 
104 // centered text message gauges (collision, emp, etc)
105 char Hud_text_flash[512] = "";
108 
110 void hud_start_text_flash(char *txt, int t, int interval);
111 
112 // multiplayer messaging text
114  { // GR_640
115  5, 150
116  },
117  { // GR_1024
118  8, 240
119  }
120 };
121 
122 // multiplayer voice stuff
124  { // GR_640
125  5, 165
126  },
127  { // GR_1024
128  8, 255
129  }
130 };
131 
132 // ping text coords
134  { // GR_640
135  560, 3
136  },
137  { // GR_1024
138  896, 5
139  }
140 };
141 
142 // supernova coords
144  { // GR_640
145  100, 100
146  },
147  { // GR_1024
148  170, 170
149  }
150 };
151 
152 // used to draw the hud support view
153 static int Hud_support_view_active;
154 static int Hud_support_view_abort; // active when we need to display abort message
155 static int Hud_support_view_fade; // timer
156 static int Hud_support_obj_sig, Hud_support_objnum, Hud_support_target_sig;
157 
158 // flashing gauges
159 #define HUD_GAUGE_FLASH_DURATION 5000
160 #define HUD_GAUGE_FLASH_INTERVAL 200
164 
165 static objective_display_info Objective_display;
166 
167 // Subspace notify display
168 static int Subspace_notify_active;
169 static int Objective_notify_active;
170 static int HUD_abort_subspace_timer = 1;
171 
172 static hud_subsys_info Pl_hud_subsys_info[SUBSYSTEM_MAX];
173 static int Pl_hud_next_flash_timestamp;
174 static int Pl_hud_is_bright;
175 
176 #define SUBSYS_DAMAGE_FLASH_DURATION 1800
177 #define SUBSYS_DAMAGE_FLASH_INTERVAL 100
178 
180 
181 // forward declarations
182 void update_throttle_sound();
183 void hud_damage_popup_init();
184 void hud_support_view_init();
185 void hud_gauge_flash_init();
196 void hud_init_emp_icon();
197 
198 // Saturate a value in minv..maxv.
199 void saturate(int *i, int minv, int maxv)
200 {
201  if (*i < minv)
202  *i = minv;
203  else if (*i > maxv)
204  *i = maxv;
205 }
206 
207 // init the colors used for the different shades of the HUD
209 {
210  int i;
211 
212  for ( i = 0; i < HUD_NUM_COLOR_LEVELS; i++ ) {
213  gr_init_alphacolor( &HUD_color_defaults[i], HUD_color_red, HUD_color_green, HUD_color_blue, (i+1)*16 );
214  }
215 }
216 
217 // HUD_init will call all the various HUD gauge init functions. This function is called at the
218 // start of each mission (level)
220 {
221  saturate(&HUD_color_red, 0, 255);
222  saturate(&HUD_color_green, 0, 255);
223  saturate(&HUD_color_blue, 0, 255);
225 
226  gr_init_alphacolor( &HUD_color_debug, 128, 255, 128, HUD_color_alpha*16 );
228 
231 }
232 
233 // The following global data is used to determine if we should change the engine sound.
234 // We only check if the throttle has changed every THROTTLE_SOUND_CHECK_INTERVAL ms, and
235 // then we make sure that the throttle has actually changed. If it has changed, we start
236 // a new sound and/or adjust the volume. This occurs in update_throttle_sound()
237 //
238 static float last_percent_throttle;
239 #define THROTTLE_SOUND_CHECK_INTERVAL 50 // in ms
240 static int throttle_sound_check_id;
241 
242 #define DAMAGE_FLASH_TIME 150
243 static int Damage_flash_bright;
244 static int Damage_flash_timer;
245 
247 base_w(0), base_h(0), gauge_config(-1), font_num(FONT1), lock_color(false), sexp_lock_color(false), reticle_follow(false),
248 active(false), off_by_default(false), sexp_override(false), pop_up(false), disabled_views(0), custom_gauge(false),
249 texture_target(-1), canvas_w(-1), canvas_h(-1), target_w(-1), target_h(-1)
250 {
251  position[0] = 0;
252  position[1] = 0;
253 
254  gr_init_alphacolor(&gauge_color, 255, 255, 255, (HUD_color_alpha+1)*16);
256  flash_next = timestamp(1);
257  flash_status = false;
258 
259  popup_timer = timestamp(1);
260 
261  texture_target_fname[0] = '\0';
262 
263  custom_name[0] = '\0';
264  custom_text = "";
268 }
269 
270 HudGauge::HudGauge(int _gauge_object, int _gauge_config, bool _slew, bool _message, int _disabled_views, int r, int g, int b):
271 base_w(0), base_h(0), gauge_config(_gauge_config), gauge_object(_gauge_object), font_num(FONT1), lock_color(false), sexp_lock_color(false),
272 reticle_follow(_slew), active(false), off_by_default(false), sexp_override(false), pop_up(false), message_gauge(_message),
273 disabled_views(_disabled_views), custom_gauge(false), textoffset_x(0), textoffset_y(0), texture_target(-1),
274 canvas_w(-1), canvas_h(-1), target_w(-1), target_h(-1)
275 {
276  Assert(gauge_config <= NUM_HUD_GAUGES && gauge_config >= 0);
277 
278  position[0] = 0;
279  position[1] = 0;
280 
281  if(r >= 0 && r <= 255 &&
282  g >= 0 && g <= 255 &&
283  b >= 0 && b <= 255) {
285  } else {
286  gr_init_alphacolor(&gauge_color, 255, 255, 255, (HUD_color_alpha+1)*16);
287  }
288 
290  flash_next = timestamp(1);
291  flash_status = false;
292 
293  popup_timer = timestamp(1);
294 
295  texture_target_fname[0] = '\0';
296 
297  custom_name[0] = '\0';
298  custom_text = "";
299  default_text = "";
303 }
304 
305 // constructor for custom gauges
306 HudGauge::HudGauge(int _gauge_config, bool _slew, int r, int g, int b, char* _custom_name, char* _custom_text, char* frame_fname, int txtoffset_x, int txtoffset_y):
307 base_w(0), base_h(0), gauge_config(_gauge_config), gauge_object(HUD_OBJECT_CUSTOM), font_num(FONT1), lock_color(false), sexp_lock_color(false),
308 reticle_follow(_slew), active(false), off_by_default(false), sexp_override(false), pop_up(false), message_gauge(false),
309 disabled_views(VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY), custom_gauge(true), textoffset_x(txtoffset_x),
310  textoffset_y(txtoffset_y), texture_target(-1), canvas_w(-1), canvas_h(-1), target_w(-1), target_h(-1)
311 {
312  position[0] = 0;
313  position[1] = 0;
314 
315  if(r >= 0 && r <= 255 && g >= 0 && g <= 255 && b >= 0 && b <= 255) {
317  } else {
318  gr_init_alphacolor(&gauge_color, 255, 255, 255, (HUD_color_alpha+1)*16);
319  }
320 
322  flash_next = timestamp(1);
323  flash_status = false;
324 
325  popup_timer = timestamp(1);
326 
327  texture_target_fname[0] = '\0';
328 
329  if(_custom_name) {
330  strcpy_s(custom_name, _custom_name);
331  } else {
332  custom_name[0] = '\0';
333  }
334 
335  if(_custom_text) {
336  custom_text = _custom_text;
337  default_text = _custom_text;
338  } else {
339  custom_text = "";
340  default_text = "";
341  }
342 
346 
347  if(frame_fname) {
349  if (custom_frame.first_frame < 0 ) {
350  Warning(LOCATION,"Cannot load hud ani: %s\n", frame_fname);
351  }
352  }
353 }
354 
356 
357 void HudGauge::initPosition(int x, int y)
358 {
359  position[0] = x;
360  position[1] = y;
361 }
362 
363 void HudGauge::getPosition(int *x, int *y)
364 {
365  *x = position[0];
366  *y = position[1];
367 }
368 
370 {
371  Assert(w >= 640 && h >= 480);
372 
373  base_w = w;
374  base_h = h;
375 }
376 
377 void HudGauge::initSlew(bool slew)
378 {
379  reticle_follow = slew;
380 }
381 
382 void HudGauge::initFont(int input_font_num)
383 {
384  if ( input_font_num >= 0 && input_font_num < Num_fonts) {
385  font_num = input_font_num;
386  }
387 }
388 
390 {
391  return custom_name;
392 }
393 
395 {
396  return custom_text.c_str();
397 }
398 
400 {
401  if(!custom_gauge) {
402  return;
403  }
404 
405  position[0] = _x;
406  position[1] = _y;
407 }
408 
409 void HudGauge::updateCustomGaugeFrame(int frame_offset)
410 {
411  if(!custom_gauge) {
412  return;
413  }
414 
415  if (frame_offset < 0 ||frame_offset > custom_frame.num_frames) {
416  return;
417  }
418 
419  custom_frame_offset = frame_offset;
420 }
421 
422 void HudGauge::updateCustomGaugeText(const char* txt)
423 {
424  if(!custom_gauge) {
425  return;
426  }
427 
428  custom_text = txt;
429 }
430 
432 {
433  if(!custom_gauge) {
434  return;
435  }
436 
437  custom_text = txt;
438 }
439 
441 {
443 }
444 
445 void HudGauge::setGaugeColor(int bright_index)
446 {
447  int alpha;
448 
449  // if we're drawing it as bright
450  if(bright_index != HUD_C_NONE){
451  switch(bright_index){
452  case HUD_C_DIM:
455  break;
456 
457  case HUD_C_NORMAL:
460  break;
461 
462  case HUD_C_BRIGHT:
465  break;
466 
467  // intensity
468  default:
469  Assert((bright_index >= 0) && (bright_index < HUD_NUM_COLOR_LEVELS));
470  if(bright_index < 0){
471  bright_index = 0;
472  }
473  if(bright_index >= HUD_NUM_COLOR_LEVELS){
474  bright_index = HUD_NUM_COLOR_LEVELS - 1;
475  }
476 
477  // alpha = 255 - (255 / (bright_index + 1));
478  // alpha = (int)((float)alpha * 1.5f);
479  int level = 255 / (HUD_NUM_COLOR_LEVELS);
480  alpha = level * bright_index;
481  if(alpha > 255){
482  alpha = 255;
483  }
484  if(alpha < 0){
485  alpha = 0;
486  }
488  break;
489  }
490  } else {
491  switch(maybeFlashSexp()) {
492  case 0:
495  break;
496  case 1:
499  break;
500  default:
503  }
504  }
505 
507 }
508 
510 {
511  //return gauge_type;
512  return gauge_config;
513 }
514 
516 {
517  return gauge_object;
518 }
519 
521 {
522  lock_color = lock;
523 }
524 
526 {
527  sexp_lock_color = lock;
528 }
529 
530 void HudGauge::updateColor(int r, int g, int b, int a)
531 {
533  return;
534 
535  gr_init_alphacolor(&gauge_color, r, g, b, a);
536 }
537 
538 void HudGauge::updateActive(bool show)
539 {
540  active = show;
541 }
542 
543 void HudGauge::initRenderStatus(bool do_render)
544 {
545  off_by_default = !do_render;
546 }
547 
549 {
550  return off_by_default;
551 }
552 
554 {
555  return active && !sexp_override;
556 }
557 
559 {
561 }
562 
563 void HudGauge::updatePopUp(bool pop_up_flag)
564 {
565  pop_up = pop_up_flag;
566 }
567 
568 void HudGauge::startPopUp(int time)
569 {
570  //Assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES);
571  if ( !pop_up ) {
572  return;
573  }
574 
575  popup_timer = timestamp(time);
576 }
577 
579 {
580  //Assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES);
581  if ( !pop_up ) {
582  return 0;
583  }
584 
585  if ( !timestamp_elapsed(popup_timer) ) {
586  return 1;
587  } else {
588  return 0;
589  }
590 }
591 
593 {
595  flash_next = timestamp(1);
596  flash_status = false;
597 
598  popup_timer = timestamp(1);
599 }
600 
602 {
604  flash_next = timestamp(1);
605  flash_status = false;
606 }
607 
609 {
611  return true;
612  }
613 
614  return false;
615 }
616 
618 {
620  if ( timestamp_elapsed(flash_next) ) {
622 
623  // toggle between default and bright frames
625  }
626  return (int)flash_status;
627  }
628 
629  return -1;
630 }
631 
633 {
634 
635 }
636 
637 void HudGauge::onFrame(float frametime)
638 {
639 
640 }
641 
642 void HudGauge::render(float frametime)
643 {
644  if(!custom_gauge) {
645  return;
646  }
647 
648  setGaugeColor();
649 
650  if( !custom_text.empty() ) {
651  char *text = new char[custom_text.size()+1];
652  strcpy(text, custom_text.c_str());
653 
656 
657  delete[] text;
658  }
659 
660  if(custom_frame.first_frame > -1) {
662  }
663 }
664 
665 void HudGauge::renderString(int x, int y, const char *str)
666 {
667  int nx = 0, ny = 0;
668 
669  if ( gr_screen.rendering_to_texture != -1 ) {
671  } else {
672  if ( reticle_follow ) {
673  nx = HUD_nose_x;
674  ny = HUD_nose_y;
675 
676  gr_resize_screen_pos(&nx, &ny);
678  gr_unsize_screen_pos(&nx, &ny);
679  } else {
681  }
682  }
683 
684  gr_string(x + nx, y + ny, str);
686 }
687 
688 void HudGauge::renderString(int x, int y, int gauge_id, const char *str)
689 {
690  int nx = 0, ny = 0;
691 
692  if ( gr_screen.rendering_to_texture != -1 ) {
694  } else {
695  if ( reticle_follow ) {
696  nx = HUD_nose_x;
697  ny = HUD_nose_y;
698 
699  gr_resize_screen_pos(&nx, &ny);
701  gr_unsize_screen_pos(&nx, &ny);
702  } else {
704  }
705  }
706 
707  if ( gauge_id > -2 ) {
708  emp_hud_string(x + nx, y + ny, gauge_id, str, GR_RESIZE_FULL);
709  } else {
710  gr_string(x + nx, y + ny, str);
711  }
712 
714 }
715 
716 void HudGauge::renderStringAlignCenter(int x, int y, int area_width, const char *s)
717 {
718  int w, h;
719 
720  gr_get_string_size(&w, &h, s);
721  renderString(x + ((area_width - w) / 2), y, s);
722 }
723 
724 void HudGauge::renderPrintf(int x, int y, const char* format, ...)
725 {
726  char tmp[256] = "";
727  va_list args;
728 
729  // format the text
730  va_start(args, format);
731  vsnprintf(tmp, sizeof(tmp)-1, format, args);
732  va_end(args);
733  tmp[sizeof(tmp)-1] = '\0';
734 
735  renderString(x, y, tmp);
736 }
737 
738 void HudGauge::renderPrintf(int x, int y, int gauge_id, const char* format, ...)
739 {
740  char tmp[256] = "";
741  va_list args;
742 
743  // format the text
744  va_start(args, format);
745  vsnprintf(tmp, sizeof(tmp)-1, format, args);
746  va_end(args);
747  tmp[sizeof(tmp)-1] = '\0';
748 
749  renderString(x, y, gauge_id, tmp);
750 }
751 
752 void HudGauge::renderBitmapColor(int frame, int x, int y)
753 {
754  int nx = 0, ny = 0;
755 
756  if( !emp_should_blit_gauge() ) {
757  return;
758  }
759 
760  emp_hud_jitter(&x, &y);
761 
762  if ( gr_screen.rendering_to_texture != -1 ) {
764  } else {
765  if ( reticle_follow ) {
766  nx = HUD_nose_x;
767  ny = HUD_nose_y;
768 
769  gr_resize_screen_pos(&nx, &ny);
771  gr_unsize_screen_pos(&nx, &ny);
772  } else {
774  }
775  }
776 
777  gr_set_bitmap(frame);
778  gr_bitmap(x + nx, y + ny);
780 }
781 
782 void HudGauge::renderBitmap(int x, int y)
783 {
784  int nx = 0, ny = 0;
785 
786  if( !emp_should_blit_gauge() ) {
787  return;
788  }
789 
790  emp_hud_jitter(&x, &y);
791 
792  if ( gr_screen.rendering_to_texture != -1 ) {
794  } else {
795  if ( reticle_follow ) {
796  nx = HUD_nose_x;
797  ny = HUD_nose_y;
798 
799  gr_resize_screen_pos(&nx, &ny);
801  gr_unsize_screen_pos(&nx, &ny);
802  } else {
804  }
805  }
806 
807  gr_aabitmap(x + nx, y + ny);
808 
810 }
811 
812 void HudGauge::renderBitmap(int frame, int x, int y)
813 {
814  gr_set_bitmap(frame);
815  renderBitmap(x, y);
816 }
817 
818 void HudGauge::renderBitmapEx(int frame, int x, int y, int w, int h, int sx, int sy)
819 {
820  int nx = 0, ny = 0;
821 
822  if( !emp_should_blit_gauge() ) {
823  return;
824  }
825 
826  emp_hud_jitter(&x, &y);
827 
828  gr_set_bitmap(frame);
829 
830  if( gr_screen.rendering_to_texture != -1 ) {
832  } else {
833  if ( reticle_follow ) {
834  nx = HUD_nose_x;
835  ny = HUD_nose_y;
836 
837  gr_resize_screen_pos(&nx, &ny);
839  gr_unsize_screen_pos(&nx, &ny);
840  } else {
842  }
843  }
844 
845  gr_aabitmap_ex(x + nx, y + ny, w, h, sx, sy);
846 
848 }
849 
850 void HudGauge::renderLine(int x1, int y1, int x2, int y2)
851 {
852  int nx = 0, ny = 0;
853 
854  if ( gr_screen.rendering_to_texture != -1 ) {
856  } else {
857  if ( reticle_follow ) {
858  nx = HUD_nose_x;
859  ny = HUD_nose_y;
860 
861  gr_resize_screen_pos(&nx, &ny);
863  gr_unsize_screen_pos(&nx, &ny);
864  } else {
866  }
867  }
868 
869  gr_line(x1+nx, y1+ny, x2+nx, y2+ny);
871 }
872 
873 void HudGauge::renderGradientLine(int x1, int y1, int x2, int y2)
874 {
875  int nx = 0, ny = 0;
876 
877  if ( gr_screen.rendering_to_texture != -1 ) {
879  } else {
880  if(reticle_follow) {
881  nx = HUD_nose_x;
882  ny = HUD_nose_y;
883 
884  gr_resize_screen_pos(&nx, &ny);
886  gr_unsize_screen_pos(&nx, &ny);
887  } else {
889  }
890  }
891 
892  gr_gradient(x1+nx, y1+ny, x2+nx, y2+ny);
894 }
895 
896 void HudGauge::renderRect(int x, int y, int w, int h)
897 {
898  int nx = 0, ny = 0;
899 
900  if ( gr_screen.rendering_to_texture != -1 ) {
902  } else {
903  if ( reticle_follow ) {
904  nx = HUD_nose_x;
905  ny = HUD_nose_y;
906 
907  gr_resize_screen_pos(&nx, &ny);
909  gr_unsize_screen_pos(&nx, &ny);
910  } else {
912  }
913  }
914 
915  gr_rect(x+nx, y+ny, w, h);
917 }
918 
919 void HudGauge::renderCircle(int x, int y, int diameter)
920 {
921  int nx = 0, ny = 0;
922 
923  if ( gr_screen.rendering_to_texture != -1 ) {
925  } else {
926  if ( reticle_follow ) {
927  nx = HUD_nose_x;
928  ny = HUD_nose_y;
929 
930  gr_resize_screen_pos(&nx, &ny);
932  gr_unsize_screen_pos(&nx, &ny);
933  } else {
935  }
936  }
937 
938  gr_circle(x+nx, y+ny, diameter);
940 }
941 
942 void HudGauge::setClip(int x, int y, int w, int h)
943 {
944  int hx = fl2i(HUD_offset_x);
945  int hy = fl2i(HUD_offset_y);
946 
947  if ( gr_screen.rendering_to_texture != -1 ) {
949 
950  hx = display_offset_x;
951  hy = display_offset_y;
952 
953  gr_resize_screen_pos(&x, &y);
954 
955  hx += x;
956  hy += y;
957 
958  gr_unsize_screen_pos(&hx, &hy);
959 
960  gr_set_clip(hx, hy, w, h);
961  } else {
962  if ( reticle_follow ) {
963  hx += HUD_nose_x;
964  hy += HUD_nose_y;
965  }
966 
967  gr_resize_screen_pos(&hx, &hy);
968 
970  gr_resize_screen_pos(&x, &y, &w, &h);
971 
972  gr_set_clip(hx+x, hy+y, w, h, GR_RESIZE_NONE);
973  }
974 
976 }
977 
979 {
980  int hx = 0, hy = 0;
981  int w, h;
982 
983  if ( gr_screen.rendering_to_texture != -1 ) {
985 
986  hx = display_offset_x;
987  hy = display_offset_y;
988 
989  gr_unsize_screen_pos(&hx, &hy);
990 
991  w = canvas_w;
992  h = canvas_h;
993 
994  gr_set_clip(hx, hy, w, h);
995  } else {
996  hx = fl2i(HUD_offset_x);
997  hy = fl2i(HUD_offset_y);
998 
999  gr_resize_screen_pos(&hx, &hy);
1001 
1002  w = gr_screen.max_w;
1003  h = gr_screen.max_h;
1004 
1005  // clip the screen based on the actual resolution
1006  gr_set_clip(hx, hy, w, h, GR_RESIZE_NONE);
1007  }
1008 
1010 }
1011 
1012 void HudGauge::unsize(int *x, int *y)
1013 {
1015  gr_unsize_screen_pos(x, y);
1017 }
1018 
1019 void HudGauge::unsize(float *x, float *y)
1020 {
1022  gr_unsize_screen_posf(x, y);
1024 }
1025 
1026 void HudGauge::resize(int *x, int *y)
1027 {
1029  gr_resize_screen_pos(x, y);
1031 }
1032 
1033 void HudGauge::resize(float *x, float *y)
1034 {
1036  gr_resize_screen_posf(x, y);
1038 }
1039 
1041 {
1042  if(custom_gauge) {
1045  }
1046  }
1047 }
1048 
1050 {
1051  //Reset text to default
1053 
1054  custom_frame_offset = 0;
1055 
1056  sexp_lock_color = false;
1057 }
1058 
1060 {
1061  if (sexp_override) {
1062  return false;
1063  }
1064 
1066  return false;
1067  }
1068 
1070  return false;
1071  }
1072 
1073  if(!active)
1074  return false;
1075 
1076  if ( !(Game_detail_flags & DETAIL_FLAG_HUD) ) {
1077  return false;
1078  }
1079 
1080  if ((Viewer_mode & disabled_views)) {
1081  return false;
1082  }
1083 
1084  if(pop_up) {
1085  if(!popUpActive()) {
1086  return false;
1087  }
1088  }
1089 
1090  if (gauge_config == HUD_ETS_GAUGE) {
1092  return false;
1093  }
1094  }
1095 
1096  return true;
1097 }
1098 
1099 void HudGauge::initCockpitTarget(const char* display_name, int _target_x, int _target_y, int _target_w, int _target_h, int _canvas_w, int _canvas_h)
1100 {
1101  if ( strlen(display_name) <= 0 ) {
1102  return;
1103  }
1104 
1105  target_x = _target_x;
1106  target_y = _target_y;
1107 
1108  strcpy_s(texture_target_fname, display_name);
1109  target_w = _target_w;
1110  target_h = _target_h;
1111 
1112  if ( _canvas_w > 0 && _canvas_h > 0 ) {
1113  canvas_w = _canvas_w;
1114  canvas_h = _canvas_h;
1115  } else {
1116  canvas_w = _target_w;
1117  canvas_h = _target_h;
1118  }
1119 }
1120 
1121 bool HudGauge::setupRenderCanvas(int render_target)
1122 {
1123  if (texture_target_fname[0] != '\0') {
1124  if ( render_target >= 0 && render_target == texture_target ) {
1125  return true;
1126  }
1127  } else {
1128  if ( render_target < 0 ) {
1129  return true;
1130  }
1131  }
1132 
1133  return false;
1134 }
1135 
1137 {
1138  if ( display == NULL ) {
1139  return;
1140  }
1141 
1142  if ( strcmp(texture_target_fname, display->name) ) {
1143  return;
1144  }
1145 
1146  if ( display->target < 0 ) {
1147  return;
1148  }
1149 
1150  texture_target = display->target;
1151  display_offset_x = display->offset[0] + target_x;
1152  display_offset_y = display->offset[1] + target_y;
1153 }
1154 
1156 {
1157  texture_target = -1;
1158 }
1159 
1160 // ----------------------------------------------------------------------
1164 void HUD_init()
1165 {
1166  HUD_init_colors();
1169  hud_init_reticle();
1172  hud_escort_init();
1175  hud_init_squadmsg(); // initialize the vars needed for squadmate messaging
1183 
1184  throttle_sound_check_id = timestamp(THROTTLE_SOUND_CHECK_INTERVAL);
1185  HUD_abort_subspace_timer = 1;
1186  Hud_last_can_target = 1;
1187  Hud_can_target_timer = 1;
1188  last_percent_throttle = 0.0f;
1189 
1190  // default to high contrast in the nebula
1191  HUD_contrast = 0;
1192  HUD_draw = 1;
1194 
1196  HUD_contrast = 1;
1197  }
1198 
1199  // reset to infinite
1201 
1202  size_t j, num_gauges;
1203 
1204  // go through all HUD gauges and call their initialization functions
1205  for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it) {
1206  if(it->hud_enabled) {
1207  num_gauges = it->hud_gauges.size();
1208 
1209  for(j = 0; j < num_gauges; j++) {
1210  it->hud_gauges[j]->initialize();
1211  it->hud_gauges[j]->resetTimers();
1212  it->hud_gauges[j]->updateSexpOverride(false);
1213  }
1214  }
1215  }
1216 
1217  num_gauges = default_hud_gauges.size();
1218 
1219  for(j = 0; j < num_gauges; j++) {
1220  default_hud_gauges[j]->initialize();
1221  default_hud_gauges[j]->resetTimers();
1222  default_hud_gauges[j]->updateSexpOverride(false);
1223  }
1224 }
1225 
1230 {
1231  size_t j, num_gauges;
1232 
1233  for ( auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it ) {
1234  if(it->hud_enabled) {
1235  num_gauges = it->hud_gauges.size();
1236 
1237  for(j = 0; j < num_gauges; j++) {
1238  it->hud_gauges[j]->resetCockpitTarget();
1239  }
1240  }
1241  }
1242 }
1243 
1248 {
1249  size_t j, num_gauges = 0;
1250 
1251  for (auto it = Ship_info.begin(); it != Ship_info.end(); ++it) {
1252  num_gauges = it->hud_gauges.size();
1253 
1254  for(j = 0; j < num_gauges; j++) {
1255  vm_free(it->hud_gauges[j]);
1256  it->hud_gauges[j] = NULL;
1257  }
1258  it->hud_gauges.clear();
1259  }
1260 
1261  num_gauges = default_hud_gauges.size();
1262 
1263  for(j = 0; j < num_gauges; j++) {
1264  delete default_hud_gauges[j];
1265  default_hud_gauges[j] = NULL;
1266  }
1267  default_hud_gauges.clear();
1268 }
1269 
1271 {
1272  HUD_draw = !HUD_draw;
1273 }
1274 
1275 // Goober5000
1276 void hud_set_draw(int draw)
1277 {
1278  HUD_draw = draw;
1279 }
1280 
1281 //WMC
1283 {
1284  return HUD_draw;
1285 }
1286 
1287 // Goober5000
1289 {
1290  HUD_disable_except_messages = disable;
1291 }
1292 
1293 // Goober5000
1298 {
1300 }
1301 
1307 {
1308  return !HUD_draw;
1309 }
1310 
1315 {
1317  ship_weapon *swp = &Player_ship->weapons;
1318  int i;
1319 
1320  for ( i = 0; i < swp->num_secondary_banks; i++ ) {
1321  if ( swp->secondary_bank_ammo[i] > 0 ) {
1322  int ms_till_fire = timestamp_until(swp->next_secondary_fire_stamp[i]);
1323  if ( ms_till_fire >= 1000 ) {
1325  }
1326  }
1327  }
1328  }
1329 }
1330 
1336 void hud_update_frame(float frametime)
1337 {
1338  object *targetp;
1339  vec3d target_pos;
1340  int can_target;
1341 
1345 
1346  // Check hotkey selections to see if any ships need to be removed
1348 
1349  // Remove dead/departed ships from the escort list
1352 
1354 
1361 
1362  // if emp is active we have to allow targeting by the "random emp" system
1363  // we will intercept player targeting requests in hud_sensors_ok() when checking key commands
1364  // DB - 8/24/98
1365  can_target = hud_sensors_ok(Player_ship, 0);
1366  if(emp_active_local()){
1367  can_target = 1;
1368  }
1369  if ( !can_target && Hud_last_can_target ) {
1370  Hud_can_target_timer = timestamp(1200);
1371  }
1372  Hud_last_can_target = can_target;
1373 
1374  if ( timestamp_elapsed(Hud_can_target_timer) ) {
1375  if ( (Player_ai->target_objnum != -1) && !can_target ){
1376  Player_ai->target_objnum = -1;
1377  }
1378  }
1379 
1380  // if there is no target, check if auto-targeting is enabled, and select new target
1381  int retarget = 0;
1382  int retarget_turret = 0;
1383 
1384  if (Player_ai->target_objnum == -1){
1385  retarget = 1;
1386  } else if (Objects[Player_ai->target_objnum].type == OBJ_SHIP) {
1389  retarget = 1;
1390  }
1391  }
1392  }
1393 
1394  // check if big ship and currently selected subsys is turret and turret is dead
1395  // only do this is not retargeting
1396  if ((!retarget) && (Player_ai->target_objnum != -1)) {
1401  if (ss != NULL) {
1402  if ((ss->system_info->type == SUBSYSTEM_TURRET) && (ss->current_hits == 0)) {
1403  retarget_turret = 1;
1404  }
1405  }
1406  }
1407  }
1408  }
1409  }
1410 
1411  if ( retarget && can_target ) {
1414  Player_ai->target_objnum = -1;
1416  }
1417  }
1418 
1419  if (retarget_turret && can_target) {
1420  Assert(!retarget);
1423  }
1424 
1426 
1427  // check to see if we are in messaging mode. If so, send the key to the code
1428  // to deal with the message. hud_sqaudmsg_do_frame will return 0 if the key
1429  // wasn't used in messaging mode, otherwise 1. In the event the key was used,
1430  // return immediately out of this function.
1433  }
1434 
1435  if (Player_ai->target_objnum == -1) {
1436  if ( Target_static_looping != -1 ) {
1438  }
1439  return;
1440  }
1441 
1442  targetp = &Objects[Player_ai->target_objnum];
1443 
1444  if ( Player_ai->targeted_subsys != NULL ) {
1445  get_subsystem_world_pos(targetp, Player_ai->targeted_subsys, &target_pos);
1446 
1447  // get new distance of current target
1449 
1450  float shield_strength = Player_ai->targeted_subsys->current_hits/Player_ai->targeted_subsys->max_hits * 100.0f;
1451  int screen_integrity = fl2i(shield_strength+0.5f);
1452 
1453  if ( screen_integrity < 0 ) {
1454  screen_integrity = 0;
1455  }
1456 
1457  if ( screen_integrity == 0 ) {
1458  if ( shield_strength > 0 ) {
1459  screen_integrity = 1;
1460  }
1461  }
1462 
1463  // Goober5000 - don't flash if this subsystem can't be destroyed
1465  {
1466  if ( screen_integrity <= 0 ){
1467  hud_targetbox_start_flash(TBOX_FLASH_SUBSYS); // need to flash 0% continuously
1468  }
1469  }
1470  } else {
1471  target_pos = targetp->pos;
1472 
1474  }
1475 
1476  int stop_targetting_this_thing = 0;
1477 
1478  // check to see if the target is still alive
1479  if ( targetp->flags&OF_SHOULD_BE_DEAD ) {
1480  stop_targetting_this_thing = 1;
1481  }
1482 
1484  ship *target_shipp = NULL;
1485 
1486  if ( targetp->type == OBJ_SHIP ) {
1487  Assert ( targetp->instance >=0 && targetp->instance < MAX_SHIPS );
1488  target_shipp = &Ships[targetp->instance];
1489  Player->target_is_dying = target_shipp->flags & SF_DYING;
1490 
1491  // If it is warping out (or exploded), turn off targeting
1492  if ( target_shipp->flags & (SF_DEPART_WARP|SF_EXPLODED) ) {
1493  stop_targetting_this_thing = 1;
1494  }
1495  }
1496 
1497  // Check if can still be seen in Nebula
1498  if ( hud_target_invalid_awacs(targetp) ) {
1499  stop_targetting_this_thing = 1;
1500  }
1501 
1502  // If this was found to be something we shouldn't
1503  // target anymore, just remove it
1504  if ( stop_targetting_this_thing ) {
1505  Player_ai->target_objnum = -1;
1506  Player_ai->targeted_subsys = NULL;
1508  }
1509 
1510  if (Player->target_is_dying) {
1514  }
1515  }
1516 
1517  // Switch to battle track when a targeted ship is hostile (it attacks you) and within BATTLE_START_MIN_TARGET_DIST
1518  if (targetp->type == OBJ_SHIP && Event_Music_battle_started == 0 ) {
1519  Assert( target_shipp != NULL );
1520 
1521  // Goober5000
1522  if (iff_x_attacks_y(target_shipp->team, Player_ship->team))
1523  {
1524  float dist_to_target;
1525 
1526  dist_to_target = vm_vec_dist_quick(&targetp->pos, &Player_obj->pos);
1527  if (dist_to_target < BATTLE_START_MIN_TARGET_DIST) {
1528 
1529  // If the target has an AI class of none, it is a Cargo, NavBuoy or other non-aggressive
1530  // ship, so don't start the battle music
1531  if (stricmp(Ai_class_names[Ai_info[target_shipp->ai_index].ai_class], NOX("none")))
1533  }
1534  }
1535  }
1536 
1537  // Make sure that the player isn't targeting a 3rd stage local ssm
1539  {
1541  {
1543  hud_lock_reset();
1544  }
1545  }
1546 
1547  // Since we need to reference the player's target integrity in several places this upcoming
1548  // frame, only calculate once here
1549  if ( target_shipp ) {
1550  Pl_target_integrity = get_hull_pct(targetp);
1551  }
1552 
1553  // Update cargo scanning
1555 
1556  if ( Viewer_mode & ( VM_EXTERNAL | VM_WARP_CHASE ) ) {
1559  }
1560 
1562  if ( (targetp->instance >=0) && (targetp->instance < MAX_SHIPS) ) {
1563  hud_update_ship_status(targetp);
1564  }
1565 }
1566 
1571 {
1572  if ( hud_sensors_ok(Player_ship, 0) ) {
1574  }
1575 }
1576 
1580 void hud_render_preprocess(float frametime)
1581 {
1582  Player->subsys_in_view = -1;
1584 
1585  if ( (Game_detail_flags & DETAIL_FLAG_HUD) && (supernova_active() >= 3) ) {
1586  return;
1587  }
1588 
1589  if ( hud_disabled() ) {
1590  return;
1591  }
1592 
1593  if ( Viewer_mode & ( VM_DEAD_VIEW ) ) {
1594  return;
1595  }
1596 
1598  // If the player is warping out, don't draw the targeting gauges
1599  Assert(Player != NULL);
1600  if ( Player->control_mode != PCM_NORMAL ) {
1601  return;
1602  }
1603  }
1604 
1605  // process targeting data around any message sender
1607 
1608  // if messages are disabled then skip everything else
1609  if ( hud_disabled_except_messages() ) {
1610  return;
1611  }
1612 
1613  // process navigation stuff
1615 
1616  // process current selection set, if any
1618 
1619  // process asteroid brackets if necessary
1621 
1622  // process targeting data around the current target
1623  hud_show_targeting_gauges(frametime);
1624 
1625  // process brackets and distance to remote detonate missile
1627 
1628  // process any incoming missiles
1630 }
1631 
1634 {
1635 }
1636 
1638 {
1639  time_text_offsets[0] = x;
1640  time_text_offsets[1] = y;
1641 }
1642 
1644 {
1645  time_val_offsets[0] = x;
1646  time_val_offsets[1] = y;
1647 }
1648 
1649 void HudGaugeMissionTime::initBitmaps(const char *fname)
1650 {
1651  time_gauge.first_frame = bm_load_animation(fname, &time_gauge.num_frames);
1652 
1653  if ( time_gauge.first_frame == -1 ) {
1654  Warning(LOCATION, "Could not load in ani: %s\n", fname);
1655  }
1656 }
1657 
1659 {
1660  bm_page_in_aabitmap(time_gauge.first_frame, time_gauge.num_frames );
1661 }
1662 
1663 void HudGaugeMissionTime::render(float frametime)
1664 {
1665  float mission_time, time_comp;
1666  int minutes=0;
1667  int seconds=0;
1668 
1669  mission_time = f2fl(Missiontime); // convert to seconds
1670 
1671  minutes=(int)(mission_time/60);
1672  seconds=(int)mission_time%60;
1673 
1674  setGaugeColor();
1675 
1676  // blit background frame
1677  if ( time_gauge.first_frame >= 0 ) {
1678  renderBitmap(time_gauge.first_frame, position[0], position[1]);
1679  }
1680 
1681  // print out mission time in MM:SS format
1682  renderPrintf(position[0] + time_text_offsets[0], position[1] + time_text_offsets[1], NOX("%02d:%02d"), minutes, seconds);
1683 
1684  // display time compression as xN
1685  time_comp = f2fl(Game_time_compression);
1686  if ( time_comp < 1 ) {
1687  renderPrintf(position[0] + time_val_offsets[0], position[1] + time_val_offsets[1], /*XSTR( "x%.1f", 215), time_comp)*/ NOX("%.2f"), time_comp);
1688  } else {
1689  renderPrintf(position[0] + time_val_offsets[0], position[1] + time_val_offsets[1], XSTR( "x%.2f", 216), time_comp);
1690  }
1691 }
1692 
1697 {
1698  float time_left;
1699 
1700  time_left = supernova_time_left();
1701  if(time_left < 0.0f){
1702  return;
1703  }
1704 
1706  if (Lcl_pl) {
1707  gr_printf(Supernova_coords[gr_screen.res][0], Supernova_coords[gr_screen.res][1], "Wybuch supernowej: %.2f s", time_left);
1708  } else {
1709  gr_printf(Supernova_coords[gr_screen.res][0], Supernova_coords[gr_screen.res][1], "Supernova Warning: %.2f s", time_left);
1710  }
1711 }
1712 
1717 {
1718  size_t i;
1719 
1721 
1722  // start rendering cockpit dependent gauges if possible
1723  for ( i = 0; i < Player_displays.size(); ++i ) {
1724  hud_render_gauges(i);
1725  }
1726 
1728 
1729  // set font back the way it was
1730  gr_set_font(FONT1);
1731 }
1732 
1733 void hud_render_gauges(int cockpit_display_num)
1734 {
1735  size_t j, num_gauges;
1737  int render_target = -1;
1738 
1739  if ( cockpit_display_num >= 0 ) {
1740  if ( sip->cockpit_model_num < 0 ) {
1741  return;
1742  }
1743 
1744  if ( !sip->hud_enabled ) {
1745  return;
1746  }
1747 
1748  render_target = ship_start_render_cockpit_display(cockpit_display_num);
1749 
1750  if ( render_target <= 0 ) {
1751  return;
1752  }
1753  } else {
1754  if( supernova_active() >= 3 ) {
1755  return;
1756  }
1757  }
1758 
1759  // Check if this ship has its own HUD gauges.
1760  if ( sip->hud_enabled ) {
1761  num_gauges = sip->hud_gauges.size();
1762 
1763  for(j = 0; j < num_gauges; j++) {
1764  // only preprocess gauges if we're not rendering to cockpit
1765  if ( cockpit_display_num < 0 ) {
1766  sip->hud_gauges[j]->preprocess();
1767  }
1768 
1769  sip->hud_gauges[j]->onFrame(flFrametime);
1770 
1771  if ( !sip->hud_gauges[j]->setupRenderCanvas(render_target) ) {
1772  continue;
1773  }
1774 
1775  if ( !sip->hud_gauges[j]->canRender() ) {
1776  continue;
1777  }
1778 
1779  sip->hud_gauges[j]->resetClip();
1780  sip->hud_gauges[j]->setFont();
1781  sip->hud_gauges[j]->render(flFrametime);
1782  }
1783  } else {
1784  num_gauges = default_hud_gauges.size();
1785 
1786  for(j = 0; j < num_gauges; j++) {
1787  default_hud_gauges[j]->preprocess();
1788 
1789  default_hud_gauges[j]->onFrame(flFrametime);
1790 
1791  if ( !default_hud_gauges[j]->canRender() ) {
1792  continue;
1793  }
1794 
1795  default_hud_gauges[j]->resetClip();
1796  default_hud_gauges[j]->setFont();
1797  default_hud_gauges[j]->render(flFrametime);
1798  }
1799  }
1800 
1801  if ( cockpit_display_num >= 0 ) {
1802  ship_end_render_cockpit_display(cockpit_display_num);
1803 
1804  if ( gr_screen.rendering_to_texture != -1 ) {
1805  // are we still are rendering to a texture at this point? uh oh.
1807  }
1808  }
1809 }
1810 
1817 {
1818  if ( Player_engine_snd_loop > -1 ) {
1819  snd_stop(Player_engine_snd_loop);
1820  Player_engine_snd_loop = -1;
1821  }
1822 }
1823 
1824 #define ZERO_PERCENT 0.01f
1825 #define ENGINE_MAX_VOL 1.0f
1826 #define ENGINE_MAX_PITCH 44100
1827 
1835 {
1836  float percent_throttle;
1837 
1839  if(Player_engine_snd_loop != -1){
1840  snd_stop(Player_engine_snd_loop);
1841  Player_engine_snd_loop = -1;
1842  }
1843 
1844  return;
1845  }
1846 
1847  if ( timestamp_elapsed(throttle_sound_check_id) ) {
1848 
1849  throttle_sound_check_id = timestamp(THROTTLE_SOUND_CHECK_INTERVAL);
1850 
1851  if ( object_get_gliding(Player_obj) ) { // Backslash
1852  percent_throttle = Player_obj->phys_info.forward_thrust;
1853  } else if ( Ships[Player_obj->instance].current_max_speed == 0 ) {
1854  percent_throttle = Player_obj->phys_info.fspeed / Ship_info[Ships[Player_obj->instance].ship_info_index].max_speed;
1855  } else {
1857  }
1858 
1859  if ( percent_throttle != last_percent_throttle || Player_engine_snd_loop == -1 ) {
1860 
1861  if ( percent_throttle < ZERO_PERCENT ) {
1862  if ( Player_engine_snd_loop > -1 ) {
1863  snd_stop(Player_engine_snd_loop); // Backslash - otherwise, long engine loops keep playing
1864  Player_engine_snd_loop = -1;
1865  }
1866  }
1867  else {
1868  if ( Player_engine_snd_loop == -1 ){
1869  Player_engine_snd_loop = snd_play_looping( &Snds[ship_get_sound(Player_obj, SND_ENGINE)], 0.0f , -1, -1, percent_throttle * ENGINE_MAX_VOL, FALSE);
1870  } else {
1871  // The sound may have been trashed at the low-level if sound channel overflow.
1872  // TODO: implement system where certain sounds cannot be interrupted (priority?)
1873  if ( snd_is_playing(Player_engine_snd_loop) ) {
1874  snd_set_volume(Player_engine_snd_loop, percent_throttle * ENGINE_MAX_VOL);
1875  }
1876  else {
1877  Player_engine_snd_loop = -1;
1878  }
1879  }
1880  }
1881  } // end if (percent_throttle != last_percent_throttle)
1882 
1883  last_percent_throttle = percent_throttle;
1884 
1885  } // end if ( timestamp_elapsed(throttle_sound_check_id) )
1886 }
1887 
1893 {
1894  int i;
1895 
1896  Damage_flash_bright = 0;
1897  Damage_flash_timer = 1;
1898 
1899  for ( i = 0; i < SUBSYSTEM_MAX; i++ ) {
1900  Pl_hud_subsys_info[i].last_str = 1000.0f;
1901  Pl_hud_subsys_info[i].flash_duration_timestamp = 1;
1902  Pl_hud_next_flash_timestamp = 1;
1903  Pl_hud_is_bright = 0;
1904  }
1905 }
1906 
1909 {
1910 }
1911 
1913 {
1914  header_offsets[0] = x;
1915  header_offsets[1] = y;
1916 }
1917 
1919 {
1920  hull_integ_offsets[0] = x;
1921  hull_integ_offsets[1] = y;
1922 }
1923 
1925 {
1927 }
1928 
1930 {
1932 }
1933 
1935 {
1938 }
1939 
1941 {
1943 }
1944 
1946 {
1948 }
1949 
1951 {
1952  line_h = h;
1953 }
1954 
1955 void HudGaugeDamage::initBitmaps(const char *fname_top, const char *fname_middle, const char *fname_bottom)
1956 {
1958  if ( damage_top.first_frame == -1 ) {
1959  Warning(LOCATION, "Could not load in the ani: %s\n", fname_top);
1960  }
1961 
1963  if ( damage_middle.first_frame == -1 ) {
1964  Warning(LOCATION, "Could not load in the ani: %s\n", fname_middle);
1965  }
1966 
1968  if ( damage_bottom.first_frame == -1 ) {
1969  Warning(LOCATION, "Could not load in the ani: %s\n", fname_bottom);
1970  }
1971 }
1972 
1974 {
1975  Damage_flash_bright = false;
1977  next_flash = timestamp(1);
1978  flash_status = false;
1979 
1981 }
1982 
1984 {
1988 }
1989 
1990 void HudGaugeDamage::render(float frametime)
1991 {
1992  model_subsystem *psub;
1993  ship_subsys *pss;
1994  int sx, sy, bx, by, w, h, screen_integrity, num, best_str, best_index;
1995  float strength, shield, integrity;
1996  char buf[128];
1997  hud_subsys_damage hud_subsys_list[SUBSYSTEM_MAX];
1998 
2000  return;
2001  }
2002 
2003  if ( damage_top.first_frame == -1 ) {
2004  return;
2005  }
2006 
2008  return;
2009  }
2010 
2011  hud_get_target_strength(Player_obj, &shield, &integrity);
2012  screen_integrity = fl2i(integrity*100);
2013 
2015  if ( screen_integrity >= 100 ) {
2016  return;
2017  }
2018  }
2019 
2023  }
2024 
2025  setGaugeColor();
2026 
2027  // Draw the top of the damage pop-up
2029  renderString(position[0] + header_offsets[0], position[1] + header_offsets[1], XSTR( "damage", 218));
2030 
2031  // Show hull integrity
2032  if ( screen_integrity < 100 ) {
2033  if ( screen_integrity == 0 ) {
2034  screen_integrity = 1;
2035  }
2036  sprintf(buf, XSTR( "%d%%", 219), screen_integrity);
2038  gr_get_string_size(&w, &h, buf);
2039  if ( screen_integrity < 30 ) {
2041  }
2042  renderString(position[0] + hull_integ_offsets[0], position[1] + hull_integ_offsets[1], XSTR( "Hull Integrity", 220));
2044  }
2045 
2046  // Show damaged subsystems
2047  sx = position[0] + subsys_integ_start_offsets[0];
2048  sy = position[1] + subsys_integ_start_offsets[1];
2049  bx = position[0];
2051 
2052  num = 0;
2053  for ( pss = GET_FIRST(&Player_ship->subsys_list); pss !=END_OF_LIST(&Player_ship->subsys_list); pss = GET_NEXT(pss) ) {
2054  psub = pss->system_info;
2055  strength = ship_get_subsystem_strength(Player_ship, psub->type);
2056  if ( strength < 1 ) {
2057  screen_integrity = fl2i(strength*100);
2058  if ( screen_integrity == 0 ) {
2059  if ( strength > 0 ) {
2060  screen_integrity = 1;
2061  }
2062  }
2063 
2064  if (strlen(psub->alt_dmg_sub_name))
2065  hud_subsys_list[num].name = psub->alt_dmg_sub_name;
2066  else {
2067  hud_subsys_list[num].name = ship_subsys_get_name(pss);
2068  }
2069 
2070  hud_subsys_list[num].str = screen_integrity;
2071  hud_subsys_list[num].type = psub->type;
2072  num++;
2073 
2074  if ( strength < Pl_hud_subsys_info[psub->type].last_str ) {
2076  }
2077  Pl_hud_subsys_info[psub->type].last_str = strength;
2078 
2079  // Don't display more than the max number of damaged subsystems.
2080  if (num >= SUBSYSTEM_MAX)
2081  {
2082  break;
2083  }
2084  }
2085  }
2086 
2087  int type;
2088  for ( int i = 0; i < num; i++ ) {
2089  best_str = 1000;
2090  best_index = -1;
2091  for ( int j = 0; j < num-i; j++ ) {
2092  if ( hud_subsys_list[j].str < best_str ) {
2093  best_str = hud_subsys_list[j].str;
2094  best_index = j;
2095  }
2096  }
2097 
2098  Assert(best_index >= 0);
2099  Assert(best_str >= 0);
2100 
2101  setGaugeColor();
2102 
2104  by += line_h;
2105 
2106  type = hud_subsys_list[best_index].type;
2107  if ( !timestamp_elapsed( Pl_hud_subsys_info[type].flash_duration_timestamp ) ) {
2108  if ( timestamp_elapsed(next_flash) ) {
2111  }
2112 
2113  if ( flash_status ) {
2115  setGaugeColor(alpha_color);
2116  } else {
2117  setGaugeColor();
2118  }
2119  }
2120 
2121  // Draw the text
2122  if ( best_str < 30 ) {
2123  if ( best_str <= 0 ) {
2124  if ( Damage_flash_bright ) {
2126  } else {
2128  }
2129 
2130  } else {
2132  }
2133  } else {
2134  setGaugeColor();
2135  }
2136 
2137  char *n_firstline;
2138  n_firstline = strrchr(hud_subsys_list[best_index].name, '|');
2139  if (n_firstline) {
2140  // Print only the last line
2141  n_firstline++;
2142  renderString(sx, sy, n_firstline);
2143  } else {
2144  char temp_name[NAME_LENGTH];
2145  strcpy_s(temp_name, hud_subsys_list[best_index].name);
2147  renderString(sx, sy, temp_name);
2148  }
2149 
2150  sprintf(buf, XSTR( "%d%%", 219), best_str);
2152  gr_get_string_size(&w, &h, buf);
2153  renderString(position[0] + subsys_integ_val_offset_x - w, sy, buf);
2154  sy += line_h;
2155 
2156  // Remove it from hud_subsys_list
2157  if ( best_index < (num-i-1) ) {
2158  hud_subsys_list[best_index] = hud_subsys_list[num-i-1];
2159  }
2160  }
2161 
2162  setGaugeColor();
2164 }
2165 
2169 void hud_anim_init(hud_anim *ha, int sx, int sy, const char *filename)
2170 {
2171  ha->first_frame = -1;
2172  ha->num_frames = 0;
2173  ha->total_time = 0.0f;
2174  ha->time_elapsed = 0.0f;
2175  ha->sx = sx;
2176  ha->sy = sy;
2177  strcpy_s(ha->filename, filename);
2178 }
2179 
2184 {
2185  hf->first_frame = -1;
2186  hf->num_frames = 0;
2187 }
2188 
2194 {
2195  int fps;
2196 
2197  ha->first_frame = bm_load_animation(ha->filename, &ha->num_frames, &fps);
2198 
2199  // Goober5000 - try to bypass the Volition bug
2200  if ( (ha->first_frame == -1) && !stricmp(ha->filename, "FadeIconS-FreighterCW") )
2201  {
2202  ha->first_frame = bm_load_animation("FadeIconS-FreighterWC", &ha->num_frames, &fps);
2203  }
2204 
2205  if ( ha->first_frame == -1 )
2206  {
2207  Warning(LOCATION, "Couldn't load hud animation for file '%s'", ha->filename);
2208  return -1;
2209  }
2210 
2211  Assert(fps != 0);
2212  ha->total_time = i2fl(ha->num_frames)/fps;
2213  return 0;
2214 }
2215 
2228 int hud_anim_render(hud_anim *ha, float frametime, int draw_alpha, int loop, int hold_last, int reverse, int resize_mode, bool mirror)
2229 {
2230  int framenum;
2231 
2232  if ( ha->num_frames <= 0 ) {
2233  if ( hud_anim_load(ha) == -1 )
2234  return 0;
2235  }
2236 
2237  ha->time_elapsed += frametime;
2238  if ( ha->time_elapsed > ha->total_time ) {
2239  if ( loop ) {
2240  ha->time_elapsed = 0.0f;
2241  } else {
2242  if ( !hold_last ) {
2243  return 0;
2244  }
2245  }
2246  }
2247 
2248  // Draw the correct frame of animation
2249  framenum = fl2i( (ha->time_elapsed * ha->num_frames) / ha->total_time );
2250  if (reverse) {
2251  framenum = (ha->num_frames-1) - framenum;
2252  }
2253 
2254  if ( framenum < 0 )
2255  framenum = 0;
2256  if ( framenum >= ha->num_frames )
2257  framenum = ha->num_frames-1;
2258 
2259  // Blit the bitmap for this frame
2260  if(emp_should_blit_gauge()){
2261  gr_set_bitmap(ha->first_frame + framenum);
2262  if ( draw_alpha ){
2263  gr_aabitmap(ha->sx, ha->sy, resize_mode, mirror);
2264  } else {
2265  gr_bitmap(ha->sx, ha->sy, resize_mode);
2266  }
2267  }
2268 
2269  return 1;
2270 }
2271 
2275 void hud_num_make_mono(char *num_str, int font_num)
2276 {
2277  int len, i;
2278  ubyte sc;
2279 
2280  sc = lcl_get_font_index(font_num);
2281  if (sc == 0) {
2282  // specified font has no mono-spaced 1, make do with non-mono-spaced 1
2283  return;
2284  }
2285 
2286  len = strlen(num_str);
2287  for ( i = 0; i < len; i++ ) {
2288  if ( num_str[i] == '1' ) {
2289  num_str[i] = (char)(sc + 1);
2290  }
2291  }
2292 }
2293 
2298 {
2299  strcpy_s(Hud_text_flash, "");
2302 }
2303 
2304 void hud_start_text_flash(const char *txt, int t, int interval)
2305 {
2306  // bogus
2307  if(txt == NULL){
2308  strcpy_s(Hud_text_flash, "");
2309  return;
2310  }
2311 
2312  // HACK. don't override EMP if its still going :)
2313  // An additional hack: don't interrupt other warnings if this is a missile launch alert (Swifty)
2315  if( !stricmp(Hud_text_flash, NOX("Emp")) || !stricmp(txt, NOX("Launch")) )
2316  return;
2317 
2318  strncpy(Hud_text_flash, txt, 500);
2320  Hud_text_flash_interval = interval;
2321 }
2322 
2325 {
2326 
2327 }
2328 
2330 {
2331  next_flash = timestamp(0);
2332  flash_flags = false;
2333 
2335 }
2336 
2338 {
2340  if ( timestamp_elapsed(next_flash) ) {
2341  next_flash = timestamp(Hud_text_flash_interval);
2342 
2343  // toggle between default and bright frames
2344  flash_flags = !flash_flags;
2345  }
2346  }
2347 
2348  return flash_flags;
2349 }
2350 
2351 void HudGaugeTextWarnings::render(float frametime)
2352 {
2353  // note: Hud_text_flash globally allocated, address can't be NULL
2354  if ( timestamp_elapsed(Hud_text_flash_timer) || Hud_text_flash[0] == '\0' ) {
2355  return;
2356  }
2357 
2358  int w, h;
2359 
2360  // string size
2362 
2363  // set color
2364  if(maybeTextFlash()){
2366 
2367  // draw the box
2368  renderRect( (int)( (float)position[0] - (float)w / 2.0f - 1.0f), (int)((float)position[1] - 1.0f), w + 2, h + 1);
2369  }
2370 
2371  // string
2373  renderString(fl2i((float)position[0] - ((float)w / 2.0f)), position[1], Hud_text_flash);
2374 }
2375 
2378 {
2379 }
2380 
2381 void HudGaugeKills::initBitmaps(const char *fname)
2382 {
2383  Kills_gauge.first_frame = bm_load_animation(fname, &Kills_gauge.num_frames);
2384  if ( Kills_gauge.first_frame == -1 ) {
2385  Warning(LOCATION, "Could not load in the ani: %s\n", fname);
2386  }
2387 }
2388 
2390 {
2391  text_offsets[0] = x;
2392  text_offsets[1] = y;
2393 }
2394 
2396 {
2397  text_value_offsets[0] = x;
2398  text_value_offsets[1] = y;
2399 }
2400 
2402 {
2403  bm_page_in_aabitmap(Kills_gauge.first_frame, Kills_gauge.num_frames);
2404 }
2405 
2409 void HudGaugeKills::render(float frametime)
2410 {
2411  if ( Kills_gauge.first_frame < 0 ) {
2412  return;
2413  }
2414 
2415  setGaugeColor();
2416 
2417  // Draw background
2418  renderBitmap(Kills_gauge.first_frame, position[0], position[1]);
2419  renderString(position[0] + text_offsets[0], position[1] + text_offsets[1], XSTR( "kills:", 223));
2420 
2421  // Display how many kills the player has so far
2422  char num_kills_string[32];
2423  int w,h;
2424 
2425  if ( !Player ) {
2426  Int3();
2427  return;
2428  }
2429 
2430  sprintf(num_kills_string, "%d", Player->stats.m_kill_count_ok);
2431 
2432  gr_get_string_size(&w, &h, num_kills_string);
2433  renderString(position[0]+text_value_offsets[0]-w, position[1]+text_value_offsets[1], num_kills_string);
2434 }
2435 
2438 {
2439 
2440 }
2441 
2442 void HudGaugeLag::initBitmaps(const char *fname)
2443 {
2444  Netlag_icon.first_frame = bm_load_animation(fname, &Netlag_icon.num_frames);
2445 
2446  if ( Netlag_icon.first_frame == -1 ) {
2447  Warning(LOCATION, "Could not load in the netlag ani: %s\n", fname);
2448  }
2449 }
2450 
2452 {
2453  bm_page_in_aabitmap(Netlag_icon.first_frame, Netlag_icon.num_frames);
2454 }
2455 
2456 void HudGaugeLag::startFlashLag(int duration)
2457 {
2458  flash_timer[0] = timestamp(duration);
2459 }
2460 
2461 bool HudGaugeLag::maybeFlashLag(bool flash_fast)
2462 {
2463  bool draw_bright = false;
2464 
2465  if(!timestamp_elapsed(flash_timer[0])) {
2466  if(timestamp_elapsed(flash_timer[1])) {
2467  if(flash_fast) {
2468  flash_timer[1] = timestamp(fl2i(TBOX_FLASH_INTERVAL/2.0f));
2469  } else {
2470  flash_timer[1] = timestamp(TBOX_FLASH_INTERVAL);
2471  }
2472  flash_flag = !flash_flag;
2473  }
2474 
2475  if(flash_flag) {
2476  draw_bright = true;
2477  }
2478  }
2479 
2480  return draw_bright;
2481 }
2482 
2483 void HudGaugeLag::render(float frametime)
2484 {
2485  int lag_status;
2486 
2487  if( !(Game_mode & GM_MULTIPLAYER) ){
2488  return;
2489  }
2490 
2491  if ( Netlag_icon.first_frame == -1 ) {
2492  Int3();
2493  return;
2494  }
2495 
2496  lag_status = multi_query_lag_status();
2497 
2498  switch(lag_status) {
2499  case 0:
2500  // Draw the net lag icon flashing
2501  startFlashLag();
2502  if(maybeFlashLag()){
2504  } else {
2505  setGaugeColor();
2506  }
2507  renderBitmap(Netlag_icon.first_frame, position[0], position[1]);
2508  break;
2509  case 1:
2510  // Draw the disconnected icon flashing fast
2511  if(maybeFlashLag(true)){
2513  } else {
2514  setGaugeColor();
2515  }
2516  renderBitmap(Netlag_icon.first_frame+1, position[0], position[1]);
2517  break;
2518  default:
2519  // Nothing to draw
2520  return;
2521  }
2522 }
2523 
2528 {
2529  Hud_support_view_fade = 1;
2530  Hud_support_obj_sig = -1;
2531  Hud_support_target_sig = -1;
2532  Hud_support_objnum = -1;
2533  Hud_support_view_active = 0;
2534  Hud_support_view_abort = 0;
2535 }
2536 
2541 {
2542  Hud_support_view_active = 1;
2543  Hud_support_view_fade = 1;
2544 }
2545 
2551 void hud_support_view_stop(int stop_now)
2552 {
2553  if ( stop_now ) {
2554  Hud_support_view_active = 0;
2555  Hud_support_view_fade = 1;
2556  Hud_support_view_abort = 0;
2557  } else {
2558  Hud_support_view_fade = timestamp(2000);
2559  }
2560 
2561  Hud_support_obj_sig = -1;
2562  Hud_support_target_sig = -1;
2563  Hud_support_objnum = -1;
2564 }
2565 
2567 {
2569  Hud_support_view_abort = 1;
2570 }
2571 
2582 int hud_get_dock_time( object *docker_objp )
2583 {
2584  ai_info *aip;
2585  object *dockee_objp;
2586  float dist, rel_speed, docker_speed;
2587  vec3d rel_vel;
2588 
2589  aip = &Ai_info[Ships[docker_objp->instance].ai_index];
2590 
2591  // Get the dockee object pointer
2592  if (aip->goal_objnum == -1) {
2593  // This can happen when you target a support ship as it warps in
2594  // just give a debug warning instead of a fault - taylor
2595  mprintf(("'aip->goal_objnum == -1' in hud_get_dock_time(), line %i\n", __LINE__));
2596  return 0;
2597  }
2598 
2599  dockee_objp = &Objects[aip->goal_objnum];
2600 
2601  // If the ship is docked, return 0
2602  if ( dock_check_find_direct_docked_object(docker_objp, dockee_objp) )
2603  return 0;
2604 
2605  vm_vec_sub(&rel_vel, &docker_objp->phys_info.vel, &dockee_objp->phys_info.vel);
2606  rel_speed = vm_vec_mag_quick(&rel_vel);
2607 
2608  dist = vm_vec_dist_quick(&dockee_objp->pos, &docker_objp->pos);
2609 
2610  docker_speed = docker_objp->phys_info.speed;
2611 
2612  if ( rel_speed <= docker_speed/2.0f) { // This means the player is moving away fast from the support ship.
2613  return (int) (dist/docker_speed);
2614  } else {
2615  float d1;
2616  float d = dist;
2617  float time = 0.0f;
2618 
2619  if (rel_speed < 20.0f)
2620  rel_speed = 20.0f;
2621 
2622  // When far away, use max speed, not current speed. Might not have sped up yet.
2623  if (d > 100.0f) {
2624  time += (d - 100.0f)/docker_objp->phys_info.max_vel.xyz.z;
2625  }
2626 
2627  // For mid-range, use current speed.
2628  if (d > 60.0f) {
2629  d1 = MIN(d, 100.0f);
2630 
2631  time += (d1 - 60.0f)/rel_speed;
2632  }
2633 
2634  // For nearby, ship will have to slow down a bit for docking maneuver.
2635  if (d > 30.0f) {
2636  d1 = MIN(d, 60.0f);
2637 
2638  time += (d1 - 30.0f)/5.0f;
2639  }
2640 
2641  // For very nearby, ship moves quite slowly.
2642  d1 = MIN(d, 30.0f);
2643  time += d1/7.5f;
2644 
2645  return fl2i(time);
2646  }
2647 }
2648 
2655 int hud_support_find_closest( int objnum )
2656 {
2657  ship_obj *sop;
2658  ai_info *aip;
2659  object *objp;
2660  int i;
2661 
2662  objp = &Objects[objnum];
2663 
2664  sop = GET_FIRST(&Ship_obj_list);
2665  while(sop != END_OF_LIST(&Ship_obj_list)){
2667  int pship_index, sindex;
2668 
2669  // make sure support ship is not dying
2670  if ( !(Ships[Objects[sop->objnum].instance].flags & (SF_DYING|SF_EXPLODED)) ) {
2671 
2672  Assert( objp->type == OBJ_SHIP );
2673  aip = &Ai_info[Ships[Objects[sop->objnum].instance].ai_index];
2674  pship_index = objp->instance;
2675 
2676  // we must check all goals for this support ship -- not just the first one
2677  for ( i = 0; i < MAX_AI_GOALS; i++ ) {
2678 
2679  // we can use == in the next statement (and should) since a ship will only ever be
2680  // following one order at a time.
2681  if ( aip->goals[i].ai_mode == AI_GOAL_REARM_REPAIR ) {
2682  Assert( aip->goals[i].target_name );
2683  sindex = ship_name_lookup( aip->goals[i].target_name );
2684  if ( sindex == pship_index )
2685  return sop->objnum;
2686  }
2687  }
2688  }
2689  }
2690  sop = GET_NEXT(sop);
2691  }
2692 
2693  return -1;
2694 }
2695 
2697 {
2698  if ( !Hud_support_view_active ) {
2699  return;
2700  }
2701 
2703  return;
2704  }
2705 
2706  // If we haven't determined yet who the rearm ship is, try to!
2707  if (Hud_support_objnum == -1) {
2708  Hud_support_objnum = hud_support_find_closest( OBJ_INDEX(Player_obj) );
2709  if ( Hud_support_objnum >= 0 ) {
2710  Hud_support_obj_sig = Objects[Hud_support_objnum].signature;
2711  Hud_support_target_sig = Player_obj->signature;
2712  }
2713  } else {
2714  // Check to see if support ship is still alive
2715  if ( (Objects[Hud_support_objnum].signature != Hud_support_obj_sig) || (Hud_support_target_sig != Player_obj->signature) ) {
2717  return;
2718  }
2719  }
2720 
2721  if ( Hud_support_view_fade > 1 ) {
2722  if ( timestamp_elapsed(Hud_support_view_fade) ) {
2723 
2724  Hud_support_view_abort = 0;
2725  Hud_support_view_active = 0;
2726  Hud_support_view_fade = 1;
2727  Hud_support_objnum = -1;
2728  }
2729  }
2730 }
2731 
2734 {
2735 }
2736 
2738 {
2739  Header_offsets[0] = x;
2740  Header_offsets[1] = y;
2741 }
2742 
2744 {
2745  text_val_offset_y = y;
2746 }
2747 
2749 {
2751 }
2752 
2754 {
2756 }
2757 
2758 void HudGaugeSupport::initBitmaps(const char *fname)
2759 {
2761  if ( background.first_frame == -1 ) {
2762  Warning(LOCATION, "Could not load in ani: %s\n", fname);
2763  }
2764 }
2765 
2767 {
2769 }
2770 
2771 void HudGaugeSupport::render(float frametime)
2772 {
2773  int show_time, w, h;
2774  char outstr[64];
2775 
2776  if ( !Hud_support_view_active ) {
2777  return;
2778  }
2779 
2780  // Don't render this gauge for multiplayer observers
2782  return;
2783  }
2784 
2785  if ( Hud_support_objnum >= 0 ) {
2786  // Check to see if support ship is still alive
2787  if ( (Objects[Hud_support_objnum].signature != Hud_support_obj_sig) || (Hud_support_target_sig != Player_obj->signature) ) {
2788  return;
2789  }
2790  }
2791 
2793 
2794  // Set hud color
2795  setGaugeColor();
2796 
2798 
2799  renderString(position[0] + Header_offsets[0], position[1] + Header_offsets[1], XSTR( "support", 224));
2800 
2801  if ( Hud_support_view_fade > 1 ) {
2802  if ( !timestamp_elapsed(Hud_support_view_fade) ) {
2803  if ( Hud_support_view_abort){
2804  renderStringAlignCenter(position[0], position[1] + text_val_offset_y, w, XSTR( "aborted", 225));
2805  } else {
2806  renderStringAlignCenter(position[0], position[1] + text_val_offset_y, w, XSTR( "complete", 1407));
2807  }
2808  }
2809  return;
2810  }
2811 
2812  show_time = 0;
2815 
2816  if (!Cmdline_rearm_timer)
2817  {
2818  int i;
2819  bool repairing = false;
2820  for (i = 0; i < SUBSYSTEM_MAX; i++)
2821  {
2822  if (Player_ship->subsys_info[i].type_count > 0)
2823  {
2825  {
2826  repairing = true;
2827  break;
2828  }
2829  }
2830  }
2831 
2832  if (repairing)
2833  strcpy_s(outstr, XSTR("repairing", 227));
2834  else
2835  strcpy_s(outstr, XSTR("rearming", 228));
2836  }
2837  else
2838  {
2839  if (Player_rearm_eta > 0)
2840  {
2841  int min, sec, hund;
2842 
2843  min = (int)Player_rearm_eta / 60;
2844  sec = (int)Player_rearm_eta % 60;
2845  hund = (int)(Player_rearm_eta * 100) % 100;
2846 
2847  sprintf(outstr, "%02d:%02d.%02d", min, sec, hund);
2848  }
2849  else
2850  {
2851  sprintf(outstr, "Waiting...");
2852  }
2853  }
2855  }
2857  strcpy_s(outstr, XSTR( "obstructed", 229));
2859  } else {
2860  if ( Hud_support_objnum == -1 ) {
2862  {
2863  strcpy_s(outstr, XSTR( "exiting hangar", 1622));
2864  }
2865  else
2866  {
2867  strcpy_s(outstr, XSTR( "warping in", 230));
2868  }
2870  } else {
2871  ai_info *aip;
2872 
2873  // Display "busy" when support ship isn't actually enroute to me
2874  aip = &Ai_info[Ships[Objects[Hud_support_objnum].instance].ai_index];
2875  if ( aip->goal_objnum != OBJ_INDEX(Player_obj) ) {
2876  strcpy_s(outstr, XSTR( "busy", 231));
2877  show_time = 0;
2878 
2879  } else {
2880  strcpy_s(outstr, XSTR( "dock in:", 232));
2881  show_time = 1;
2882  }
2883 
2885  }
2886  }
2887 
2888  if ( show_time ) {
2889  int seconds, minutes;
2890 
2891  Assert( Hud_support_objnum != -1 );
2892 
2893  // Ensure support ship is still alive
2894  if ( (Objects[Hud_support_objnum].signature != Hud_support_obj_sig) || (Hud_support_target_sig != Player_obj->signature) ) {
2895  seconds = 0;
2896  } else {
2897  seconds = hud_get_dock_time( &Objects[Hud_support_objnum] );
2898  }
2899 
2900  if ( seconds >= 0 ) {
2901  minutes = seconds/60;
2902  seconds = seconds%60;
2903  if ( minutes > 99 ) {
2904  minutes = 99;
2905  seconds = 99;
2906  }
2907  } else {
2908  minutes = 99;
2909  seconds = 99;
2910  }
2911  renderPrintf(position[0] + text_dock_val_offset_x, position[1] + text_val_offset_y, NOX("%02d:%02d"), minutes, seconds);
2912  }
2913 }
2914 
2919 {
2921  gr_set_color_fast(&HUD_color_defaults[HUD_color_alpha]);
2922 }
2923 
2928 {
2929  int alpha_color;
2931  gr_set_color_fast(&HUD_color_defaults[alpha_color]);
2932 }
2933 
2938 {
2939  if ( HUD_color_alpha > 2 ) {
2940  gr_set_color_fast(&HUD_color_defaults[2]);
2941  }
2942 }
2943 
2950 void hud_set_iff_color(object *objp, int is_bright)
2951 {
2952  color *use_color;
2953 
2954  if (ship_is_tagged(objp))
2955  {
2956  use_color = iff_get_color(IFF_COLOR_TAGGED, is_bright);
2957  }
2958  else
2959  {
2960  if (objp->type == OBJ_ASTEROID)
2961  {
2962  if (OBJ_INDEX(objp) == Player_ai->target_objnum)
2963  {
2964  use_color = iff_get_color_by_team(Iff_traitor, Player_ship->team, is_bright);
2965  }
2966  else
2967  {
2968  use_color = iff_get_color(IFF_COLOR_SELECTION, is_bright);
2969  }
2970  }
2971  else
2972  {
2973  use_color = iff_get_color_by_team_and_object(obj_team(objp), Player_ship->team, is_bright, objp);
2974  }
2975  }
2976 
2977  gr_set_color_fast(use_color);
2978 }
2979 
2984 {
2985  int i;
2986  for ( i=0; i<NUM_HUD_GAUGES; i++ ) {
2989  }
2990  HUD_gauge_bright=0;
2991 }
2992 
2993 #define NUM_VM_OTHER_SHIP_GAUGES 5
2994 static int Vm_other_ship_gauges[NUM_VM_OTHER_SHIP_GAUGES] =
2995 {
3001 };
3002 
3006 int hud_gauge_active(int gauge_index)
3007 {
3008  Assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES);
3009 
3010  // AL: Special code: Only show two gauges when not viewing from own ship
3011  if ( Viewer_mode & VM_OTHER_SHIP ) {
3012  for ( int i = 0; i < NUM_VM_OTHER_SHIP_GAUGES; i++ ) {
3013  if ( gauge_index == Vm_other_ship_gauges[i] ) {
3014  return 1;
3015  }
3016  }
3017  return 0;
3018  }
3019 
3020  return hud_config_show_flag_is_set(gauge_index);
3021 }
3022 
3026 int hud_gauge_is_popup(int gauge_index)
3027 {
3028  Assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES);
3029  return hud_config_popup_flag_is_set(gauge_index);
3030 }
3031 
3036 void hud_gauge_popup_start(int gauge_index, int time)
3037 {
3038  Assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES);
3039  if ( !hud_gauge_is_popup(gauge_index) ) {
3040  return;
3041  }
3042 
3043  size_t num_gauges, i;
3044 
3045  if(Ship_info[Player_ship->ship_info_index].hud_gauges.size() > 0) {
3046  num_gauges = Ship_info[Player_ship->ship_info_index].hud_gauges.size();
3047 
3048  for(i = 0; i < num_gauges; i++) {
3049  if(Ship_info[Player_ship->ship_info_index].hud_gauges[i]->getConfigType() == gauge_index)
3050  Ship_info[Player_ship->ship_info_index].hud_gauges[i]->startPopUp(time);
3051  }
3052  } else {
3053  num_gauges = default_hud_gauges.size();
3054 
3055  for(i = 0; i < num_gauges; i++) {
3056  if(default_hud_gauges[i]->getConfigType() == gauge_index)
3057  default_hud_gauges[i]->startPopUp(time);
3058  }
3059  }
3060 }
3061 
3066 void hud_gauge_start_flash(int gauge_index)
3067 {
3068  Assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES);
3069 
3070  size_t num_gauges, i;
3071 
3073  HUD_gauge_flash_next[gauge_index] = 1;
3074 
3075  if(Ship_info[Player_ship->ship_info_index].hud_gauges.size() > 0) {
3076  num_gauges = Ship_info[Player_ship->ship_info_index].hud_gauges.size();
3077 
3078  for(i = 0; i < num_gauges; i++) {
3079  if(Ship_info[Player_ship->ship_info_index].hud_gauges[i]->getConfigType() == gauge_index)
3080  Ship_info[Player_ship->ship_info_index].hud_gauges[i]->startFlashSexp();
3081  }
3082  } else {
3083  num_gauges = default_hud_gauges.size();
3084 
3085  for(i = 0; i < num_gauges; i++) {
3086  if(default_hud_gauges[i]->getConfigType() == gauge_index)
3087  default_hud_gauges[i]->startFlashSexp();
3088  }
3089  }
3090 }
3091 
3095 void hud_set_gauge_color(int gauge_index, int bright_index)
3096 {
3097  int flash_status = hud_gauge_maybe_flash(gauge_index);
3098  color *use_color = &HUD_config.clr[gauge_index];
3099  int alpha;
3100 
3101  // If we're drawing it as bright
3102  if(bright_index != HUD_C_NONE){
3103  switch(bright_index){
3104  case HUD_C_DIM:
3106  gr_init_alphacolor(use_color, use_color->red, use_color->green, use_color->blue, alpha);
3107  break;
3108 
3109  case HUD_C_NORMAL:
3111  gr_init_alphacolor(use_color, use_color->red, use_color->green, use_color->blue, alpha);
3112  break;
3113 
3114  case HUD_C_BRIGHT:
3116  gr_init_alphacolor(use_color, use_color->red, use_color->green, use_color->blue, alpha);
3117  break;
3118 
3119  // Intensity
3120  default:
3121  Assert((bright_index >= 0) && (bright_index < HUD_NUM_COLOR_LEVELS));
3122  if(bright_index < 0){
3123  bright_index = 0;
3124  }
3125  if(bright_index >= HUD_NUM_COLOR_LEVELS){
3126  bright_index = HUD_NUM_COLOR_LEVELS - 1;
3127  }
3128 
3129  // alpha = 255 - (255 / (bright_index + 1));
3130  // alpha = (int)((float)alpha * 1.5f);
3131  int level = 255 / (HUD_NUM_COLOR_LEVELS);
3132  alpha = level * bright_index;
3133  if(alpha > 255){
3134  alpha = 255;
3135  }
3136  if(alpha < 0){
3137  alpha = 0;
3138  }
3139  gr_init_alphacolor(use_color, use_color->red, use_color->green, use_color->blue, alpha);
3140  break;
3141  }
3142  } else {
3143  switch(flash_status) {
3144  case 0:
3146  gr_init_alphacolor(use_color, use_color->red, use_color->green, use_color->blue, alpha);
3147  break;
3148  case 1:
3150  gr_init_alphacolor(use_color, use_color->red, use_color->green, use_color->blue, alpha);
3151  break;
3152  default:
3154  gr_init_alphacolor(use_color, use_color->red, use_color->green, use_color->blue, alpha);
3155  break;
3156  }
3157  }
3158 
3159  gr_set_color_fast(use_color);
3160 }
3161 
3167 int hud_gauge_maybe_flash(int gauge_index)
3168 {
3169  Assert(gauge_index >=0 && gauge_index < NUM_HUD_GAUGES);
3170  int flash_status=-1;
3171  if ( !timestamp_elapsed(HUD_gauge_flash_duration[gauge_index]) ) {
3172  if ( timestamp_elapsed(HUD_gauge_flash_next[gauge_index]) ) {
3174  HUD_gauge_bright ^= (1<<gauge_index); // toggle between default and bright frames
3175  }
3176 
3177  if ( HUD_gauge_bright & (1<<gauge_index) ) {
3178  flash_status=1;
3179  } else {
3180  flash_status=0;
3181  }
3182  }
3183  return flash_status;
3184 }
3185 
3190 {
3191  Objective_display.display_timer=timestamp(0);
3192 }
3193 
3195 {
3196  // Find out if we should display the subspace status notification
3198  || (Sexp_hud_display_warpout > 0) ) {
3199  if (!hud_subspace_notify_active()) {
3200  // Keep sound from being played 1e06 times
3202  }
3203  } else {
3204  if ( timestamp_elapsed(HUD_abort_subspace_timer) ) {
3206  }
3207  }
3208 
3212  }
3213  }
3214 
3215  // Find out if we should display the objective status notification
3216  if ( timestamp_elapsed(Objective_display.display_timer) ) {
3220  }
3221 }
3222 
3230 void hud_add_objective_messsage(int type, int status)
3231 {
3232  Objective_display.display_timer=timestamp(7000);
3233  Objective_display.goal_type=type;
3234  Objective_display.goal_status=status;
3235 
3236  // if this is a multiplayer tvt game
3237  if(MULTI_TEAM && (Net_player != NULL)) {
3238  mission_goal_fetch_num_resolved(type, &Objective_display.goal_nresolved, &Objective_display.goal_ntotal, Net_player->p_info.team);
3239  } else {
3240  mission_goal_fetch_num_resolved(type, &Objective_display.goal_nresolved, &Objective_display.goal_ntotal);
3241  }
3242 
3243  // TODO: play a sound?
3244 }
3245 
3248 {
3249 
3250 }
3251 
3253 {
3255 }
3256 
3258 {
3260 }
3261 
3263 {
3265 }
3266 
3268 {
3270 }
3271 
3273 {
3274  Red_text_offset_y = y;
3275 }
3276 
3278 {
3280 }
3281 
3283 {
3285  if ( Objective_display_gauge.first_frame == -1 ) {
3286  Warning(LOCATION, "Could not load in ani: %s\n", fname);
3287  }
3288 }
3289 
3291 {
3292  flash_timer[0] = timestamp(1);
3293  flash_timer[1] = timestamp(1);
3294  flash_flag = false;
3295 
3297 }
3298 
3300 {
3302 }
3303 
3305 {
3306  flash_timer[0] = timestamp(duration);
3307 }
3308 
3310 {
3311  bool draw_bright = false;
3312 
3313  if(!timestamp_elapsed(flash_timer[0])) {
3314  if(timestamp_elapsed(flash_timer[1])) {
3315  if(flash_fast) {
3317  } else {
3319  }
3321  }
3322 
3323  if(flash_flag) {
3324  draw_bright = true;
3325  }
3326  }
3327 
3328  return draw_bright;
3329 }
3330 
3331 void HudGaugeObjectiveNotify::render(float frametime)
3332 {
3333  renderSubspace();
3334  renderRedAlert();
3335  renderObjective();
3336 }
3337 
3339 {
3340  int w, h;
3341  int warp_aborted = 0;
3342 
3344  && (Sexp_hud_display_warpout <= 0) ) {
3345  if ( !timestamp_elapsed(HUD_abort_subspace_timer) ) {
3346  warp_aborted = 1;
3347  }
3348  }
3349 
3350  if ( !hud_subspace_notify_active() ) {
3351  return;
3352  }
3353 
3355  return;
3356  }
3357 
3358  // Blit the background
3359  setGaugeColor();
3361 
3362  startFlashNotify();
3364 
3366 
3367  renderStringAlignCenter(position[0], position[1] + Subspace_text_offset_y, w, XSTR( "subspace drive", 233));
3368  if ( warp_aborted ) {
3370  } else {
3372  }
3373 }
3374 
3379 {
3380  int w, h;
3381 
3382  if ( !red_alert_in_progress() ) {
3383  return;
3384  }
3385 
3387  return;
3388  }
3389 
3390  if ( hud_subspace_notify_active() ) {
3391  return;
3392  }
3393 
3394  if ( hud_objective_notify_active() ) {
3395  return;
3396  }
3397 
3398  // Blit the background
3399  gr_set_color_fast(&Color_red); // Color box red, because it's an emergency
3400 
3402 
3403  startFlashNotify();
3404  if(maybeFlashNotify()) {
3406  } else {
3408  }
3409 
3411 
3412  renderStringAlignCenter(position[0], position[1] + Red_text_offset_y, w, XSTR( "downloading new", 235));
3413  renderStringAlignCenter(position[0], position[1] + Red_text_val_offset_y, w, XSTR( "orders...", 236));
3414 
3415  // TODO: play a sound?
3416 }
3417 
3419 {
3420  int w, h;
3421  char buf[128];
3422 
3423  if ( timestamp_elapsed(Objective_display.display_timer) ) {
3424  return;
3425  }
3426 
3428  return;
3429  }
3430 
3431  if ( hud_subspace_notify_active() ) {
3432  return;
3433  }
3434 
3435  // Blit the background
3436  setGaugeColor();
3438 
3439  startFlashNotify();
3440  if(maybeFlashNotify()){
3442  } else {
3443  setGaugeColor();
3444  }
3445 
3447 
3448  // Draw the correct goal type
3449  switch(Objective_display.goal_type) {
3450  case PRIMARY_GOAL:
3451  renderStringAlignCenter(position[0], position[1] + Objective_text_offset_y, w, XSTR( "primary objective", 237));
3452  break;
3453  case SECONDARY_GOAL:
3454  renderStringAlignCenter(position[0], position[1] + Objective_text_offset_y, w, XSTR( "secondary objective", 238));
3455  break;
3456  case BONUS_GOAL:
3457  renderStringAlignCenter(position[0], position[1] + Objective_text_offset_y, w, XSTR( "bonus objective", 239));
3458  break;
3459  }
3460 
3461  // Show the status
3462  switch(Objective_display.goal_type) {
3463  case PRIMARY_GOAL:
3464  case SECONDARY_GOAL:
3465  switch(Objective_display.goal_status) {
3466  case GOAL_FAILED:
3467  sprintf(buf, XSTR( "failed (%d/%d)", 240), Objective_display.goal_nresolved, Objective_display.goal_ntotal);
3469  break;
3470  default:
3471  sprintf(buf, XSTR( "complete (%d/%d)", 241), Objective_display.goal_nresolved, Objective_display.goal_ntotal);
3473  break;
3474  }
3475  break;
3476  case BONUS_GOAL:
3477  switch(Objective_display.goal_status) {
3478  case GOAL_FAILED:
3480  break;
3481  default:
3483  break;
3484  }
3485  break;
3486  }
3487 }
3488 
3490 {
3491  HUD_abort_subspace_timer = timestamp(1500);
3492 }
3493 
3495 {
3496  Subspace_notify_active=0;
3497 }
3498 
3500 {
3501 
3502  Subspace_notify_active=1;
3503 }
3504 
3506 {
3507  return Subspace_notify_active;
3508 }
3509 
3511 {
3512  Objective_notify_active = 0;
3513 }
3514 
3516 {
3518  Objective_notify_active = 1;
3519 }
3520 
3522 {
3523  return Objective_notify_active;
3524 }
3525 
3536 void HUD_set_offsets(object *viewer_obj, int wiggedy_wack, matrix *eye_orient)
3537 {
3538  if ( (viewer_obj == Player_obj) && wiggedy_wack ){
3539  vec3d tmp;
3540  vertex pt;
3541 
3542  HUD_offset_x = 0.0f;
3543  HUD_offset_y = 0.0f;
3544 
3545  vm_vec_scale_add( &tmp, &Eye_position, &eye_orient->vec.fvec, 100.0f );
3546 
3547  (void) g3_rotate_vertex(&pt,&tmp);
3548 
3549  g3_project_vertex(&pt);
3550 
3551  gr_unsize_screen_posf( &pt.screen.xyw.x, &pt.screen.xyw.y );
3552  HUD_offset_x -= 0.45f * (i2fl(gr_screen.clip_width_unscaled)*0.5f - pt.screen.xyw.x);
3553  HUD_offset_y -= 0.45f * (i2fl(gr_screen.clip_height_unscaled)*0.5f - pt.screen.xyw.y);
3554 
3555  if ( HUD_offset_x > 100.0f ) {
3556  HUD_offset_x = 100.0f;
3557  } else if ( HUD_offset_x < -100.0f ) {
3558  HUD_offset_x += 100.0f;
3559  }
3560 
3561  if ( HUD_offset_y > 100.0f ) {
3562  HUD_offset_y = 100.0f;
3563  } else if ( HUD_offset_y < -100.0f ) {
3564  HUD_offset_y += 100.0f;
3565  }
3566 
3567  } else {
3568  HUD_offset_x = 0.0f;
3569  HUD_offset_y = 0.0f;
3570  }
3571 
3572  if ( Viewer_mode & ( VM_TOPDOWN | VM_CHASE ) ) {
3573  HUD_nose_x = 0;
3574  HUD_nose_y = 0;
3575  } else {
3577  }
3578 }
3579 
3583 void HUD_get_nose_coordinates(int *x, int *y)
3584 {
3585  vertex v0;
3586  vec3d p0;
3587 
3588  float x_nose;
3589  float y_nose;
3590  float x_center = gr_screen.clip_center_x;
3591  float y_center = gr_screen.clip_center_y;
3592 
3593  *x = 0;
3594  *y = 0;
3595 
3596  vm_vec_scale_add(&p0, &Player_obj->pos, &Player_obj->orient.vec.fvec, 10000.0f);
3597  g3_rotate_vertex(&v0, &p0);
3598 
3599  if (v0.codes == 0) {
3600  g3_project_vertex(&v0);
3601 
3602  if ( !(v0.codes & PF_OVERFLOW) ) {
3603  x_nose = v0.screen.xyw.x;
3604  y_nose = v0.screen.xyw.y;
3605  } else {
3606  // Means that the ship forward vector is not going through the frame buffer.
3607  // We're assigning a high negative value so that the the bitmaps will be drawn offscreen so that
3608  // we can give the illusion that the player is looking away from the slewable HUD reticle.
3609  *x = -100000;
3610  *y = -100000;
3611  return;
3612  }
3613  } else {
3614  // Means that the ship forward vector is not going through the frame buffer.
3615  // We're assigning a high negative value so that the the bitmaps will be drawn offscreen so that
3616  // we can give the illusion that the player is looking away from the slewable HUD reticle.
3617  *x = -100000;
3618  *y = -100000;
3619  return;
3620  }
3621 
3622  gr_unsize_screen_posf(&x_nose, &y_nose);
3623  gr_unsize_screen_posf(&x_center, &y_center);
3624 
3625  *x = fl2i(x_nose - x_center);
3626  *y = fl2i(y_nose - y_center);
3627  return;
3628 }
3629 
3634 {
3635  int hx = fl2i(HUD_offset_x);
3636  int hy = fl2i(HUD_offset_y);
3637 
3639 }
3640 
3644 void HUD_set_clip(int x, int y, int w, int h)
3645 {
3646  int hx = fl2i(HUD_offset_x);
3647  int hy = fl2i(HUD_offset_y);
3648 
3649  gr_set_clip(hx+x, hy+y, w, h);
3650 }
3651 
3657 {
3658  static vec3d save_view_position;
3659  static float save_view_zoom;
3660  static matrix save_view_matrix;
3661  static matrix save_eye_matrix;
3662  static vec3d save_eye_position;
3663 
3664  if ( save ) {
3665  save_view_position = View_position;
3666  save_view_zoom = View_zoom;
3667  save_view_matrix = View_matrix;
3668  save_eye_matrix = Eye_matrix;
3669  save_eye_position = Eye_position;
3670  }
3671  else {
3672  // restore global view variables
3673  View_position = save_view_position;
3674  View_zoom = save_view_zoom;
3675  View_matrix = save_view_matrix;
3676  Eye_matrix = save_eye_matrix;
3677  Eye_position = save_eye_position;
3678  }
3679 }
3680 
3681 
3683 {
3685 }
3686 
3687 void hud_set_contrast(int high)
3688 {
3689  HUD_contrast = high;
3690 }
3691 
3692 // Paging functions for the rest of the HUD code
3693 extern void hudtarget_page_in();
3694 
3699 {
3700  // Go through all hud gauges to page them in
3701  size_t j, num_gauges = 0;
3702  for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); ++it) {
3703  if(it->hud_enabled) {
3704  if(it->hud_gauges.size() > 0) {
3705  num_gauges = it->hud_gauges.size();
3706 
3707  for(j = 0; j < num_gauges; j++) {
3708  it->hud_gauges[j]->pageIn();
3709  }
3710  }
3711  }
3712  }
3713 
3714  num_gauges = default_hud_gauges.size();
3715 
3716  for(j = 0; j < num_gauges; j++) {
3717  default_hud_gauges[j]->pageIn();
3718  }
3719 }
3720 
3722 {
3723  const char* gauge_name;
3724  size_t j;
3725 
3726  // go through all gauges and return the gauge that matches
3727  if(Ship_info[Player_ship->ship_info_index].hud_gauges.size() > 0) {
3728  for(j = 0; j < Ship_info[Player_ship->ship_info_index].hud_gauges.size(); j++) {
3729 
3730  gauge_name = Ship_info[Player_ship->ship_info_index].hud_gauges[j]->getCustomGaugeName();
3731  if(!strcmp(name, gauge_name)) {
3732  return Ship_info[Player_ship->ship_info_index].hud_gauges[j];
3733  }
3734  }
3735  } else {
3736  for(j = 0; j < default_hud_gauges.size(); j++) {
3737 
3738  gauge_name = default_hud_gauges[j]->getCustomGaugeName();
3739  if(!strcmp(name, gauge_name)) {
3740  return default_hud_gauges[j];
3741  }
3742  }
3743  }
3744 
3745  return NULL;
3746 }
3747 
3749 HudGauge(HUD_OBJECT_MULTI_MSG, HUD_MESSAGE_LINES, false, true, 0, 255, 255, 255)
3750 {
3751 }
3752 
3754 {
3755  return true;
3756 }
3757 
3761 void HudGaugeMultiMsg::render(float frametime)
3762 {
3763  char txt[MULTI_MSG_MAX_TEXT_LEN+20];
3764 
3765  // clear the text
3766  memset(txt,0,MULTI_MSG_MAX_TEXT_LEN+20);
3767 
3768  // if there is valid multiplayer message text to be displayed
3769  if(multi_msg_message_text(txt)){
3771  renderString(position[0], position[1], txt);
3772  }
3773 }
3774 
3777 {
3778 }
3779 
3780 void HudGaugeVoiceStatus::render(float frametime)
3781 {
3782  if(!(Game_mode & GM_MULTIPLAYER)){
3783  return;
3784  }
3785 
3786  // if we are currently playing a rtvoice sound stream from another player back
3787  switch(multi_voice_status()){
3788  // the player has been denied the voice token
3790  // show a red indicator or something
3791  renderString(position[0], position[1], XSTR( "[voice denied]", 243));
3792  break;
3793 
3794  // the player is currently recording
3796  renderString(position[0], position[1], XSTR( "[recording voice]", 244));
3797  break;
3798 
3799  // the player is current playing back voice from someone
3801  renderString(position[0], position[1], XSTR( "[playing voice]", 245));
3802  break;
3803 
3804  // nothing voice related is happening on my machine
3806  // probably shouldn't be displaying anything
3807  break;
3808  }
3809 }
3810 
3812 HudGauge(HUD_OBJECT_PING, HUD_LAG_GAUGE, false, false, 0, 255, 255, 255)
3813 {
3814 
3815 }
3816 
3820 void HudGaugePing::render(float frametime)
3821 {
3822  // If we shouldn't be displaying a ping time, return here
3823  if(!multi_show_ingame_ping()){
3824  return;
3825  }
3826 
3827  // If we're in multiplayer mode, display our ping time to the server
3828  if(MULTIPLAYER_CLIENT && (Net_player != NULL)){
3829  char ping_str[50];
3830  memset(ping_str,0,50);
3831 
3832  // If our ping is positive, display it
3833  if((Netgame.server != NULL) && (Netgame.server->s_info.ping.ping_avg > 0)){
3834  // Get the string
3835  if(Netgame.server->s_info.ping.ping_avg >= 1000){
3836  strcpy_s(ping_str,XSTR("> 1 sec",628));
3837  } else {
3838  sprintf(ping_str,XSTR("%d ms",629),Netgame.server->s_info.ping.ping_avg);
3839  }
3840 
3841  // Blit the string out
3843  renderString(position[0], position[1], ping_str);
3844  }
3845  }
3846 }
3847 
3850 {
3851 }
3852 
3853 void HudGaugeSupernova::render(float frametime)
3854 {
3855  float time_left;
3856 
3857  // if there's a supernova coming
3858  time_left = supernova_time_left();
3859  if(time_left < 0.0f){
3860  return;
3861  }
3862 
3864  if (Lcl_pl) {
3865  renderPrintf(position[0], position[1], "Wybuch supernowej: %.2f s", time_left);
3866  } else {
3867  renderPrintf(position[0], position[1], "Supernova Warning: %.2f s", time_left);
3868  }
3869 }
3870 
3873 {
3874 }
3875 
3876 void HudGaugeFlightPath::initBitmap(const char *fname)
3877 {
3878  Marker.first_frame = bm_load_animation(fname, &Marker.num_frames);
3879 
3880  if ( Marker.first_frame < 0 ) {
3881  Warning(LOCATION,"Cannot load hud ani: %s\n", fname);
3882  }
3883 }
3884 
3886 {
3887  Marker_half[0] = w;
3888  Marker_half[1] = h;
3889 }
3890 
3891 void HudGaugeFlightPath::render(float frametime)
3892 {
3893  object *obj;
3894  vec3d p0,v;
3895  vertex v0;
3896  int sx, sy;
3897 
3898  bool in_frame = g3_in_frame() > 0;
3899  if(!in_frame) {
3900  g3_start_frame(0);
3901  }
3902 
3903  obj = Player_obj;
3904 
3905  vm_vec_scale_add( &v, &obj->phys_info.vel, &obj->orient.vec.fvec, 1.0f );
3906  vm_vec_normalize( &v );
3907 
3908  vm_vec_scale_add( &p0, &obj->pos, &v, 1000000.0f );
3909 
3910  g3_rotate_vertex( &v0, &p0 );
3911 
3912  if (v0.codes == 0) { // on screen
3913  g3_project_vertex(&v0);
3914 
3915  if (!(v0.flags & PF_OVERFLOW)) {
3916  if ( Marker.first_frame >= 0 ) {
3917  sx = fl2i(v0.screen.xyw.x);
3918  sy = fl2i(v0.screen.xyw.y);
3919 
3920  unsize(&sx, &sy);
3921  renderBitmap(Marker.first_frame, sx - Marker_half[0], sy - Marker_half[1]);
3922  }
3923  }
3924  }
3925 
3926  if(!in_frame) {
3927  g3_end_frame();
3928  }
3929 }
void updateCustomGaugeFrame(int frame_offset)
Definition: hud.cpp:409
void gr_rect(int x, int y, int w, int h, int resize_mode)
Definition: 2d.cpp:2068
GLenum GLsizei GLenum format
Definition: Gl.h:1509
void hud_get_target_strength(object *objp, float *shields, float *integrity)
SCP_string sexp
Definition: sexp.cpp:25556
int target_x
Definition: hud.h:242
void hud_init_wingman_status_gauge()
void hud_escort_update_list()
Definition: hudescort.cpp:451
virtual void initialize()
Definition: hud.cpp:1049
int target_h
Definition: hud.h:241
bool gr_resize_screen_posf(float *x, float *y, float *w, float *h, int resize_mode)
Definition: 2d.cpp:430
int timestamp(int delta_ms)
Definition: timer.cpp:226
bool message_gauge
Definition: hud.h:220
struct screen3d::@234::@236 xyw
int offset[2]
Definition: ship.h:262
#define MULTIPLAYER_CLIENT
Definition: multi.h:132
int i
Definition: multi_pxo.cpp:466
fix Missiontime
Definition: systemvars.cpp:19
int hud_get_draw()
Definition: hud.cpp:1282
#define vm_free(ptr)
Definition: pstypes.h:548
SCP_vector< HudGauge * > hud_gauges
Definition: ship.h:1447
int multi_show_ingame_ping()
Definition: multiutil.cpp:2993
void hud_clear_msg_buffer()
Definition: hudmessage.cpp:243
void renderBitmapEx(int frame, int x, int y, int w, int h, int sx, int sy)
Definition: hud.cpp:818
model_subsystem * system_info
Definition: ship.h:314
int HUD_color_alpha
Definition: hud.cpp:76
weapon Weapons[MAX_WEAPONS]
Definition: weapons.cpp:78
void hud_gauge_popup_start(int gauge_index, int time)
Start a gauge to pop-up.
Definition: hud.cpp:3036
int hud_config_show_flag_is_set(int i)
Definition: hudconfig.cpp:791
#define SF_DEPART_WARP
Definition: ship.h:449
void message_training_update_frame()
#define MIN(a, b)
Definition: pstypes.h:296
void hud_stop_looped_engine_sounds()
Called when the game decides to stop all looping sounds.
Definition: hud.cpp:1816
int HUD_nose_x
Definition: hud.cpp:94
virtual void onFrame(float frametime)
Definition: hud.cpp:637
#define HUD_COLOR_ALPHA_DEFAULT
Definition: hud.h:74
#define BONUS_GOAL
Definition: missiongoals.h:30
void updateCustomGaugeCoords(int _x, int _y)
Definition: hud.cpp:399
ai_info * Player_ai
Definition: ai.cpp:24
int team
Definition: ship.h:606
#define MULTI_VOICE_STATUS_IDLE
Definition: multi_voice.h:22
void render(float frametime)
Render multiplayer text message currently being entered, if any.
Definition: hud.cpp:3761
int target_w
Definition: hud.h:241
hud_frames Objective_display_gauge
Definition: hud.h:389
char * ship_subsys_get_name(ship_subsys *ss)
Definition: ship.cpp:15001
void hud_maybe_popup_weapons_gauge()
Determine if we should popup the weapons gauge on the HUD.
Definition: hud.cpp:1314
int disabled_views
Definition: hud.h:221
#define HUD_TALKING_HEAD
Definition: hudgauges.h:43
#define HUD_C_BRIGHT
Definition: hud.h:162
float vm_vec_mag_quick(const vec3d *v)
Definition: vecmat.cpp:371
#define PCM_WARPOUT_STAGE1
Definition: player.h:59
int HUD_gauge_bright
Definition: hud.cpp:163
void render(float frametime)
Definition: hud.cpp:3853
int Hud_text_flash_interval
Definition: hud.cpp:107
vec3d View_position
Definition: 3dsetup.cpp:20
int Game_mode
Definition: systemvars.cpp:24
GLfloat GLfloat GLfloat GLfloat h
Definition: Glext.h:7280
void vm_vec_scale_add(vec3d *dest, const vec3d *src1, const vec3d *src2, float k)
Definition: vecmat.cpp:266
int game_type
Definition: missionparse.h:138
#define MISSION_FLAG_FULLNEB
Definition: missionparse.h:70
void hud_render_gauges(int cockpit_display_num)
Definition: hud.cpp:1733
void hud_update_cargo_scan_sound()
color * iff_get_color_by_team(int team, int seen_from_team, int is_bright)
Definition: iff_defs.cpp:644
#define DAMAGE_FLASH_TIME
Definition: hud.cpp:242
bool lock_color
Definition: hud.h:212
int obj_team(object *objp)
Definition: object.cpp:1843
int HUD_nose_y
Definition: hud.cpp:95
#define MULTI_VOICE_STATUS_RECORDING
Definition: multi_voice.h:24
ship_weapon weapons
Definition: ship.h:658
void hud_maybe_display_supernova()
Show supernova warning it there's a supernova coming.
Definition: hud.cpp:1696
net_player * Net_player
Definition: multi.cpp:94
SCP_vector< game_snd > Snds
Definition: gamesnd.cpp:19
void hud_init_text_flash_gauge()
Flashing text gauge.
Definition: hud.cpp:2297
void startPopUp(int time=4000)
Definition: hud.cpp:568
#define HUD_GAUGE_FLASH_DURATION
Definition: hud.cpp:159
int HUD_color_green
Definition: hud.cpp:74
void hud_wingman_status_update()
color Color_red
Definition: alphacolors.cpp:34
HudGaugeKills()
Definition: hud.cpp:2376
void hud_support_view_init()
Called at mission start to init data, and load support view bitmap if required.
Definition: hud.cpp:2527
float flFrametime
Definition: fredstubs.cpp:22
void mission_goal_fetch_num_resolved(int desired_type, int *num_resolved, int *total, int team)
char ** Ai_class_names
Definition: aicode.cpp:268
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
void render(float frametime)
Definition: hud.cpp:2351
void HUD_init_colors()
Definition: hud.cpp:219
float View_zoom
Definition: 3dsetup.cpp:30
#define VM_WARP_CHASE
Definition: systemvars.h:37
physics_info phys_info
Definition: object.h:157
int hud_gauge_is_popup(int gauge_index)
Determine if gauge is in pop-up mode or not.
Definition: hud.cpp:3026
#define MAX_SHIPS
Definition: globals.h:37
__inline void gr_circle(int xc, int yc, int d, int resize_mode=GR_RESIZE_FULL)
Definition: 2d.h:774
int line_h
Definition: hud.h:434
int subsys_integ_val_offset_x
Definition: hud.h:432
int canvas_h
Definition: hud.h:240
void hud_stop_looped_locking_sounds()
Definition: hudlock.cpp:978
void HUD_init_hud_color_array()
Definition: hud.cpp:208
void hud_subspace_notify_abort()
Definition: hud.cpp:3489
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
#define BATTLE_START_MIN_TARGET_DIST
Definition: eventmusic.h:40
int cargo_inspect_time
Definition: player.h:171
#define HUD_NEW_ALPHA_NORMAL
Definition: hud.cpp:61
float max_hits
Definition: ship.h:320
#define PCM_NORMAL
Definition: player.h:58
#define HUD_OBJECT_KILLS
Definition: hudparse.h:211
void initBitmaps(const char *fname_top, const char *fname_middle, const char *fname_bottom)
Definition: hud.cpp:1955
void updateActive(bool show)
Definition: hud.cpp:538
int next_secondary_fire_stamp[MAX_SHIP_SECONDARY_BANKS]
Definition: ship.h:115
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
void initValueOffsets(int x, int y)
Definition: hud.cpp:1643
Assert(pm!=NULL)
int target_objnum
Definition: ai.h:339
#define HUD_NUM_COLOR_LEVELS
Definition: hud.h:66
int clip_width_unscaled
Definition: 2d.h:379
void hud_init_squadmsg(void)
bool reticle_follow
Definition: hud.h:214
Definition: pstypes.h:88
#define HUD_OBJECT_DAMAGE
Definition: hudparse.h:79
void hud_gauge_flash_init()
Reset gauge flashing data.
Definition: hud.cpp:2983
#define GR_NUM_RESOLUTIONS
Definition: 2d.h:651
#define mprintf(args)
Definition: pstypes.h:238
int ai_index
Definition: ship.h:538
#define NETINFO_FLAG_OBSERVER
Definition: multi.h:605
void gr_init_alphacolor(color *clr, int r, int g, int b, int alpha, int type)
Definition: 2d.cpp:1173
__inline void gr_string(int x, int y, const char *string, int resize_mode=GR_RESIZE_FULL)
Definition: 2d.h:769
void hud_toggle_draw()
Definition: hud.cpp:1270
int HUD_draw
Definition: hud.cpp:78
void hud_init_target_static()
int popUpActive()
Definition: hud.cpp:578
float last_str
Definition: hud.h:51
#define OBJ_ASTEROID
Definition: object.h:44
void player_stop_cargo_scan_sound()
#define HUD_OBJECTIVES_NOTIFY_GAUGE
Definition: hudgauges.h:48
hull_check p0
Definition: lua.cpp:5051
int ai_class
Definition: ai.h:369
void initSubspaceTextOffsetY(int y)
Definition: hud.cpp:3262
#define VM_EXTERNAL
Definition: systemvars.h:31
Definition: 2d.h:95
int subsys_in_view
Definition: player.h:168
matrix Eye_matrix
Definition: 3dsetup.cpp:26
void updateColor(int r, int g, int b, int a=255)
Definition: hud.cpp:530
int HUD_contrast
Definition: hud.cpp:79
int res
Definition: 2d.h:370
void renderBitmapColor(int frame, int x, int y)
Definition: hud.cpp:752
int max_h_unscaled
Definition: 2d.h:361
#define HUD_OBJECT_PING
Definition: hudparse.h:187
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
bool isOffbyDefault()
Definition: hud.cpp:548
void initObjTextOffsetY(int y)
Definition: hud.cpp:3252
void hud_stop_subspace_notify()
Definition: hud.cpp:3494
int Lcl_pl
Definition: localize.cpp:49
__inline void gr_gradient(int x1, int y1, int x2, int y2, int resize_mode=GR_RESIZE_FULL)
Definition: 2d.h:808
int hud_gauge_active(int gauge_index)
Determine if the specified HUD gauge should be displayed.
Definition: hud.cpp:3006
struct vec3d::@225::@227 xyz
int base_h
Definition: hud.h:205
void initRedAlertTextOffsetY(int y)
Definition: hud.cpp:3272
virtual void pageIn()
Definition: hud.cpp:1040
vec3d max_vel
Definition: physics.h:49
GLclampf f
Definition: Glext.h:7097
void initBitmaps(const char *fname)
Definition: hud.cpp:2442
bool maybeFlashLag(bool flash_fast=false)
Definition: hud.cpp:2461
int textoffset_x
Definition: hud.h:231
int HUD_disable_except_messages
Definition: hud.cpp:82
float clip_center_y
Definition: 2d.h:381
int snd_is_playing(int sig)
Definition: sound.cpp:1047
#define PRIMARY_GOAL
Definition: missiongoals.h:28
int red_alert_in_progress()
Definition: redalert.cpp:1063
bool dock_check_find_direct_docked_object(object *objp, object *other_objp)
Definition: objectdock.cpp:91
color clr[NUM_HUD_GAUGES]
Definition: hudconfig.h:60
ai_info Ai_info[MAX_AI_INFO]
Definition: ai.cpp:23
#define f2fl(fx)
Definition: floating.h:37
void hud_frames_init(hud_frames *hf)
Initialise the members of the hud_frames struct to default values.
Definition: hud.cpp:2183
void setCockpitTarget(const cockpit_display *display)
Definition: hud.cpp:1136
#define HUD_NEW_ALPHA_NORMAL_HI
Definition: hud.cpp:66
void initCockpitTarget(const char *display_name, int _target_x, int _target_y, int _target_w, int _target_h, int _canvas_w, int _canvas_h)
Definition: hud.cpp:1099
#define SUBSYS_DAMAGE_FLASH_DURATION
Definition: hud.cpp:176
void initBitmaps(const char *fname)
Definition: hud.cpp:2381
ship_subsys * targeted_subsys
Definition: ai.h:472
int hud_sensors_ok(ship *sp, int show_msg)
Check if targeting is possible based on sensors strength.
Definition: hudtarget.cpp:4578
int textoffset_y
Definition: hud.h:231
void initTextValueOffsetY(int y)
Definition: hud.cpp:2743
int ship_is_tagged(object *objp)
Definition: ship.cpp:17263
int multi_voice_status()
int Sexp_hud_display_warpout
Definition: sexp.cpp:9964
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
#define PLAYER_FLAGS_AUTO_TARGETING
Definition: player.h:38
void hud_check_reticle_list()
Definition: hudtarget.cpp:539
Definition: ai.h:329
void gr_set_color_fast(color *dst)
Definition: 2d.cpp:1197
uint flags
Definition: ship.h:644
ubyte blue
Definition: 2d.h:102
#define IFF_COLOR_TAGGED
Definition: iff_defs.h:21
void initTextValueOffsets(int x, int y)
Definition: hud.cpp:2395
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
Definition: vmallocator.h:21
int flags
Definition: multi.h:463
int target_y
Definition: hud.h:242
int Hud_text_flash_timer
Definition: hud.cpp:106
void pageIn()
Definition: hud.cpp:2401
int custom_frame_offset
Definition: hud.h:230
object * objp
Definition: lua.cpp:3105
void initBaseResolution(int w, int h)
Definition: hud.cpp:369
void hud_set_bright_color()
Set the current color to a bright HUD color (ie high alpha)
Definition: hud.cpp:2927
#define OBJ_OBSERVER
Definition: object.h:43
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
Definition: 2d.cpp:2105
int Damage_flash_timer
Definition: hud.h:436
int Supernova_coords[GR_NUM_RESOLUTIONS][2]
Definition: hud.cpp:143
#define HUD_DIRECTIVES_VIEW
Definition: hudgauges.h:36
int max_w_unscaled
Definition: 2d.h:361
#define Int3()
Definition: pstypes.h:292
int texture_target
Definition: hud.h:239
float clip_center_x
Definition: 2d.h:381
hud_frames damage_top
Definition: hud.h:423
void hud_close()
Delete all HUD gauge objects, for all ships.
Definition: hud.cpp:1247
void initBitmaps(const char *fname)
Definition: hud.cpp:1649
float current_target_distance
Definition: ai.h:489
void renderGradientLine(int x1, int y1, int x2, int y2)
Definition: hud.cpp:873
vec3d pos
Definition: object.h:152
#define VM_TOPDOWN
Definition: systemvars.h:43
void hud_target_clear_display_list()
Definition: hudtarget.cpp:6221
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: Glext.h:7308
ship_subsys_info subsys_info[SUBSYSTEM_MAX]
Definition: ship.h:632
#define GR_RESIZE_NONE
Definition: 2d.h:681
void initMiddleFrameStartOffsetY(int y)
Definition: hud.cpp:1929
void hud_set_default_color()
Set the current color to the default HUD color (with default alpha)
Definition: hud.cpp:2918
int ai_flags
Definition: ai.h:330
void saturate(int *i, int minv, int maxv)
Definition: hud.cpp:199
float time_elapsed
Definition: hud.h:29
void setClip(int x, int y, int w, int h)
Definition: hud.cpp:942
bool maybeFlashNotify(bool flash_fast=false)
Definition: hud.cpp:3309
int signature
Definition: object.h:145
#define HUD_COLOR_ALPHA_MAX
Definition: hud.h:73
void render(float frametime)
Definition: hud.cpp:1663
#define HUD_COLOR_ALPHA_USER_MAX
Definition: hud.h:70
GLenum type
Definition: Gl.h:1492
void hud_set_dim_color()
Set the current color to a dim HUD color (ie low alpha)
Definition: hud.cpp:2937
int popup_timer
Definition: hud.h:219
#define HUD_DAMAGE_GAUGE
Definition: hudgauges.h:44
bool flash_status
Definition: hud.h:440
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
bool flashExpiredSexp()
Definition: hud.cpp:608
virtual void render(float frametime)
Definition: hud.cpp:3331
Definition: hud.h:201
#define HUD_LAG_GAUGE
Definition: hudgauges.h:56
int hud_get_dock_time(object *docker_objp)
Get the number of seconds until repair ship will dock with ther player.
Definition: hud.cpp:2582
ubyte green
Definition: 2d.h:101
int hud_support_find_closest(int objnum)
Locate the closest support ship which is trying to dock with player.
Definition: hud.cpp:2655
void initTextOffsets(int x, int y)
Definition: hud.cpp:2389
hud_frames background
Definition: hud.h:460
SCP_vector< cockpit_display > Player_displays
Definition: ship.cpp:126
int objnum
Definition: ship.h:1483
ship_subsys subsys_list
Definition: ship.h:630
void hud_start_objective_notify()
Definition: hud.cpp:3515
__inline void gr_set_clip(int x, int y, int w, int h, int resize_mode=GR_RESIZE_FULL)
Definition: 2d.h:741
void initRedAlertValueOffsetY(int y)
Definition: hud.cpp:3277
void updatePopUp(bool pop_up_flag)
Definition: hud.cpp:563
void initTextDockValueOffsetX(int x)
Definition: hud.cpp:2753
player Players[MAX_PLAYERS]
void hud_stop_objective_notify()
Definition: hud.cpp:3510
int flash_timer[2]
Definition: hud.h:398
#define HUD_TARGET_MONITOR
Definition: hudgauges.h:26
char alt_dmg_sub_name[NAME_LENGTH]
Definition: model.h:174
void initFont(int input_font_num)
Definition: hud.cpp:382
int m_kill_count_ok
Definition: scoring.h:115
char texture_target_fname[MAX_FILENAME_LEN]
Definition: hud.h:238
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
float supernova_time_left()
Definition: supernova.cpp:279
int instance
Definition: object.h:150
int next_flash
Definition: hud.h:439
SCP_vector< HudGauge * > default_hud_gauges
Definition: hud.cpp:57
#define PF_OVERFLOW
Definition: 3d.h:22
GLintptr offset
Definition: Glext.h:5497
int flash_duration
Definition: hud.h:223
float ship_get_subsystem_strength(ship *shipp, int type)
Definition: ship.cpp:13446
void hud_support_view_stop(int stop_now)
Stop displaying the support view pop-up.
Definition: hud.cpp:2551
#define VM_DEAD_VIEW
Definition: systemvars.h:33
net_player_info p_info
Definition: multi.h:473
int text_dock_offset_x
Definition: hud.h:464
void resetTimers()
Definition: hud.cpp:592
GLfloat ny
Definition: Glext.h:8367
#define HUD_OBJECT_SUPPORT
Definition: hudparse.h:76
int target_is_dying
Definition: player.h:172
int hull_integ_val_offset_x
Definition: hud.h:429
void initRenderStatus(bool render)
Definition: hud.cpp:543
GLdouble GLdouble GLdouble r
Definition: Glext.h:5337
int display_offset_x
Definition: hud.h:243
#define SIF_BIG_SHIP
Definition: ship.h:944
void hud_level_close()
Do post mission cleanup of HUD.
Definition: hud.cpp:1229
void hud_update_target_static()
struct matrix::@228::@230 vec
#define HUD_OBJECT_MISSION_TIME
Definition: hudparse.h:124
#define HUD_OBJECT_CUSTOM
Definition: hudparse.h:67
bool sexp_lock_color
Definition: hud.h:213
#define HUD_KILLS_GAUGE
Definition: hudgauges.h:51
int Subspace_text_offset_y
Definition: hud.h:393
int first_frame
Definition: hud.h:24
screen3d screen
Definition: pstypes.h:173
#define HUD_MESSAGE_LINES
Definition: hudgauges.h:45
float ship_max_hull_strength
Definition: ship.h:597
GLboolean GLboolean g
Definition: Glext.h:5781
int ping_avg
Definition: multi_ping.h:32
int timestamp_until(int stamp)
Definition: timer.cpp:242
const char * getCustomGaugeText()
Definition: hud.cpp:394
void ship_end_render_cockpit_display(int cockpit_display_num)
Definition: ship.cpp:7539
int font_num
Definition: hud.h:210
#define GM_MULTIPLAYER
Definition: systemvars.h:18
void initSubsysIntegStartOffsets(int x, int y)
Definition: hud.cpp:1934
#define TBOX_FLASH_SUBSYS
Definition: hudtargetbox.h:30
#define HUD_TEXT_FLASH
Definition: hudgauges.h:53
int Voice_coords[GR_NUM_RESOLUTIONS][2]
Definition: hud.cpp:123
void hud_add_objective_messsage(int type, int status)
Add objective status on the HUD.
Definition: hud.cpp:3230
void initSlew(bool slew)
Definition: hud.cpp:377
void render(float frametime)
Definition: hud.cpp:2771
GLboolean GLboolean GLboolean GLboolean a
Definition: Glext.h:5781
int HUD_gauge_flash_next[NUM_HUD_GAUGES]
Definition: hud.cpp:162
void initBottomBgOffset(int offset)
Definition: hud.cpp:1945
bool custom_gauge
Definition: hud.h:228
char * name
Definition: hud.h:60
int sx
Definition: hud.h:27
float get_hull_pct(object *objp)
Definition: object.cpp:271
bool object_get_gliding(object *objp)
Definition: object.cpp:2059
char * filename
int num_frames
Definition: hud.h:34
netgame_info Netgame
Definition: multi.cpp:97
void hud_update_objective_message()
Definition: hud.cpp:3194
int ship_get_sound(object *objp, GameSoundsIndex id)
Returns a ship-specific sound index.
Definition: ship.cpp:18614
float speed
Definition: physics.h:79
#define HUD_OBJECT_LAG
Definition: hudparse.h:109
int num_secondary_banks
Definition: ship.h:100
#define ZERO_PERCENT
Definition: hud.cpp:1824
ai_goal goals[MAX_AI_GOALS]
Definition: ai.h:412
#define OBJ_WEAPON
Definition: object.h:33
#define HUD_OBJECT_MULTI_MSG
Definition: hudparse.h:181
void hud_show_selection_set()
Definition: hudtarget.cpp:3387
color HUD_color_defaults[HUD_NUM_COLOR_LEVELS]
Definition: hud.cpp:84
int emp_should_blit_gauge()
Definition: emp.cpp:456
int Subspace_text_val_offset_y
Definition: hud.h:394
void hud_shield_level_init()
Definition: hudshield.cpp:121
#define HUD_SUPPORT_GAUGE
Definition: hudgauges.h:55
bool sexp_override
Definition: hud.h:217
int base_w
Definition: hud.h:205
float hull_strength
Definition: object.h:160
void _cdecl gr_printf(int x, int y, const char *format,...)
Definition: font.cpp:300
GLfloat v0
Definition: Glext.h:5638
#define HUD_NEW_ALPHA_DIM
Definition: hud.cpp:60
#define w(p)
Definition: modelsinc.h:68
void hud_lock_reset(float lock_time_scale)
Definition: hudlock.cpp:271
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
int ai_mode
Definition: ai.h:136
void hud_gauge_start_flash(int gauge_index)
Call HUD function to flash gauge.
Definition: hud.cpp:3066
void hud_target_auto_target_next()
Definition: hudtarget.cpp:1971
void hud_support_view_abort()
Definition: hud.cpp:2566
#define MAX_AI_GOALS
Definition: ai.h:91
HudGauge()
Definition: hud.cpp:246
#define HUD_NEW_ALPHA_BRIGHT
Definition: hud.cpp:62
char name[MAX_FILENAME_LEN]
Definition: ship.h:264
#define NUM_VM_OTHER_SHIP_GAUGES
Definition: hud.cpp:2993
ubyte red
Definition: 2d.h:100
#define SUBSYSTEM_TURRET
Definition: model.h:54
void emp_hud_jitter(int *x, int *y)
Definition: emp.cpp:621
float current_max_speed
Definition: ship.h:641
ubyte g3_rotate_vertex(vertex *dest, const vec3d *src)
Definition: 3dmath.cpp:97
#define NUM_HUD_GAUGES
Definition: hudgauges.h:16
#define HUD_GAUGE_FLASH_INTERVAL
Definition: hud.cpp:160
HudGaugeDamage()
Definition: hud.cpp:1907
void hud_escort_cull_list()
Definition: hudescort.cpp:793
int snd_play(game_snd *gs, float pan, float vol_scale, int priority, bool is_voice_msg)
Definition: sound.cpp:517
int cockpit_model_num
Definition: ship.h:1188
void initHeaderOffsets(int x, int y)
Definition: hud.cpp:1912
void initLineHeight(int h)
Definition: hud.cpp:1950
void hud_support_view_start()
Start displaying the support view pop-up. This will remain up until hud_support_view_stop() is called...
Definition: hud.cpp:2540
virtual void preprocess()
Definition: hud.cpp:632
void hud_page_in()
Page in all HUD bitmaps.
Definition: hud.cpp:3698
int HUD_gauge_flash_duration[NUM_HUD_GAUGES]
Definition: hud.cpp:161
HudGauge * hud_get_gauge(const char *name)
Definition: hud.cpp:3721
void initBitmaps(const char *fname)
Definition: hud.cpp:3282
char * target_name
Definition: ai.h:143
GLdouble s
Definition: Glext.h:5321
void hud_objective_message_init()
Initialise the objective message display data.
Definition: hud.cpp:3189
Definition: hud.h:32
net_player_server_info s_info
Definition: multi.h:472
int type_count
Definition: ship.h:417
void hud_set_gauge_color(int gauge_index, int bright_index)
Set the HUD color for the gauge, based on whether it is flashing or not.
Definition: hud.cpp:3095
void hud_show_asteroid_brackets()
Draw white brackets around asteroids which has the AF_DRAW_BRACKETS flag set.
Definition: hud.cpp:1570
int hud_config_popup_flag_is_set(int i)
Definition: hudconfig.cpp:822
int getObjectType()
Definition: hud.cpp:515
matrix eye_orient
Definition: fredrender.cpp:112
int lssm_stage
Definition: weapon.h:216
#define PCM_WARPOUT_STAGE2
Definition: player.h:60
int hud_objective_notify_active()
Definition: hud.cpp:3521
int middle_frame_start_offset_y
Definition: hud.h:430
void initObjValueOffsetY(int y)
Definition: hud.cpp:3257
float current_hits
Definition: ship.h:319
#define DETAIL_FLAG_HUD
Definition: systemvars.h:114
Definition: ship.h:534
void hud_targetbox_truncate_subsys_name(char *outstr)
bool off_by_default
Definition: hud.h:216
bool bm_set_render_target(int handle, int face)
(GR function) Calls gr_bm_set_render target for the given bitmap indexed by handle ...
Definition: bmpman.cpp:2810
color HUD_color_debug
Definition: hud.cpp:85
int g3_project_vertex(vertex *point)
Definition: 3dmath.cpp:202
void resetClip()
Definition: hud.cpp:978
int secondary_bank_ammo[MAX_SHIP_SECONDARY_BANKS]
Definition: ship.h:134
void hud_show_targeting_gauges(float frametime)
Definition: hudtarget.cpp:3478
GLdouble GLdouble t
Definition: Glext.h:5329
void hud_render_all()
Undertakes main HUD render.
Definition: hud.cpp:1716
void hud_update_ship_status(object *targetp)
int header_offsets[2]
Definition: hud.h:427
void renderString(int x, int y, const char *str)
Definition: hud.cpp:665
void render(float frametime)
Definition: hud.cpp:3891
void hudtarget_page_in()
Definition: hudtarget.cpp:5249
void hud_prune_hotkeys()
Definition: hudtarget.cpp:3330
void hud_update_closest_turret()
Definition: hudtarget.cpp:2321
int Objective_text_offset_y
Definition: hud.h:391
int iff_x_attacks_y(int team_x, int team_y)
Definition: iff_defs.cpp:605
const char * getCustomGaugeName()
Definition: hud.cpp:389
int gauge_config
Definition: hud.h:207
void hud_draw_navigation()
object Objects[MAX_OBJECTS]
Definition: object.cpp:62
GLint GLint GLint GLint GLint x
Definition: Glext.h:5182
void asteroid_show_brackets()
Definition: asteroid.cpp:2150
unsigned char ubyte
Definition: pstypes.h:62
int hud_disabled()
Checks if HUD disabled.
Definition: hud.cpp:1306
void hud_start_subspace_notify()
Definition: hud.cpp:3499
void hud_set_draw(int draw)
Definition: hud.cpp:1276
void update_throttle_sound()
If the throttle has changed, modify the sound.
Definition: hud.cpp:1834
int Training_message_visible
const char * XSTR(const char *str, int index)
Definition: localize.cpp:851
Definition: hud.h:22
void setFont()
Definition: hud.cpp:440
#define OBJ_INDEX(objp)
Definition: object.h:235
#define MULTI_TEAM
Definition: multi.h:655
#define SECONDARY_GOAL
Definition: missiongoals.h:29
ship * Player_ship
Definition: ship.cpp:124
color Color_bright_red
Definition: alphacolors.cpp:34
matrix orient
Definition: object.h:153
int max_w
Definition: 2d.h:360
void hud_update_frame(float frametime)
Updates HUD systems each frame.
Definition: hud.cpp:1336
#define NOX(s)
Definition: pstypes.h:473
int Hud_max_targeting_range
Definition: hud.cpp:99
void hud_shield_hit_update()
Definition: hudshield.cpp:511
#define OBJ_SHIP
Definition: object.h:32
void updateSexpOverride(bool sexp)
Definition: hud.cpp:558
#define GR_RESIZE_FULL
Definition: 2d.h:682
void startFlashLag(int duration=1400)
Definition: hud.cpp:2456
ubyte lcl_get_font_index(int font_num)
Definition: localize.cpp:495
ubyte flags
Definition: pstypes.h:178
GLbitfield flags
Definition: Glext.h:6722
#define SUBSYS_DAMAGE_FLASH_INTERVAL
Definition: hud.cpp:177
void hud_init_reticle()
Definition: hudreticle.cpp:949
int display_offset_y
Definition: hud.h:243
#define SIF_HUGE_SHIP
Definition: ship.h:945
typedef void(APIENTRY *PFNGLARRAYELEMENTEXTPROC)(GLint i)
void renderRect(int x, int y, int w, int h)
Definition: hud.cpp:896
#define AIF_BEING_REPAIRED
Definition: ai.h:40
void initSubsysIntegValueOffsetX(int x)
Definition: hud.cpp:1940
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
int control_mode
Definition: player.h:134
int maybeFlashSexp()
Definition: hud.cpp:617
GLuint const GLchar * name
Definition: Glext.h:5608
__inline void gr_line(int x1, int y1, int x2, int y2, int resize_mode=GR_RESIZE_FULL)
Definition: 2d.h:791
int canvas_w
Definition: hud.h:240
int first_frame
Definition: hud.h:33
int flash_duration_timestamp
Definition: hud.h:52
int hud_gauge_maybe_flash(int gauge_index)
Set the color for a gauge that may be flashing.
Definition: hud.cpp:3167
int final_death_time
Definition: ship.h:569
void vm_vec_sub(vec3d *dest, const vec3d *src0, const vec3d *src1)
Definition: vecmat.cpp:168
void render(float frametime)
Display the kills gauge on the HUD.
Definition: hud.cpp:2409
void renderStringAlignCenter(int x, int y, int area_width, const char *s)
Definition: hud.cpp:716
vec3d vel
Definition: physics.h:77
float fspeed
Definition: physics.h:80
virtual bool canRender()
Definition: hud.cpp:1059
int num_frames
Definition: hud.h:26
#define MISSION_TYPE_TRAINING
Definition: missionparse.h:63
#define SIF_SUPPORT
Definition: ship.h:878
vec3d Eye_position
Definition: 3dsetup.cpp:27
color * iff_get_color(int color_index, int is_bright)
Definition: iff_defs.cpp:636
void HUD_get_nose_coordinates(int *x, int *y)
Returns the offset between the player's view vector and the forward vector of the ship in pixels (Swi...
Definition: hud.cpp:3583
GLboolean GLboolean GLboolean b
Definition: Glext.h:5781
int target
Definition: ship.h:258
GLbyte by
Definition: Glext.h:8237
ship Ships[MAX_SHIPS]
Definition: ship.cpp:122
void pageIn()
Definition: hud.cpp:2451
uint Game_detail_flags
Definition: systemvars.cpp:52
HudGaugePing()
Definition: hud.cpp:3811
bool gr_resize_screen_pos(int *x, int *y, int *w, int *h, int resize_mode)
Definition: 2d.cpp:212
#define HUD_C_NORMAL
Definition: hud.h:164
ping_struct ping
Definition: multi.h:395
#define SF_EXPLODED
Definition: ship.h:467
bool Damage_flash_bright
Definition: hud.h:437
void pageIn()
Definition: hud.cpp:1983
GLuint GLuint num
Definition: Glext.h:9089
void hud_support_view_update()
Definition: hud.cpp:2696
color gauge_color
Definition: hud.h:206
bool flash_status
Definition: hud.h:225
#define FONT1
Definition: font.h:65
int Event_Music_battle_started
Definition: eventmusic.cpp:39
void hud_target_change_check()
Definition: hudtarget.cpp:4407
int multi_query_lag_status()
Definition: multiutil.cpp:2392
float vm_vec_dist_quick(const vec3d *v0, const vec3d *v1)
Definition: vecmat.cpp:417
int hud_squadmsg_do_frame()
#define SF2_NO_ETS
Definition: ship.h:503
#define NAME_LENGTH
Definition: globals.h:15
GLubyte GLubyte GLubyte GLubyte w
Definition: Glext.h:5679
#define MULTI_MSG_MAX_TEXT_LEN
Definition: multi_pmsg.h:34
void unsize(int *x, int *y)
Definition: hud.cpp:1012
int position[2]
Definition: hud.h:204
int set_target_objnum(ai_info *aip, int objnum)
Definition: aicode.cpp:1250
virtual void render(float frametime)
Definition: hud.cpp:642
void initHeaderOffsets(int x, int y)
Definition: hud.cpp:2737
bool hud_enabled
Definition: ship.h:1448
void hud_damage_popup_init()
Called at the beginning of each level. Loads frame data in once, and initializes any damage gauge spe...
Definition: hud.cpp:1892
void render(float frametime)
Definition: hud.cpp:1990
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
void HUD_init()
Called each level to initialize HUD systems.
Definition: hud.cpp:1164
int g3_in_frame()
Definition: 3dsetup.cpp:66
void startFlashSexp()
Definition: hud.cpp:601
#define fl2i(fl)
Definition: floating.h:33
void initTextOffsets(int x, int y)
Definition: hud.cpp:1637
int Ping_coords[GR_NUM_RESOLUTIONS][2]
Definition: hud.cpp:133
void hud_disable_except_messages(int disable)
Definition: hud.cpp:1288
int HUD_color_red
Definition: hud.cpp:73
player * Player
int Num_fonts
Definition: font.cpp:34
void hud_start_text_flash(char *txt, int t, int interval)
#define HUD_OBJECT_SUPERNOVA
Definition: hudparse.h:190
bool canRender()
Definition: hud.cpp:3753
void hud_targetbox_start_flash(int index, int duration)
void HUD_set_clip(int x, int y, int w, int h)
Like gr_set_clip() only it accounts for HUD jittering.
Definition: hud.cpp:3644
#define g3_end_frame()
Definition: 3d.h:49
#define HUD_OBJECT_FLIGHT_PATH
Definition: hudparse.h:220
GLfloat GLfloat GLfloat GLfloat nx
Definition: Glext.h:8369
bool active
Definition: hud.h:215
#define HUD_WEAPONS_GAUGE
Definition: hudgauges.h:34
screen gr_screen
Definition: 2d.cpp:46
float total_time
Definition: hud.h:28
void gr_get_string_size(int *w, int *h, const char *text, int len=9999)
Definition: font.cpp:196
int sy
Definition: hud.h:27
directive complete
Definition: gamesnd.h:125
void getPosition(int *x, int *y)
Definition: hud.cpp:363
int snd_play_looping(game_snd *gs, float pan, int start_loop, int stop_loop, float vol_scale, int scriptingUpdateVolume)
Definition: sound.cpp:822
#define HUD_OBJECT_VOICE_STATUS
Definition: hudparse.h:184
#define THROTTLE_SOUND_CHECK_INTERVAL
Definition: hud.cpp:239
bool isActive()
Definition: hud.cpp:553
int Red_text_val_offset_y
Definition: hud.h:396
void sexpLockConfigColor(bool lock)
Definition: hud.cpp:525
ship_obj Ship_obj_list
Definition: ship.cpp:162
long Game_time_compression
Definition: fredstubs.cpp:202
int ship_info_index
Definition: ship.h:539
int hud_maybe_render_emp_icon()
int clip_height_unscaled
Definition: 2d.h:379
HUD_CONFIG_TYPE HUD_config
Definition: hudconfig.cpp:49
void HUD_reset_clip()
Like gr_reset_clip() only it accounts for HUD jittering.
Definition: hud.cpp:3633
void snd_set_volume(int sig, float volume)
Definition: sound.cpp:920
SCP_vector< ship_info > Ship_info
Definition: ship.cpp:164
#define LOCATION
Definition: pstypes.h:245
#define MULTI_VOICE_STATUS_DENIED
Definition: multi_voice.h:23
int max_h
Definition: 2d.h:360
__inline void gr_aabitmap(int x, int y, int resize_mode=GR_RESIZE_FULL, bool mirror=false)
Definition: 2d.h:750
#define VM_PADLOCK_ANY
Definition: systemvars.h:46
void gr_reset_screen_scale()
Definition: 2d.cpp:176
void hud_init_msg_window()
Definition: hudmessage.cpp:220
int Viewer_mode
Definition: systemvars.cpp:28
__inline void gr_aabitmap_ex(int x, int y, int w, int h, int sx, int sy, int resize_mode=GR_RESIZE_FULL, bool mirror=false)
Definition: 2d.h:755
int hud_anim_load(hud_anim *ha)
Load a hud_anim.
Definition: hud.cpp:2193
#define timestamp_elapsed(stamp)
Definition: timer.h:102
float Player_rearm_eta
Definition: hud.cpp:179
void resize(int *x, int *y)
Definition: hud.cpp:1026
#define OF_SHOULD_BE_DEAD
Definition: object.h:106
int Target_static_looping
vec3d * get_subsystem_world_pos(object *parent_obj, ship_subsys *subsys, vec3d *world_pos)
Definition: hudtarget.cpp:4395
void initSubspaceValueOffsetY(int y)
Definition: hud.cpp:3267
#define AIF_REPAIR_OBSTRUCTED
Definition: ai.h:54
char Hud_text_flash[512]
Definition: hud.cpp:105
bool gr_unsize_screen_pos(int *x, int *y, int *w, int *h, int resize_mode)
Definition: 2d.cpp:320
SCP_string custom_text
Definition: hud.h:233
GLsizei GLsizei GLuint * obj
Definition: Glext.h:5619
float HUD_offset_x
Definition: hud.cpp:90
#define TBOX_FLASH_INTERVAL
Definition: hudtargetbox.h:22
int Header_offsets[2]
Definition: hud.h:462
int Iff_traitor
Definition: iff_defs.cpp:22
color Color_normal
Definition: alphacolors.cpp:28
bool pop_up
Definition: hud.h:218
void renderPrintf(int x, int y, const char *format,...)
Definition: hud.cpp:724
float Pl_target_integrity
Definition: hud.cpp:97
void initHullIntegValueOffsetX(int x)
Definition: hud.cpp:1924
void initialize()
Definition: hud.cpp:1973
int getConfigType()
Definition: hud.cpp:509
void hud_set_contrast(int high)
Definition: hud.cpp:3687
#define i2fl(i)
Definition: floating.h:32
#define HUD_C_NONE
Definition: hud.h:161
void hud_update_weapon_flash()
Definition: hudtarget.cpp:6152
#define HUD_TARGET_MONITOR_EXTRA_DATA
Definition: hudgauges.h:28
void gr_bitmap(int _x, int _y, int resize_mode)
Definition: 2d.cpp:1303
int Cmdline_rearm_timer
Definition: cmdline.cpp:366
void emp_hud_string(int x, int y, int gauge_id, const char *str, int resize_mode)
Definition: emp.cpp:468
GLenum GLsizei len
Definition: Glext.h:6283
object * Player_obj
Definition: object.cpp:56
void render(float frametime)
Definition: hud.cpp:2483
virtual ~HudGauge()
Definition: hud.cpp:355
matrix View_matrix
Definition: 3dsetup.cpp:19
char filename[MAX_FILENAME_LEN]
Definition: hud.h:23
uint flags2
Definition: ship.h:645
#define AI_GOAL_REARM_REPAIR
Definition: aigoals.h:49
#define SF_DYING
Definition: ship.h:447
void hud_maybe_display_subspace_notify()
void hud_target_last_transmit_level_init()
Definition: hudtarget.cpp:5099
int hull_integ_offsets[2]
Definition: hud.h:428
void initBitmaps(const char *fname)
Definition: hud.cpp:2758
int goal_objnum
Definition: ai.h:355
int emp_active_local()
Definition: emp.cpp:428
int gauge_object
Definition: hud.h:208
int bottom_bg_offset
Definition: hud.h:433
#define PCM_WARPOUT_STAGE3
Definition: player.h:61
void lockConfigColor(bool lock)
Definition: hud.cpp:520
bool gr_unsize_screen_posf(float *x, float *y, float *w, float *h, int resize_mode)
Definition: 2d.cpp:538
int flash_next
Definition: hud.h:224
hud_frames damage_middle
Definition: hud.h:424
float HUD_offset_y
Definition: hud.cpp:91
bool setupRenderCanvas(int render_target=-1)
Definition: hud.cpp:1121
#define VM_OTHER_SHIP
Definition: systemvars.h:35
float hud_find_target_distance(object *targetee, object *targeter)
Definition: hudtarget.cpp:2009
int ship_name_lookup(const char *name, int inc_players)
Definition: ship.cpp:12900
#define HUD_CENTER_RETICLE
Definition: hudgauges.h:27
ubyte codes
Definition: pstypes.h:177
char custom_name[NAME_LENGTH]
Definition: hud.h:232
HudGaugeLag()
Definition: hud.cpp:2436
void hud_update_reticle(player *pp)
Definition: hudreticle.cpp:960
false
Definition: lua.cpp:6789
uint flags
Definition: object.h:151
#define ENGINE_MAX_VOL
Definition: hud.cpp:1825
#define SUBSYSTEM_MAX
Definition: model.h:64
void snd_stop(int sig)
Definition: sound.cpp:875
mission The_mission
void render(float frametime)
Definition: hud.cpp:3780
#define ARRIVE_FROM_DOCK_BAY
Definition: missionparse.h:240
void hud_targetbox_init_flash()
int supernova_active()
Definition: supernova.cpp:240
int text_val_offset_y
Definition: hud.h:463
GLint level
Definition: Glext.h:5180
void hud_init_targeting()
Definition: hudtarget.cpp:1038
#define VM_CHASE
Definition: systemvars.h:34
void initHullIntegOffsets(int x, int y)
Definition: hud.cpp:1918
void gr_set_font(int fontnum)
Definition: font.cpp:566
hud_frames damage_bottom
Definition: hud.h:425
GLclampf GLclampf GLclampf alpha
Definition: Glext.h:5177
#define MULTI_VOICE_STATUS_PLAYING
Definition: multi_voice.h:25
int rendering_to_texture
Definition: 2d.h:403
char type
Definition: object.h:146
void hud_render_preprocess(float frametime)
Render gauges that need to be between a g3_start_frame() and a g3_end_frame()
Definition: hud.cpp:1580
void hud_init_targeting_colors()
Definition: hudtarget.cpp:973
int Multi_msg_coords[GR_NUM_RESOLUTIONS][2]
Definition: hud.cpp:113
support_ship_info support_ships
Definition: missionparse.h:143
int multi_msg_message_text(char *txt)
Definition: multi_pmsg.cpp:264
void initPosition(int x, int y)
Definition: hud.cpp:357
hud_frames custom_frame
Definition: hud.h:229
int ship_start_render_cockpit_display(int cockpit_display_num)
Definition: ship.cpp:7494
#define HUD_OBJECT_OBJ_NOTIFY
Definition: hudparse.h:103
#define FALSE
Definition: pstypes.h:400
int hud_disabled_except_messages()
Like hud_disabled(), except messages are still drawn.
Definition: hud.cpp:1297
void initTextDockOffsetX(int x)
Definition: hud.cpp:2748
int text_dock_val_offset_x
Definition: hud.h:465
void updateCustomGaugeText(const char *txt)
Definition: hud.cpp:422
#define HUD_MISSION_TIME
Definition: hudgauges.h:22
#define HUD_NEW_ALPHA_BRIGHT_HI
Definition: hud.cpp:67
#define HUD_C_DIM
Definition: hud.h:163
bool ship_subsys_takes_damage(ship_subsys *ss)
Definition: ship.cpp:17545
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
#define PLAYER_FLAGS_MSG_MODE
Definition: player.h:37
#define stricmp(s1, s2)
Definition: config.h:271
const GLdouble * v
Definition: Glext.h:5322
net_player * server
Definition: multi.h:505
void render(float frametime)
Render multiplayer ping time to the server, if appropriate.
Definition: hud.cpp:3820
void initBitmap(const char *fname)
Definition: hud.cpp:3876
int Objective_text_val_offset_y
Definition: hud.h:392
#define HUD_BRIGHT_DELTA
Definition: hud.h:76
SCP_string default_text
Definition: hud.h:235
#define IFF_COLOR_SELECTION
Definition: iff_defs.h:19
void initHalfSize(int w, int h)
Definition: hud.cpp:3885
void hud_process_remote_detonate_missile()
Definition: hudtarget.cpp:3224
void hud_save_restore_camera_data(int save)
Called to save and restore the 3D camera settings.
Definition: hud.cpp:3656
void hud_process_homing_missiles()
Definition: hudtarget.cpp:3098
int hud_subspace_notify_active()
Definition: hud.cpp:3505
#define HUD_ETS_GAUGE
Definition: hudgauges.h:31
engine sound (as heard in cockpit)
Definition: gamesnd.h:72
int subsys_integ_start_offsets[2]
Definition: hud.h:431
int maybeTextFlash()
Definition: hud.cpp:2337
GLint y
Definition: Gl.h:1505
void hud_show_message_sender()
Definition: hudtarget.cpp:3265
int current_target_is_locked
Definition: ai.h:490
void resetCockpitTarget()
Definition: hud.cpp:1155
void hud_escort_init()
Definition: hudescort.cpp:470
void renderCircle(int x, int y, int diameter)
Definition: hud.cpp:919
float forward_thrust
Definition: physics.h:72
void pageIn()
Definition: hud.cpp:2766
#define g3_start_frame(zbuffer_flag)
Definition: 3d.h:39
void startFlashNotify(int duration=1400)
Definition: hud.cpp:3304
scoring_struct stats
Definition: player.h:127
int event_music_battle_start()
Definition: eventmusic.cpp:732
int hud_target_invalid_awacs(object *objp)
Definition: hudtarget.cpp:460
#define HUD_NEW_ALPHA_DIM_HI
Definition: hud.cpp:65
float vm_vec_normalize(vec3d *v)
Definition: vecmat.cpp:460
void hud_init_emp_icon()
int Player_num
#define strcpy_s(...)
Definition: safe_strings.h:67
#define GOAL_FAILED
Definition: missiongoals.h:38
void renderBitmap(int x, int y)
Definition: hud.cpp:782
#define HUD_OBJECT_TEXT_WARNINGS
Definition: hudparse.h:157
void HUD_set_offsets(object *viewer_obj, int wiggedy_wack, matrix *eye_orient)
Set the offset values for this render frame.
Definition: hud.cpp:3536
void hud_toggle_contrast()
Definition: hud.cpp:3682
int HUD_color_blue
Definition: hud.cpp:75