FS2_Open
Open source remastering of the Freespace 2 engine
hudparse.cpp
Go to the documentation of this file.
1 /*
2  * Created by WMCoolmon for the FreeSpace2 Source Code Project.
3  * You may not sell or otherwise commercially exploit the source or things you
4  * create based on the source.
5  */
6 
7 
8 
9 #include <cstddef>
10 
11 #include "cmdline/cmdline.h"
12 #include "graphics/font.h" //for gr_force_fit_string
13 #include "hud/hud.h"
14 #include "hud/hudbrackets.h"
15 #include "hud/hudconfig.h" // for retrieving user's hud config
16 #include "hud/hudescort.h"
17 #include "hud/hudets.h"
18 #include "hud/hudlock.h"
19 #include "hud/hudmessage.h"
20 #include "hud/hudparse.h" //Duh.
21 #include "hud/hudreticle.h"
22 #include "hud/hudshield.h"
23 #include "hud/hudsquadmsg.h"
24 #include "hud/hudtarget.h"
25 #include "hud/hudtargetbox.h"
26 #include "hud/hudwingmanstatus.h"
27 #include "localization/localize.h"
28 #include "mission/missionmessage.h"
30 #include "parse/parselo.h"
31 #include "radar/radar.h"
32 #include "radar/radardradis.h"
33 #include "radar/radarorb.h"
34 #include "radar/radarsetup.h"
35 #include "ship/ship.h" //for ship struct
36 
37 //Global stuffs
38 extern int ships_inited; //Need this
39 
40 float Hud_unit_multiplier = 1.0f; //Backslash
41 float Hud_speed_multiplier = 1.0f; //The E
42 
43 // Goober5000
45 
46 bool Hud_retail = true;
47 bool Scale_retail_gauges = true;
49 
50 int Hud_font = -1;
51 
52 //WARNING: If you add gauges to this array, make sure to bump num_default_gauges!
54 static int retail_gauges[] = {
97 };
98 
100  { "Messages", HUD_OBJECT_MESSAGES, 0},
101  { "Training messages", HUD_OBJECT_TRAINING_MESSAGES, 0},
102  { "Support", HUD_OBJECT_SUPPORT, 0},
103  { "Damage", HUD_OBJECT_DAMAGE, 0},
104  { "Wingman status", HUD_OBJECT_WINGMAN_STATUS, 0},
105  { "Auto speed", HUD_OBJECT_AUTO_SPEED, 0},
106  { "Auto target", HUD_OBJECT_AUTO_TARGET, 0},
107  { "Countermeasures", HUD_OBJECT_CMEASURES, 0},
108  { "Talking head", HUD_OBJECT_TALKING_HEAD, 0},
109  { "Directives", HUD_OBJECT_DIRECTIVES, 0},
110  { "Weapons", HUD_OBJECT_WEAPONS, 0},
111  { "Objective notifier", HUD_OBJECT_OBJ_NOTIFY, 0},
112  { "Comm menu", HUD_OBJECT_SQUAD_MSG, 0},
113  { "Lag indicator", HUD_OBJECT_LAG, 0},
114  { "Mini shield", HUD_OBJECT_MINI_SHIELD, 0},
115  { "Player shield", HUD_OBJECT_PLAYER_SHIELD, 0},
116  { "Target shield", HUD_OBJECT_TARGET_SHIELD, 0},
117  { "Escort list", HUD_OBJECT_ESCORT, 0},
118  { "Mission time", HUD_OBJECT_MISSION_TIME, 0},
119  { "Ets weapons", HUD_OBJECT_ETS_WEAPONS, 0},
120  { "Ets shields", HUD_OBJECT_ETS_SHIELDS, 0},
121  { "Ets engines", HUD_OBJECT_ETS_ENGINES, 0},
122  { "Target monitor", HUD_OBJECT_TARGET_MONITOR, 0},
123  { "Extra target data", HUD_OBJECT_EXTRA_TARGET_DATA, 0},
124  { "Radar", HUD_OBJECT_RADAR_STD, 0},
125  { "Radar orb", HUD_OBJECT_RADAR_ORB, 0},
126  { "Radar BSG", HUD_OBJECT_RADAR_BSG, 0},
127  { "Afterburner energy", HUD_OBJECT_AFTERBURNER, 0},
128  { "Weapon energy", HUD_OBJECT_WEAPON_ENERGY, 0},
129  { "Text warnings", HUD_OBJECT_TEXT_WARNINGS, 0},
130  { "Center reticle", HUD_OBJECT_CENTER_RETICLE, 0},
131  { "Throttle", HUD_OBJECT_THROTTLE, 0},
132  { "Threat indicator", HUD_OBJECT_THREAT, 0},
133  { "Lead indicator", HUD_OBJECT_LEAD, 0},
134  { "Lead sight", HUD_OBJECT_LEAD_SIGHT, 0},
135  { "Lock indicator", HUD_OBJECT_LOCK, 0},
136  { "Weapon linking", HUD_OBJECT_WEAPON_LINKING, 0},
137  { "Multiplayer messages", HUD_OBJECT_MULTI_MSG, 0},
138  { "Voice status", HUD_OBJECT_VOICE_STATUS, 0},
139  { "Ping", HUD_OBJECT_PING, 0},
140  { "Supernova", HUD_OBJECT_SUPERNOVA, 0},
141  { "Offscreen indicator", HUD_OBJECT_OFFSCREEN, 0},
142  { "Targeting brackets", HUD_OBJECT_BRACKETS, 0},
143  { "Orientation", HUD_OBJECT_ORIENTATION_TEE, 0},
144  { "Hostile direction", HUD_OBJECT_HOSTILE_TRI, 0},
145  { "Target direction", HUD_OBJECT_TARGET_TRI, 0},
146  { "Missile indicator", HUD_OBJECT_MISSILE_TRI, 0},
147  { "Kills", HUD_OBJECT_KILLS, 0},
148  { "Fixed messages", HUD_OBJECT_FIXED_MESSAGES, 0},
149  { "Ets retail", HUD_OBJECT_ETS_RETAIL, 0}
150 };
151 
153 
155 {
156  char shipname[NAME_LENGTH];
157  int ship_index;
158 
159  stuff_string(shipname, F_NAME, NAME_LENGTH);
160  ship_index = ship_info_lookup(shipname);
161 
162  return ship_index;
163 }
164 
166 {
167  int i;
168  char *saved_Mp = NULL;
169 
170  int colors[3] = {255, 255, 255};
171  color hud_color;
172  color ship_color;
173  color *hud_clr_p = NULL;
174  color *ship_clr_p = NULL;
175  bool scale_gauge = true;
176 
177  try
178  {
179  read_file_text(filename, CF_TYPE_TABLES);
180  reset_parse();
181 
182  if (optional_string("$Load Retail Configuration:")) {
184  }
185 
186  if (optional_string("$Color:")) {
187  stuff_int_list(colors, 3);
188 
189  check_color(colors);
190  gr_init_alphacolor(&hud_color, colors[0], colors[1], colors[2], 255);
191  hud_clr_p = &hud_color;
192  }
193 
194  if (optional_string("$Font:")) {
196  }
197 
198  if (optional_string("$Max Directives:")) {
200  }
201 
202  if (optional_string("$Max Escort Ships:")) {
204  }
205 
206  if (optional_string("$Length Unit Multiplier:")) {
208 
209  if (Hud_unit_multiplier <= 0.0f) {
210  Warning(LOCATION, "\"$Length Unit Multiplier:\" value of \"%f\" is invalid! Resetting to default.", Hud_unit_multiplier);
211  Hud_unit_multiplier = 1.0f;
212  }
213  }
214 
215  if (optional_string("$Speed Unit Multiplier:")) {
217 
218  if (Hud_speed_multiplier <= 0.0f) {
219  Warning(LOCATION, "\"$Speed Unit Multiplier:\" value of \"%f\" is invalid! Resetting to default.", Hud_speed_multiplier);
220  Hud_speed_multiplier = 1.0f;
221  }
222  }
223  else {
225  }
226 
227  if (optional_string("$Wireframe Targetbox:")) {
229  if ((Targetbox_wire < 0) || (Targetbox_wire > 3)) {
230  Targetbox_wire = 0;
231  }
232  }
233 
234  if (optional_string("$Targetbox Shader Effect:")) {
236  if (Targetbox_shader_effect < 0) {
238  }
239  }
240 
241  if (optional_string("$Lock Wireframe Mode:")) {
243  }
244 
245  if (optional_string("$Scale Gauges:")) {
246  stuff_boolean(&scale_gauge);
247  Scale_retail_gauges = scale_gauge;
248  }
249 
250  if (optional_string("$Force Scaling Above:")) {
252  }
253 
254  if (optional_string("$Reticle Style:")) {
255  int temp = required_string_either("FS1", "FS2");
256 
257  // using require_string_either won't advance the Mp pointer to the next token so force it instead
258  skip_to_start_of_string("#Gauge Config");
259 
260  if (temp < 0)
261  Warning(LOCATION, "Undefined reticle style in hud_gauges.tbl!");
262  else
264  }
265 
266  int base_res[2];
267  int force_scaling_above_res[2];
268  int ship_idx = -1;
269  int ship_font = -1;
270  int gauge_type = -1;
271  int use_font = -1;
272  color *use_clr_p = NULL;
273  SCP_vector<int> ship_classes;
274  bool retail_config = false;
275  int n_ships = 0;
276 
277  while (optional_string("#Gauge Config")) {
278  ship_classes.clear();
279  switch (optional_string_either("$Ship:", "$Ships:")) {
280  case 0:
281  mprintf(("$Ship in hud_gauges.tbl and -hdg.tbms is deprecated. Use \"$Ships: (\"Some ship class\") instead.\n"));
282 
283  if (!ships_inited) {
284  // just in case ship info has not been initialized.
285  skip_to_start_of_string("#Gauge Config");
286  continue;
287  }
288 
289  // get the ship number for this HUD configuration.
290  ship_idx = parse_ship_start();
291  ship_classes.push_back(ship_idx);
292 
293  if (ship_idx >= 0) {
294  Ship_info[ship_idx].hud_enabled = true;
295 
296  // see if we need to load defaults for this configuration
297  if (optional_string("$Load Retail Configuration:")) {
298  stuff_boolean(&Ship_info[ship_idx].hud_retail);
299  }
300 
301  if (optional_string("$Color:")) {
302  stuff_int_list(colors, 3);
303 
304  check_color(colors);
305  gr_init_alphacolor(&ship_color, colors[0], colors[1], colors[2], 255);
306  ship_clr_p = &ship_color;
307  }
308 
309  if (optional_string("$Font:")) {
310  stuff_int(&ship_font);
311  }
312  }
313  else {
314  // can't find ship class. move on.
315  ship_classes.push_back(-1);
316  skip_to_start_of_string("#Gauge Config");
317  //skip_to_start_of_string_either("#Gauge Config", "#End");
318  continue;
319  }
320  break;
321  case 1:
322  int shiparray[256];
323 
324  n_ships = stuff_int_list(shiparray, 256, SHIP_INFO_TYPE);
325 
326  if (optional_string("$Load Retail Configuration:")) {
327  stuff_boolean(&retail_config);
328  }
329 
330  for (i = 0; i < n_ships; ++i) {
331  ship_classes.push_back(shiparray[i]);
332  Ship_info[shiparray[i]].hud_enabled = true;
333  Ship_info[shiparray[i]].hud_retail = retail_config;
334  }
335 
336  if (optional_string("$Color:")) {
337  stuff_int_list(colors, 3);
338 
339  check_color(colors);
340  gr_init_alphacolor(&ship_color, colors[0], colors[1], colors[2], 255);
341  ship_clr_p = &ship_color;
342  }
343 
344  if (optional_string("$Font:")) {
345  stuff_int(&ship_font);
346  }
347  break;
348  default:
349  // No particular ship. -1 for default HUD configuration.
350  ship_classes.push_back(-1);
351  ship_font = -1;
352  ship_clr_p = NULL;
353  break;
354  }
355 
356  if (ship_clr_p != NULL) {
357  use_clr_p = ship_clr_p;
358  }
359  else {
360  use_clr_p = hud_clr_p;
361  }
362 
363  if (ship_font >= 0) {
364  use_font = ship_font;
365  }
366  else {
367  use_font = Hud_font;
368  }
369 
370  // Now start going through resolution info for this HUD layout
371  required_string("$Base:");
372 
373  // get the base width and height describing this HUD
374  stuff_int_list(base_res, 2, RAW_INTEGER_TYPE);
375 
376  // gauge scaling for this base res?
377  if (optional_string("$Scale Gauges:")) {
378  stuff_boolean(&scale_gauge);
379  }
380 
381  // maximum res at which scaling can be disabled
382  if (optional_string("$Force Scaling Above:")) {
383  stuff_int_list(force_scaling_above_res, 2);
384  } else {
385  memcpy(force_scaling_above_res, Force_scaling_above_res_global, sizeof(force_scaling_above_res));
386  }
387 
388  // Pruning time. Let's see if the current resolution defined by the user matches the conditions set by this entry
389  if (optional_string("$Required Aspect:")) {
390  // filter aspect ratio.
391  if (optional_string("Full Screen")) {
392  if( (float)gr_screen.center_w / (float)gr_screen.center_h > 1.5) {
393  skip_to_start_of_string("#Gauge Config");
394  //skip_to_start_of_string_either("#Gauge Config", "#End");
395  continue;
396  }
397  }
398  else if (optional_string("Wide Screen")) {
399  if( (float)gr_screen.center_w / (float)gr_screen.center_h <= 1.5) {
400  skip_to_start_of_string("#Gauge Config");
401  //skip_to_start_of_string_either("#Gauge Config", "#End");
402  continue;
403  }
404  }
405  }
406 
407  // check minimum resolution
408  if (optional_string("$Min:")) {
409  int min_res[2];
410  stuff_int_list(min_res, 2, RAW_INTEGER_TYPE);
411 
412  if (min_res[0] > gr_screen.max_w) {
413  skip_to_start_of_string("#Gauge Config");
414  continue;
415  }
416  else if (min_res[0] == gr_screen.center_w) {
417  if (min_res[1] > gr_screen.center_h) {
418  skip_to_start_of_string("#Gauge Config");
419  continue;
420  }
421  }
422  }
423 
424  // check maximum resolution
425  if (optional_string("$Max:")) {
426  int max_res[2];
427  stuff_int_list(max_res, 2, RAW_INTEGER_TYPE);
428 
429  if (max_res[0] < gr_screen.max_w) {
430  skip_to_start_of_string("#Gauge Config");
431  continue;
432  }
433  else if (max_res[0] == gr_screen.center_w) {
434  if (max_res[1] < gr_screen.center_h) {
435  skip_to_start_of_string("#Gauge Config");
436  continue;
437  }
438  }
439  }
440 
441  // let's start parsing for gauges.
442  required_string("$Gauges:");
443 
444  while (!check_for_string("$Gauges:") && !check_for_string("$End Gauges")) {
445  // find out what type of gauge we're parsing.
446  gauge_type = parse_gauge_type();
447 
448  // change some of the default gauge settings to the appropriate values.
449  gauge_settings settings;
450  settings.font_num = use_font;
451  settings.scale_gauge = scale_gauge;
452  memcpy(settings.force_scaling_above_res, force_scaling_above_res, sizeof(settings.force_scaling_above_res));
453  settings.ship_idx = &ship_classes;
454  settings.use_clr = use_clr_p;
455 
456  // if "default" is specified, then the base resolution is {-1, -1},
457  // indicating GR_640 or GR_1024 to the handlers. otherwise, change it
458  // to the given base resolution.
459  if (!optional_string("default")) {
460  memcpy(settings.base_res, base_res, sizeof(settings.base_res));
461  }
462 
463  // then call the specific gauge load handler function for this gauge type.
464  load_gauge(gauge_type, &settings);
465 
466  if (saved_Mp && (saved_Mp == Mp)) {
467  Mp++;
468  }
469 
471  // stolened from AI_profiles
472  // if we've been through once already and are at the same place, force a move
473 
474  saved_Mp = Mp;
475  }
476 
477  required_string("$End Gauges");
478  required_string("#End");
479  }
480  }
481  catch (const parse::ParseException& e)
482  {
483  mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", filename, e.what()));
484  return;
485  }
486 }
487 
489 {
490  if(!ships_inited)
491  {
492  Error(LOCATION, "Could not initialize hudparse.cpp as ships were not inited first.");
493  return;
494  }
495 
496  default_hud_gauges.clear();
497 
498  if (cf_exists_full("hud_gauges.tbl", CF_TYPE_TABLES))
499  parse_hud_gauges_tbl("hud_gauges.tbl");
500 
502 
503  // load missing retail gauges for the default and ship-specific HUDs
505 
506 }
507 
509 {
510  bool retail_gauge_loaded = false;
511 
512  // load missing retail gauges for the retail HUD if needed
513  if(Hud_retail) {
514  int num_loaded_gauges = (int)default_hud_gauges.size();
515 
516  for(int i = 0; i < num_default_gauges; i++) {
517  retail_gauge_loaded = false;
518 
519  for(int j = 0; j < num_loaded_gauges; j++) {
520  if(retail_gauges[i] == default_hud_gauges[j]->getObjectType()) {
521  retail_gauge_loaded = true;
522  break;
523  }
524  }
525 
526  if(!retail_gauge_loaded) {
527  gauge_settings settings;
528  load_gauge(retail_gauges[i], &settings);
529  }
530  }
531 
532  // if we're missing a radar gauge, load either orb or standard
533  retail_gauge_loaded = false;
534  for(int j = 0; j < num_loaded_gauges; j++) {
535  if(HUD_OBJECT_RADAR_STD == default_hud_gauges[j]->getObjectType() ||
536  HUD_OBJECT_RADAR_ORB == default_hud_gauges[j]->getObjectType() ||
537  HUD_OBJECT_RADAR_BSG == default_hud_gauges[j]->getObjectType()) {
538  retail_gauge_loaded = true;
539  }
540  }
541 
542  // load radar gauge if not loaded.
543  if(!retail_gauge_loaded) {
544  gauge_settings settings;
546  }
547 
548  // Throw in the weapon linking reticle gauge if using FS1 defaults
549  retail_gauge_loaded = false;
551  for(int j = 0; j < num_loaded_gauges; j++) {
552  if(HUD_OBJECT_WEAPON_LINKING == default_hud_gauges[j]->getObjectType()) {
553  retail_gauge_loaded = true;
554  }
555  }
556 
557  if(!retail_gauge_loaded) {
558  gauge_settings settings;
560  }
561  }
562  }
563 
564  // for each ship class, check if their specific HUD config is enabled
565  int k = 0;
566  for (auto it = Ship_info.cbegin(); it != Ship_info.cend(); k++, ++it) {
567  SCP_vector<int> sindex;
568  sindex.push_back(k);
569  if(it->hud_enabled && it->hud_retail) {
570  int num_loaded_gauges = (int)it->hud_gauges.size();
571 
572  for(int i = 0; i < num_default_gauges; i++) {
573  for(int j = 0; j < num_loaded_gauges; j++) {
574  if(retail_gauges[i] == it->hud_gauges[j]->getObjectType()) {
575  retail_gauge_loaded = true;
576  }
577  }
578 
579  if(!retail_gauge_loaded) {
580  gauge_settings settings;
581  settings.ship_idx = &sindex;
582  load_gauge(retail_gauges[i], &settings);
583  }
584  }
585 
586  // if we're missing a radar gauge, load either orb or standard
587  retail_gauge_loaded = false;
588  for(int j = 0; j < num_loaded_gauges; j++) {
589  if(HUD_OBJECT_RADAR_ORB == it->hud_gauges[j]->getObjectType() ||
590  HUD_OBJECT_RADAR_STD == it->hud_gauges[j]->getObjectType() ||
591  HUD_OBJECT_RADAR_BSG == it->hud_gauges[j]->getObjectType()) {
592  retail_gauge_loaded = true;
593  }
594  }
595 
596  // load radar gauge if not loaded.
597  if(!retail_gauge_loaded) {
598  gauge_settings settings;
599  settings.ship_idx = &sindex;
601  }
602 
603  // Throw in the weapon linking reticle gauge if using FS1 defaults
604  retail_gauge_loaded = false;
606  for(int j = 0; j < num_loaded_gauges; j++) {
607  if(HUD_OBJECT_WEAPON_LINKING == it->hud_gauges[j]->getObjectType()) {
608  retail_gauge_loaded = true;
609  }
610  }
611 
612  if(!retail_gauge_loaded) {
613  gauge_settings settings;
614  settings.ship_idx = &sindex;
616  }
617  }
618  }
619  }
620 }
621 
622 // Called once after mission load is complete. Sets initial gauge activity states.
623 void init_hud() {
624  int i, num_gauges, config_type;
625 
626  if(Ship_info[Player_ship->ship_info_index].hud_gauges.size() > 0) {
627  num_gauges = Ship_info[Player_ship->ship_info_index].hud_gauges.size();
628 
629  for(i = 0; i < num_gauges; i++) {
630  config_type = Ship_info[Player_ship->ship_info_index].hud_gauges[i]->getConfigType();
631 
632  if ( !Ship_info[Player_ship->ship_info_index].hud_gauges[i]->isOffbyDefault() && hud_config_show_flag_is_set(config_type) )
633  Ship_info[Player_ship->ship_info_index].hud_gauges[i]->updateActive(true);
634  else
635  Ship_info[Player_ship->ship_info_index].hud_gauges[i]->updateActive(false);
636 
637  Ship_info[Player_ship->ship_info_index].hud_gauges[i]->updatePopUp(hud_config_popup_flag_is_set(config_type) ? true : false);
638  Ship_info[Player_ship->ship_info_index].hud_gauges[i]->updateColor(
639  HUD_config.clr[config_type].red,
640  HUD_config.clr[config_type].green,
641  HUD_config.clr[config_type].blue,
642  HUD_config.clr[config_type].alpha
643  );
644  }
645  } else {
646  num_gauges = default_hud_gauges.size();
647 
648  for(i = 0; i < num_gauges; i++) {
649  config_type = default_hud_gauges[i]->getConfigType();
650 
651  if ( !default_hud_gauges[i]->isOffbyDefault() && hud_config_show_flag_is_set(config_type) )
652  default_hud_gauges[i]->updateActive(true);
653  else
654  default_hud_gauges[i]->updateActive(false);
655 
656  default_hud_gauges[i]->updatePopUp(hud_config_popup_flag_is_set(config_type) ? true : false);
657  default_hud_gauges[i]->updateColor(
658  HUD_config.clr[config_type].red,
659  HUD_config.clr[config_type].green,
660  HUD_config.clr[config_type].blue,
661  HUD_config.clr[config_type].alpha
662  );
663  }
664  }
665 }
666 
667 extern void hud_init_ballistic_index();
668 
670 {
671  int i, num_gauges, config_type;
672 
673  // before we load any hud gauges, see whether we're carring a ballistic weapon (Mantis #2962)
675 
676  // go through all HUD gauges. Load gauge properties defined in the HUD config if gauge is not customized.
677  if(Ship_info[Player_ship->ship_info_index].hud_gauges.size() > 0) {
678  num_gauges = Ship_info[Player_ship->ship_info_index].hud_gauges.size();
679 
680  for(i = 0; i < num_gauges; i++) {
681  HudGauge* hgp = Ship_info[Player_ship->ship_info_index].hud_gauges[i];
682  config_type = hgp->getConfigType();
683 
684  if ( ( (!hgp->isOffbyDefault() || hgp->isActive()) && hud_config_show_flag_is_set(config_type)) )
685  hgp->updateActive(true);
686  else
687  hgp->updateActive(false);
688 
689  //hgp->updateActive(hud_config_show_flag_is_set(config_type) ? true : false);
690  hgp->updatePopUp(hud_config_popup_flag_is_set(config_type) ? true : false);
691  hgp->updateColor(
692  HUD_config.clr[config_type].red,
693  HUD_config.clr[config_type].green,
694  HUD_config.clr[config_type].blue,
695  HUD_config.clr[config_type].alpha
696  );
697  }
698  } else {
699  num_gauges = default_hud_gauges.size();
700 
701  for(i = 0; i < num_gauges; i++) {
702  config_type = default_hud_gauges[i]->getConfigType();
703 
704  if ( ( (!default_hud_gauges[i]->isOffbyDefault() || default_hud_gauges[i]->isActive()) && hud_config_show_flag_is_set(config_type)) )
705  default_hud_gauges[i]->updateActive(true);
706  else
707  default_hud_gauges[i]->updateActive(false);
708 
709  //default_hud_gauges[i]->updateActive(hud_config_show_flag_is_set(config_type) ? true : false);
710  default_hud_gauges[i]->updatePopUp(hud_config_popup_flag_is_set(config_type) ? true : false);
711  default_hud_gauges[i]->updateColor(
712  HUD_config.clr[config_type].red,
713  HUD_config.clr[config_type].green,
714  HUD_config.clr[config_type].blue,
715  HUD_config.clr[config_type].alpha
716  );
717  }
718  }
719 }
720 
722 {
723  // probably a more elegant way to do this.
724  // Likely involving a for loop, an array of strings and only one if statement with a strcmp.
725  if(optional_string("+Custom:"))
726  return HUD_OBJECT_CUSTOM;
727 
728  if(optional_string("+Messages:"))
729  return HUD_OBJECT_MESSAGES;
730 
731  if(optional_string("+Training Messages:"))
733 
734  if(optional_string("+Support:"))
735  return HUD_OBJECT_SUPPORT;
736 
737  if(optional_string("+Damage:"))
738  return HUD_OBJECT_DAMAGE;
739 
740  if(optional_string("+Wingman Status:"))
742 
743  if(optional_string("+Auto Speed:"))
744  return HUD_OBJECT_AUTO_SPEED;
745 
746  if(optional_string("+Auto Target:"))
747  return HUD_OBJECT_AUTO_TARGET;
748 
749  if(optional_string("+Countermeasures:"))
750  return HUD_OBJECT_CMEASURES;
751 
752  if(optional_string("+Talking Head:"))
754 
755  if(optional_string("+Directives:"))
756  return HUD_OBJECT_DIRECTIVES;
757 
758  if(optional_string("+Weapons:"))
759  return HUD_OBJECT_WEAPONS;
760 
761  if(optional_string("+Objective Notify:"))
762  return HUD_OBJECT_OBJ_NOTIFY;
763 
764  if(optional_string("+Squad Message:"))
765  return HUD_OBJECT_SQUAD_MSG;
766 
767  if(optional_string("+Lag:"))
768  return HUD_OBJECT_LAG;
769 
770  if(optional_string("+Mini Target Shields:"))
771  return HUD_OBJECT_MINI_SHIELD;
772 
773  if(optional_string("+Player Shields:"))
775 
776  if(optional_string("+Target Shields:"))
778 
779  if(optional_string("+Escort View:"))
780  return HUD_OBJECT_ESCORT;
781 
782  if(optional_string("+Mission Time:"))
784 
785  if(optional_string("+ETS Weapons:"))
786  return HUD_OBJECT_ETS_WEAPONS;
787 
788  if(optional_string("+ETS Shields:"))
789  return HUD_OBJECT_ETS_SHIELDS;
790 
791  if(optional_string("+ETS Engines:"))
792  return HUD_OBJECT_ETS_ENGINES;
793 
794  if(optional_string("+ETS Retail:"))
795  return HUD_OBJECT_ETS_RETAIL;
796 
797  if(optional_string("+Target Monitor:"))
799 
800  if(optional_string("+Extra Target Data:"))
802 
803  if(optional_string("+Radar:")) {
804  if(Cmdline_orb_radar) {
805  return HUD_OBJECT_RADAR_ORB;
806  } else {
807  return HUD_OBJECT_RADAR_STD;
808  }
809  }
810 
811  if(optional_string("+Radar Orb:"))
812  return HUD_OBJECT_RADAR_ORB;
813 
814  if(optional_string("+Radar BSG:"))
815  return HUD_OBJECT_RADAR_BSG;
816 
817  if(optional_string("+Afterburner Energy:"))
818  return HUD_OBJECT_AFTERBURNER;
819 
820  if(optional_string("+Weapon Energy:"))
822 
823  if(optional_string("+Text Warnings:"))
825 
826  if(optional_string("+Center Reticle:"))
828 
829  if(optional_string("+Throttle:"))
830  return HUD_OBJECT_THROTTLE;
831 
832  if(optional_string("+Threat Indicator:"))
833  return HUD_OBJECT_THREAT;
834 
835  if(optional_string("+Lead Indicator:"))
836  return HUD_OBJECT_LEAD;
837 
838  if(optional_string("+Lead Sight:"))
839  return HUD_OBJECT_LEAD_SIGHT;
840 
841  if(optional_string("+Lock Indicator:"))
842  return HUD_OBJECT_LOCK;
843 
844  if(optional_string("+Weapon Linking:"))
846 
847  if(optional_string("+Multiplayer Messages:"))
848  return HUD_OBJECT_MULTI_MSG;
849 
850  if(optional_string("+Voice Status:"))
852 
853  if(optional_string("+Ping:"))
854  return HUD_OBJECT_PING;
855 
856  if(optional_string("+Supernova:"))
857  return HUD_OBJECT_SUPERNOVA;
858 
859  if(optional_string("+Orientation Tee:"))
861 
862  if(optional_string("+Offscreen Indicator:"))
863  return HUD_OBJECT_OFFSCREEN;
864 
865  if(optional_string("+Target Brackets:"))
866  return HUD_OBJECT_BRACKETS;
867 
868  if(optional_string("+Hostile Triangle:"))
869  return HUD_OBJECT_HOSTILE_TRI;
870 
871  if(optional_string("+Target Triangle:"))
872  return HUD_OBJECT_TARGET_TRI;
873 
874  if(optional_string("+Missile Triangles:"))
875  return HUD_OBJECT_MISSILE_TRI;
876 
877  if(optional_string("+Kills:"))
878  return HUD_OBJECT_KILLS;
879 
880  if(optional_string("+Fixed Messages:"))
882 
883  if(optional_string("+Flight Path Marker:"))
884  return HUD_OBJECT_FLIGHT_PATH;
885 
886  if ( optional_string("+Warhead Count:") )
888 
889  if ( optional_string("+Hardpoints:") )
890  return HUD_OBJECT_HARDPOINTS;
891 
892  if ( optional_string("+Primary Weapons:") )
894 
895  if ( optional_string("+Secondary Weapons:") )
897 
898  error_display(1, "Invalid gauge type [%.32s]", next_tokens());
899 
900  return -1;
901 }
902 
903 void load_gauge(int gauge, gauge_settings* settings)
904 {
905  SCP_vector<int> ship_index;
906  ship_index.push_back(-1);
907  if (settings->ship_idx == NULL) {
908  settings->ship_idx = &ship_index;
909  }
910  switch(gauge) {
911  case HUD_OBJECT_CUSTOM:
912  load_gauge_custom(settings);
913  break;
914  case HUD_OBJECT_MESSAGES:
915  load_gauge_messages(settings);
916  break;
919  break;
920  case HUD_OBJECT_SUPPORT:
921  load_gauge_support(settings);
922  break;
923  case HUD_OBJECT_DAMAGE:
924  load_gauge_damage(settings);
925  break;
927  load_gauge_wingman_status(settings);
928  break;
930  load_gauge_auto_speed(settings);
931  break;
933  load_gauge_auto_target(settings);
934  break;
936  load_gauge_countermeasures(settings);
937  break;
939  load_gauge_talking_head(settings);
940  break;
942  load_gauge_directives(settings);
943  break;
944  case HUD_OBJECT_WEAPONS:
945  load_gauge_weapons(settings);
946  break;
948  load_gauge_objective_notify(settings);
949  break;
951  load_gauge_squad_message(settings);
952  break;
953  case HUD_OBJECT_LAG:
954  load_gauge_lag(settings);
955  break;
957  load_gauge_mini_shields(settings);
958  break;
960  load_gauge_player_shields(settings);
961  break;
963  load_gauge_target_shields(settings);
964  break;
965  case HUD_OBJECT_ESCORT:
966  load_gauge_escort_view(settings);
967  break;
969  load_gauge_mission_time(settings);
970  break;
972  load_gauge_ets_weapons(settings);
973  break;
975  load_gauge_ets_shields(settings);
976  break;
978  load_gauge_ets_engines(settings);
979  break;
981  load_gauge_ets_retail(settings);
982  break;
984  load_gauge_target_monitor(settings);
985  break;
988  break;
990  load_gauge_radar_std(settings);
991  break;
993  load_gauge_radar_orb(settings);
994  break;
996  load_gauge_radar_dradis(settings);
997  break;
999  load_gauge_afterburner(settings);
1000  break;
1002  load_gauge_weapon_energy(settings);
1003  break;
1005  load_gauge_text_warnings(settings);
1006  break;
1008  load_gauge_center_reticle(settings);
1009  break;
1010  case HUD_OBJECT_THROTTLE:
1011  load_gauge_throttle(settings);
1012  break;
1013  case HUD_OBJECT_THREAT:
1014  load_gauge_threat_indicator(settings);
1015  break;
1016  case HUD_OBJECT_LEAD:
1017  load_gauge_lead(settings);
1018  break;
1019  case HUD_OBJECT_LEAD_SIGHT:
1020  load_gauge_lead_sight(settings);
1021  break;
1022  case HUD_OBJECT_LOCK:
1023  load_gauge_lock(settings);
1024  break;
1026  load_gauge_weapon_linking(settings);
1027  break;
1028  case HUD_OBJECT_MULTI_MSG:
1029  load_gauge_multi_msg(settings);
1030  break;
1032  load_gauge_voice_status(settings);
1033  break;
1034  case HUD_OBJECT_PING:
1035  load_gauge_ping(settings);
1036  break;
1037  case HUD_OBJECT_SUPERNOVA:
1038  load_gauge_supernova(settings);
1039  break;
1040  case HUD_OBJECT_OFFSCREEN:
1041  load_gauge_offscreen(settings);
1042  break;
1043  case HUD_OBJECT_BRACKETS:
1044  load_gauge_brackets(settings);
1045  break;
1047  load_gauge_orientation_tee(settings);
1048  break;
1050  load_gauge_hostile_tri(settings);
1051  break;
1052  case HUD_OBJECT_TARGET_TRI:
1053  load_gauge_target_tri(settings);
1054  break;
1056  load_gauge_missile_tri(settings);
1057  break;
1058  case HUD_OBJECT_KILLS:
1059  load_gauge_kills(settings);
1060  break;
1062  load_gauge_fixed_messages(settings);
1063  break;
1065  load_gauge_flight_path(settings);
1066  break;
1068  load_gauge_warhead_count(settings);
1069  break;
1070  case HUD_OBJECT_HARDPOINTS:
1071  load_gauge_hardpoints(settings);
1072  break;
1074  load_gauge_primary_weapons(settings);
1075  break;
1077  load_gauge_secondary_weapons(settings);
1078  break;
1079  default:
1080  // It's either -1, indicating we're ignoring a parse error, or it's a coding error.
1081  Assertion(gauge == -1, "Invalid value '%d' passed to load_gauge(); get a coder!\n", gauge);
1082  break;
1083  }
1084 }
1085 
1086 inline bool check_base_res(int *res)
1087 {
1088  return (res[0] >= 640) && (res[1] >= 480);
1089 }
1090 
1091 void check_color(int *colorp)
1092 {
1093  int i;
1094 
1095  for ( i = 0; i < 3; ++i ) {
1096  if ( colorp[i] > 255 ) {
1097  colorp[i] = 255;
1098  } else if ( colorp[i] < 0 ) {
1099  colorp[i] = 0;
1100  }
1101  }
1102 }
1103 
1104 void adjust_base_res(int *base_res, int *force_scaling_above_res, bool scaling = true)
1105 {
1106  // Don't scale gauge if:
1107  // no scaling is set and current res is between base res and "force scaling above res"
1108  // Avoid HUD blurring caused solely by rounding errors
1109  if ((!scaling && gr_screen.center_w >= base_res[0] && gr_screen.center_h >= base_res[1] &&
1110  (force_scaling_above_res[0] <= 0 || force_scaling_above_res[1] <= 0 ||
1111  gr_screen.center_w <= force_scaling_above_res[0] || gr_screen.center_h <= force_scaling_above_res[1])) ||
1112  (gr_screen.center_w >= base_res[0] && gr_screen.center_h == base_res[1]) ||
1113  (gr_screen.center_w == base_res[0] && gr_screen.center_h >= base_res[1])) {
1114  base_res[0] = gr_screen.center_w;
1115  base_res[1] = gr_screen.center_h;
1116  return;
1117  }
1118 
1119  if (!scaling && force_scaling_above_res[0] > base_res[0] && force_scaling_above_res[1] > base_res[1] &&
1120  gr_screen.center_w > force_scaling_above_res[0] && gr_screen.center_h > force_scaling_above_res[1]) {
1121  base_res[0] = force_scaling_above_res[0];
1122  base_res[1] = force_scaling_above_res[1];
1123  }
1124 
1125  float aspect_quotient = ((float)gr_screen.center_w / (float)gr_screen.center_h) / ((float)base_res[0] / (float)base_res[1]);
1126  if (aspect_quotient >= 1.0) {
1127  base_res[0] = (int)(base_res[0] * aspect_quotient);
1128  } else {
1129  base_res[1] = (int)(base_res[1] / aspect_quotient);
1130  }
1131 }
1132 
1133 void adjust_for_multimonitor(int *base_res, bool set_position, int *coords)
1134 {
1135  float scale_w = (float)gr_screen.center_w / (float)base_res[0];
1136  float scale_h = (float)gr_screen.center_h / (float)base_res[1];
1137 
1138  base_res[0] = fl2ir(base_res[0] * ((float)gr_screen.max_w / (float)gr_screen.center_w));
1139  base_res[1] = fl2ir(base_res[1] * ((float)gr_screen.max_h / (float)gr_screen.center_h));
1140 
1141  if (set_position) {
1142  coords[0] += fl2ir(gr_screen.center_offset_x / scale_w);
1143  coords[1] += fl2ir(gr_screen.center_offset_y / scale_h);
1144  }
1145 }
1146 
1147 template<class T>
1148 T* gauge_load_common(gauge_settings* settings, T* preAllocated = NULL)
1149 {
1150  int colors[3] = {255, 255, 255};
1151  bool lock_color = false;
1152 
1153  // render to texture parameters
1154  char display_name[MAX_FILENAME_LEN] = "";
1155  int display_size[2] = {0, 0};
1156  int display_offset[2] = {0, 0};
1157  int canvas_size[2] = {0, 0};
1158 
1159  if(check_base_res(settings->base_res)) {
1160  if (settings->set_position) {
1161  if(optional_string("Position:")) {
1162  stuff_int_list(settings->coords, 2);
1163  settings->use_coords = true;
1164  } else {
1165  if(optional_string("Scale Gauge:")) {
1166  stuff_boolean(&settings->scale_gauge);;
1167  }
1168 
1169  if(optional_string("Force Scaling Above:")) {
1171  }
1172 
1173  adjust_base_res(settings->base_res, settings->force_scaling_above_res, settings->scale_gauge);
1174 
1175  // If no positioning information is specified, use the default position
1176  bool use_default_pos = true;
1177 
1178  if(optional_string("Origin:")) {
1179  stuff_float_list(settings->origin, 2);
1180  use_default_pos = false;
1181 
1182  required_string("Offset:");
1183  stuff_int_list(settings->offset, 2);
1184  }
1185 
1186  if(optional_string("Offset:")) {
1187  Error(LOCATION, "HUD gauges table: Offset must also have Origin defined");
1188  }
1189 
1190  if ( !(settings->use_coords && use_default_pos) ) {
1191  settings->coords[0] = (int)(settings->base_res[0] * settings->origin[0]) + settings->offset[0];
1192  settings->coords[1] = (int)(settings->base_res[1] * settings->origin[1]) + settings->offset[1];
1193  settings->use_coords = true;
1194  }
1195  }
1196  } else {
1197  adjust_base_res(settings->base_res, settings->force_scaling_above_res, settings->scale_gauge);
1198  }
1199  } else {
1200  if(gr_screen.res == GR_640) {
1201  settings->base_res[0] = 640;
1202  settings->base_res[1] = 480;
1203  } else {
1204  settings->base_res[0] = 1024;
1205  settings->base_res[1] = 768;
1206  }
1207 
1208  adjust_base_res(settings->base_res, settings->force_scaling_above_res, settings->scale_gauge);
1209 
1210  if (settings->set_position && !settings->use_coords) {
1211  settings->coords[0] = (int)(settings->base_res[0] * settings->origin[0]) + settings->offset[0];
1212  settings->coords[1] = (int)(settings->base_res[1] * settings->origin[1]) + settings->offset[1];
1213  settings->use_coords = true;
1214  }
1215  }
1216 
1217  if (settings->set_position) {
1218  if ( optional_string("Cockpit Target:") && settings->ship_idx->at(0) >= 0 ) {
1219  stuff_string(display_name, F_NAME, MAX_FILENAME_LEN);
1220 
1221  if ( optional_string("Canvas Size:") ) {
1222  stuff_int_list(canvas_size, 2);
1223  }
1224 
1225  if ( optional_string("Display Offset:") ) {
1226  stuff_int_list(display_offset, 2);
1227  }
1228 
1229  required_string("Display Size:");
1230  stuff_int_list(display_size, 2);
1231  } else {
1232  // adjust for multimonitor setups ONLY if not rendering gauge to a texture
1233  adjust_for_multimonitor(settings->base_res, true, settings->coords);
1234  }
1235  } else {
1236  adjust_for_multimonitor(settings->base_res, true, settings->coords);
1237  }
1238 
1239  if (settings->set_colour) {
1240  if ( settings->use_clr != NULL ) {
1241  colors[0] = settings->use_clr->red;
1242  colors[1] = settings->use_clr->green;
1243  colors[2] = settings->use_clr->blue;
1244 
1245  lock_color = true;
1246  } else if ( optional_string("Color:") ) {
1247  stuff_int_list(colors, 3);
1248 
1249  check_color(colors);
1250 
1251  lock_color = true;
1252  }
1253  }
1254 
1255  if(optional_string("Font:")) {
1256  stuff_int(&settings->font_num);
1257  } else {
1258  if ( settings->font_num < 0 ) {
1259  settings->font_num = FONT1;
1260  }
1261  }
1262 
1263  if (settings->set_position) {
1264  if(optional_string("Slew:")) {
1265  stuff_boolean(&settings->slew);
1266  }
1267  }
1268 
1269  T* instance = preAllocated;
1270 
1271  if (instance == NULL)
1272  {
1273  instance = new T();
1274  }
1275 
1276  instance->initBaseResolution(settings->base_res[0], settings->base_res[1]);
1277  instance->initFont(settings->font_num);
1278  if (settings->set_position) {
1279  instance->initPosition(settings->coords[0], settings->coords[1]);
1280  instance->initSlew(settings->slew);
1281  instance->initCockpitTarget(display_name, display_offset[0], display_offset[1], display_size[0], display_size[1], canvas_size[0], canvas_size[1]);
1282  }
1283  if (settings->set_colour) {
1284  instance->updateColor(colors[0], colors[1], colors[2]);
1285  instance->lockConfigColor(lock_color);
1286  }
1287 
1288  return instance;
1289 }
1290 
1292 {
1293  int i;
1294  char gauge_string[MAX_FILENAME_LEN];
1295  char name[MAX_FILENAME_LEN];
1296  char text[MAX_FILENAME_LEN];
1297  char filename[MAX_FILENAME_LEN];
1298  int gauge_type = HUD_CENTER_RETICLE;
1299  bool active_by_default = true;
1300  int txtoffset_x = 0, txtoffset_y = 0;
1301  ubyte r = 255, g = 255, b = 255;
1302  int colors[3] = {255, 255, 255};
1303  bool lock_color = false;
1304 
1305  // render to texture parameters
1306  char display_name[MAX_FILENAME_LEN] = "";
1307  int display_size[2] = {0, 0};
1308  int display_offset[2] = {0, 0};
1309  int canvas_size[2] = {0, 0};
1310 
1311  if(check_base_res(settings->base_res)) {
1312  if(optional_string("Position:")) {
1313  stuff_int_list(settings->coords, 2);
1314  settings->use_coords = true;
1315  } else {
1316  if(optional_string("Scale Gauge:")) {
1317  stuff_boolean(&settings->scale_gauge);;
1318  }
1319 
1320  if(optional_string("Force Scaling Above:")) {
1322  }
1323 
1324  adjust_base_res(settings->base_res, settings->force_scaling_above_res, settings->scale_gauge);
1325 
1326  // If no positioning information is specified, use the default position
1327  bool use_default_pos = true;
1328 
1329  if(optional_string("Origin:")) {
1330  stuff_float_list(settings->origin, 2);
1331  use_default_pos = false;
1332 
1333  required_string("Offset:");
1334  stuff_int_list(settings->offset, 2);
1335  }
1336 
1337  if(optional_string("Offset:")) {
1338  Error(LOCATION, "HUD gauges table: Offset must also have Origin defined");
1339  }
1340 
1341  if (!use_default_pos) {
1342  settings->coords[0] = (int)(settings->base_res[0] * settings->origin[0]) + settings->offset[0];
1343  settings->coords[1] = (int)(settings->base_res[1] * settings->origin[1]) + settings->offset[1];
1344  settings->use_coords = true;
1345  }
1346  }
1347 
1348  if ( optional_string("Cockpit Target:") && settings->ship_idx->at(0) >= 0 ) {
1349  stuff_string(display_name, F_NAME, MAX_FILENAME_LEN);
1350 
1351  if ( optional_string("Canvas Size:") ) {
1352  stuff_int_list(canvas_size, 2);
1353  }
1354 
1355  if ( optional_string("Display Offset:") ) {
1356  stuff_int_list(display_offset, 2);
1357  }
1358 
1359  required_string("Display Size:");
1360  stuff_int_list(display_size, 2);
1361  } else {
1362  // adjust for multimonitor setups ONLY if not rendering gauge to a texture
1363  adjust_for_multimonitor(settings->base_res, true, settings->coords);
1364  }
1365 
1366  if ( settings->use_clr != NULL ) {
1367  colors[0] = settings->use_clr->red;
1368  colors[1] = settings->use_clr->green;
1369  colors[2] = settings->use_clr->blue;
1370 
1371  lock_color = true;
1372  } else if ( optional_string("Color:") ) {
1373  stuff_int_list(colors, 3);
1374 
1375  check_color(colors);
1376 
1377  lock_color = true;
1378  }
1379 
1380  if ( optional_string("Font:") ) {
1381  stuff_int(&settings->font_num);
1382  } else {
1383  if ( settings->font_num < 0 ) {
1384  settings->font_num = FONT1;
1385  }
1386  }
1387 
1388  required_string("Name:");
1390 
1391  required_string("Text:");
1393 
1394  if (optional_string("X Offset:")) {
1395  stuff_int(&txtoffset_x);
1396  }
1397 
1398  if (optional_string("Y Offset:")) {
1399  stuff_int(&txtoffset_y);
1400  }
1401 
1402  required_string("Gauge Type:");
1403  stuff_string(gauge_string, F_NAME, MAX_FILENAME_LEN);
1404 
1405  for(i = 0; i < NUM_HUD_GAUGES; i++) {
1406  if(!strcmp(HUD_gauge_text[i], gauge_string)) {
1407  gauge_type = i;
1408  break;
1409  }
1410  }
1411 
1412  if(optional_string("Slew:")) {
1413  stuff_boolean(&settings->slew);
1414  }
1415 
1416  if(optional_string("Active by default:")) {
1417  stuff_boolean(&active_by_default);
1418  }
1419 
1420  required_string("Filename:");
1421  stuff_string(filename, F_NAME, MAX_FILENAME_LEN);
1422  } else {
1423  settings->base_res[0] = 640;
1424  settings->base_res[1] = 480;
1425 
1426  if ( settings->font_num < 0 ) {
1427  settings->font_num = FONT1;
1428  }
1429  }
1430 
1431  HudGauge* hud_gauge = new HudGauge(gauge_type, settings->slew, r, g, b, name, text, filename, txtoffset_x, txtoffset_y);
1432  hud_gauge->initBaseResolution(settings->base_res[0], settings->base_res[1]);
1433  hud_gauge->initPosition(settings->coords[0], settings->coords[1]);
1434  hud_gauge->initFont(settings->font_num);
1435  hud_gauge->initRenderStatus(active_by_default);
1436  hud_gauge->updateColor(colors[0], colors[1], colors[2]);
1437  hud_gauge->lockConfigColor(lock_color);
1438  hud_gauge->initCockpitTarget(display_name, display_offset[0], display_offset[1], display_size[0], display_size[1], canvas_size[0], canvas_size[1]);
1439 
1440  if(settings->ship_idx->at(0) >= 0) {
1441  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
1442  HudGauge* instance = new HudGauge();
1443  *instance = *hud_gauge;
1444  Ship_info[*ship_index].hud_gauges.push_back(instance);
1445  }
1446  delete hud_gauge;
1447  } else {
1448  default_hud_gauges.push_back(hud_gauge);
1449  }
1450 }
1451 
1453 {
1454  char fname[MAX_FILENAME_LEN] = "netlag1";
1455 
1456  settings->origin[0] = 0.5f;
1457  settings->origin[1] = 0.5f;
1458 
1459  if(gr_screen.res == GR_640) {
1460  settings->offset[0] = 66;
1461  settings->offset[1] = 91;
1462  } else {
1463  settings->offset[0] = 115;
1464  settings->offset[1] = 145;
1465  }
1466 
1467  HudGaugeLag* hud_gauge = gauge_load_common<HudGaugeLag>(settings);
1468 
1469  if(optional_string("Filename:")) {
1471  }
1472 
1473  hud_gauge->initBitmaps(fname);
1474 
1475  if(settings->ship_idx->at(0) >= 0) {
1476  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
1477  HudGaugeLag* instance = new HudGaugeLag();
1478  *instance = *hud_gauge;
1479  Ship_info[*ship_index].hud_gauges.push_back(instance);
1480  }
1481  delete hud_gauge;
1482  } else {
1483  default_hud_gauges.push_back(hud_gauge);
1484  }
1485 }
1486 
1488 {
1489  int Mini_3digit_offsets[2];
1490  int Mini_1digit_offsets[2];
1491  int Mini_2digit_offsets[2];
1492  char fname[MAX_FILENAME_LEN] = "targhit1";
1493 
1494  settings->origin[0] = 0.5f;
1495  settings->origin[1] = 0.5f;
1496  settings->slew = true;
1497 
1498  if(gr_screen.res == GR_640) {
1499  settings->offset[0] = -15;
1500  settings->offset[1] = 51;
1501 
1502  Mini_3digit_offsets[0] = 5;
1503  Mini_3digit_offsets[1] = 7;
1504  Mini_1digit_offsets[0] = 11;
1505  Mini_1digit_offsets[1] = 7;
1506  Mini_2digit_offsets[0] = 8;
1507  Mini_2digit_offsets[1] = 7;
1508  } else {
1509  settings->offset[0] = -15;
1510  settings->offset[1] = 86;
1511 
1512  Mini_3digit_offsets[0] = 5;
1513  Mini_3digit_offsets[1] = 7;
1514  Mini_1digit_offsets[0] = 14;
1515  Mini_1digit_offsets[1] = 7;
1516  Mini_2digit_offsets[0] = 9;
1517  Mini_2digit_offsets[1] = 7;
1518  }
1519 
1520  HudGaugeShieldMini* hud_gauge = gauge_load_common<HudGaugeShieldMini>(settings);
1521 
1522  if(optional_string("Filename:")) {
1524  }
1525  if(optional_string("3 Digit Hull Offsets:")) {
1526  stuff_int_list(Mini_3digit_offsets, 2);
1527  }
1528  if(optional_string("2 Digit Hull Offsets:")) {
1529  stuff_int_list(Mini_2digit_offsets, 2);
1530  }
1531  if(optional_string("1 Digit Hull Offsets:")) {
1532  stuff_int_list(Mini_1digit_offsets, 2);
1533  }
1534 
1535  hud_gauge->init1DigitOffsets(Mini_1digit_offsets[0], Mini_1digit_offsets[1]);
1536  hud_gauge->init2DigitOffsets(Mini_2digit_offsets[0], Mini_2digit_offsets[1]);
1537  hud_gauge->init3DigitOffsets(Mini_3digit_offsets[0], Mini_3digit_offsets[1]);
1538  hud_gauge->initBitmaps(fname);
1539 
1540  if(settings->ship_idx->at(0) >= 0) {
1541  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
1542  HudGaugeShieldMini* instance = new HudGaugeShieldMini();
1543  *instance = *hud_gauge;
1544  Ship_info[*ship_index].hud_gauges.push_back(instance);
1545  }
1546  delete hud_gauge;
1547  } else {
1548  default_hud_gauges.push_back(hud_gauge);
1549  }
1550 }
1551 
1553 {
1554  int Wenergy_text_offsets[2];
1555  int Wenergy_h;
1556  int text_alignment = 0;
1557  bool always_show_text = false;
1558  bool show_ballistic = false;
1559  bool moving_text = false;
1560  int armed_weapon_offsets[2] = {0, 0};
1561  int armed_weapon_h = 12;
1562  int weapon_alignment = 0;
1563  bool show_weapons = false;
1564  char fname[MAX_FILENAME_LEN];
1565 
1566  settings->origin[0] = 0.5f;
1567  settings->origin[1] = 0.5f;
1568  settings->slew = true;
1569 
1571  if(gr_screen.res == GR_640) {
1572  strcpy_s(fname, "energy2_fs1");
1573  } else {
1574  strcpy_s(fname, "2_energy2_fs1");
1575  }
1576  } else {
1577  if(gr_screen.res == GR_640) {
1578  strcpy_s(fname, "energy2");
1579  } else {
1580  strcpy_s(fname, "2_energy2");
1581  }
1582  }
1583 
1584  if(gr_screen.res == GR_640) {
1585  settings->offset[0] = 96;
1586  settings->offset[1] = 25;
1587 
1588  Wenergy_text_offsets[0] = 23;
1589  Wenergy_text_offsets[1] = 53;
1590 
1591  Wenergy_h = 60;
1592  } else {
1593  settings->offset[0] = 154;
1594  settings->offset[1] = 40;
1595 
1596  Wenergy_text_offsets[0] = 43;
1597  Wenergy_text_offsets[1] = 85;
1598 
1599  Wenergy_h = 96;
1600  }
1601 
1602  HudGaugeWeaponEnergy* hud_gauge = gauge_load_common<HudGaugeWeaponEnergy>(settings);
1603 
1604  if(optional_string("Filename:")) {
1606  }
1607  if(optional_string("Foreground Clip Height:")) {
1608  stuff_int(&Wenergy_h);
1609  }
1610  if(optional_string("Text Offsets:")) {
1611  stuff_int_list(Wenergy_text_offsets, 2);
1612 
1613  if(optional_string("Text Alignment:")) {
1614  if(required_string("Right")) {
1615  text_alignment = 1;
1616  }
1617  }
1618  }
1619  if(optional_string("Always Show Text:")) {
1620  stuff_boolean(&always_show_text);
1621  }
1622  if(optional_string("Text Follows:")) {
1623  stuff_boolean(&moving_text);
1624  }
1625  if(optional_string("Show Ballistic Ammo:")) {
1626  stuff_boolean(&show_ballistic);
1627  }
1628  if(optional_string("Armed Guns List Offsets:")) {
1629  stuff_int_list(armed_weapon_offsets, 2);
1630  show_weapons = true;
1631 
1632  if(optional_string("Armed Guns List Alignment:")) {
1633  if(required_string("Right")) {
1634  weapon_alignment = 1;
1635  }
1636  }
1637 
1638  if(optional_string("Armed Guns List Entry Height:")) {
1639  stuff_int(&armed_weapon_h);
1640  }
1641  }
1642 
1643  hud_gauge->initBitmaps(fname);
1644  hud_gauge->initEnergyHeight(Wenergy_h);
1645  hud_gauge->initTextOffsets(Wenergy_text_offsets[0], Wenergy_text_offsets[1]);
1646  hud_gauge->initAlignments(text_alignment, weapon_alignment);
1647  hud_gauge->initAlwaysShowText(always_show_text);
1648  hud_gauge->initMoveText(moving_text);
1649  hud_gauge->initShowBallistics(show_ballistic);
1650  hud_gauge->initArmedOffsets(armed_weapon_offsets[0], armed_weapon_offsets[1], armed_weapon_h, show_weapons);
1651 
1652  if(settings->ship_idx->at(0) >= 0) {
1653  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
1654  HudGaugeWeaponEnergy* instance = new HudGaugeWeaponEnergy();
1655  *instance = *hud_gauge;
1656  Ship_info[*ship_index].hud_gauges.push_back(instance);
1657  }
1658  delete hud_gauge;
1659  } else {
1660  default_hud_gauges.push_back(hud_gauge);
1661  }
1662 }
1663 
1665 {
1666  settings->origin[0] = 0.5f;
1667  settings->origin[1] = 1.0f;
1668 
1669  if(gr_screen.res == GR_640) {
1670  settings->offset[0] = -178;
1671  settings->offset[1] = -101;
1672  } else {
1673  settings->offset[0] = -220;
1674  settings->offset[1] = -98;
1675  }
1676 
1677  HudGaugeShieldTarget* hud_gauge = gauge_load_common<HudGaugeShieldTarget>(settings);
1678 
1679  if(settings->ship_idx->at(0) >= 0) {
1680  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
1681  HudGaugeShieldTarget* instance = new HudGaugeShieldTarget();
1682  *instance = *hud_gauge;
1683  Ship_info[*ship_index].hud_gauges.push_back(instance);
1684  }
1685  delete hud_gauge;
1686  } else {
1687  default_hud_gauges.push_back(hud_gauge);
1688  }
1689 }
1690 
1692 {
1693  settings->origin[0] = 0.5f;
1694  settings->origin[1] = 1.0f;
1695 
1696  if(gr_screen.res == GR_640) {
1697  settings->offset[0] = 76;
1698  settings->offset[1] = -101;
1699  } else {
1700  settings->offset[0] = 122;
1701  settings->offset[1] = -98;
1702  }
1703 
1704  HudGaugeShieldPlayer* hud_gauge = gauge_load_common<HudGaugeShieldPlayer>(settings);
1705 
1706  if(settings->ship_idx->at(0) >= 0) {
1707  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
1708  HudGaugeShieldPlayer* instance = new HudGaugeShieldPlayer();
1709  *instance = *hud_gauge;
1710  Ship_info[*ship_index].hud_gauges.push_back(instance);
1711  }
1712  delete hud_gauge;
1713  } else {
1714  default_hud_gauges.push_back(hud_gauge);
1715  }
1716 }
1717 
1719 {
1720  int header_text_offsets[2];
1721  int list_start_offsets[2];
1722  int entry_h;
1723  int entry_stagger_w;
1724  int bottom_bg_offset = 0;
1725  int ship_name_offsets[2];
1726  int ship_name_max_w = 100;
1727  int ship_integrity_offsets[2];
1728  int ship_status_offsets[2];
1729  bool right_align_names = false;
1730  char header_text[MAX_FILENAME_LEN] = "";
1731  char fname_top[MAX_FILENAME_LEN] = "escort1";
1732  char fname_middle[MAX_FILENAME_LEN] = "escort2";
1733  char fname_bottom[MAX_FILENAME_LEN] = "escort3";
1734 
1735  settings->origin[0] = 1.0f;
1736  settings->origin[1] = 0.5f;
1737 
1738  if(gr_screen.res == GR_640) {
1739  settings->offset[0] = -154;
1740  settings->offset[1] = -40;
1741 
1742  header_text_offsets[0] = 3;
1743  header_text_offsets[1] = 2;
1744  list_start_offsets[0] = 0;
1745  list_start_offsets[1] = 13;
1746  entry_h = 11;
1747  entry_stagger_w = 0;
1748  ship_name_offsets[0] = 3;
1749  ship_name_offsets[1] = 0;
1750  ship_integrity_offsets[0] = 118;
1751  ship_integrity_offsets[1] = 0;
1752  ship_status_offsets[0] = -12;
1753  ship_status_offsets[1] = 0;
1754  } else {
1755  settings->offset[0] = -159;
1756  settings->offset[1] = -54;
1757 
1758  header_text_offsets[0] = 3;
1759  header_text_offsets[1] = 2;
1760  list_start_offsets[0] = 0;
1761  list_start_offsets[1] = 13;
1762  entry_h = 11;
1763  entry_stagger_w = 0;
1764  ship_name_offsets[0] = 4;
1765  ship_name_offsets[1] = 0;
1766  ship_integrity_offsets[0] = 116;
1767  ship_integrity_offsets[1] = 0;
1768  ship_status_offsets[0] = -11;
1769  ship_status_offsets[1] = 0;
1770  }
1771 
1772  HudGaugeEscort* hud_gauge = gauge_load_common<HudGaugeEscort>(settings);
1773 
1774  if(optional_string("Top Background Filename:")) {
1775  stuff_string(fname_top, F_NAME, MAX_FILENAME_LEN);
1776  }
1777  if(optional_string("Entry Background Filename:")) {
1778  stuff_string(fname_middle, F_NAME, MAX_FILENAME_LEN);
1779  }
1780  if(optional_string("Bottom Background Filename:")) {
1781  stuff_string(fname_bottom, F_NAME, MAX_FILENAME_LEN);
1782  }
1783  if(optional_string("Entry Height:")) {
1784  stuff_int(&entry_h);
1785  }
1786  if(optional_string("Entry Stagger Width:")) {
1787  stuff_int(&entry_stagger_w);
1788  }
1789  if(optional_string("Bottom Background Offset:")) {
1790  stuff_int(&bottom_bg_offset);
1791  }
1792  if(optional_string("Header Text:")) {
1793  stuff_string(header_text, F_NAME, MAX_FILENAME_LEN);
1794  }
1795  if(optional_string("Header Offsets:")) {
1796  stuff_int_list(header_text_offsets, 2);
1797  }
1798  if(optional_string("List Start Offsets:")) {
1799  stuff_int_list(list_start_offsets, 2);
1800  }
1801  if(optional_string("Hull X-offset:")) {
1802  stuff_int(&ship_integrity_offsets[0]);
1803  }
1804  if(optional_string("Name X-offset:")) {
1805  stuff_int(&ship_name_offsets[0]);
1806  }
1807  if(optional_string("Status X-offset:")) {
1808  stuff_int(&ship_status_offsets[0]);
1809  }
1810 
1811  if ( optional_string("Ship Name Max Width:") ) {
1812  stuff_int(&ship_name_max_w);
1813  }
1814 
1815  if ( optional_string("Right-Align Ship Names:") ) {
1816  stuff_boolean(&right_align_names);
1817  }
1818 
1819  if (header_text[0] == '\0') {
1820  strcpy_s(header_text, XSTR("monitoring", 285));
1821  }
1822 
1823  hud_gauge->initBitmaps(fname_top, fname_middle, fname_bottom);
1824  hud_gauge->initEntryHeight(entry_h);
1825  hud_gauge->initEntryStaggerWidth(entry_stagger_w);
1826  hud_gauge->initBottomBgOffset(bottom_bg_offset);
1827  hud_gauge->initHeaderText(header_text);
1828  hud_gauge->initHeaderTextOffsets(header_text_offsets[0], header_text_offsets[1]);
1829  hud_gauge->initListStartOffsets(list_start_offsets[0], list_start_offsets[1]);
1830  hud_gauge->initShipIntegrityOffsets(ship_integrity_offsets[0], ship_integrity_offsets[1]);
1831  hud_gauge->initShipNameOffsets(ship_name_offsets[0], ship_name_offsets[1]);
1832  hud_gauge->initShipStatusOffsets(ship_status_offsets[0], ship_status_offsets[1]);
1833  hud_gauge->initShipNameMaxWidth(ship_name_max_w);
1834  hud_gauge->initRightAlignNames(right_align_names);
1835 
1836  if(settings->ship_idx->at(0) >= 0) {
1837  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
1838  HudGaugeEscort* instance = new HudGaugeEscort();
1839  *instance = *hud_gauge;
1840  Ship_info[*ship_index].hud_gauges.push_back(instance);
1841  }
1842  delete hud_gauge;
1843  } else {
1844  default_hud_gauges.push_back(hud_gauge);
1845  }
1846 }
1847 
1849 {
1850  int energy_h;
1851  char fname[MAX_FILENAME_LEN];
1852 
1853  settings->origin[0] = 0.5f;
1854  settings->origin[1] = 0.5f;
1855  settings->slew = true;
1856 
1858  if(gr_screen.res == GR_640) {
1859  strcpy_s(fname, "energy2_fs1");
1860  } else {
1861  strcpy_s(fname, "2_energy2_fs1");
1862  }
1863  } else {
1864  if(gr_screen.res == GR_640) {
1865  strcpy_s(fname, "energy2");
1866  } else {
1867  strcpy_s(fname, "2_energy2");
1868  }
1869  }
1870 
1871  if(gr_screen.res == GR_640) {
1872  settings->offset[0] = -149;
1873  settings->offset[1] = 25;
1874 
1875  energy_h = 60;
1876  } else {
1877  settings->offset[0] = -238;
1878  settings->offset[1] = 40;
1879 
1880  energy_h = 96;
1881  }
1882 
1883  HudGaugeAfterburner *hud_gauge = gauge_load_common<HudGaugeAfterburner>(settings);
1884 
1885  if(optional_string("Filename:")) {
1887  }
1888  if(optional_string("Foreground Clip Height:")) {
1889  stuff_int(&energy_h);
1890  }
1891 
1892  hud_gauge->initEnergyHeight(energy_h);
1893  hud_gauge->initBitmaps(fname);
1894 
1895  if(settings->ship_idx->at(0) >= 0) {
1896  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
1897  HudGaugeAfterburner* instance = new HudGaugeAfterburner();
1898  *instance = *hud_gauge;
1899  Ship_info[*ship_index].hud_gauges.push_back(instance);
1900  }
1901  delete hud_gauge;
1902  } else {
1903  default_hud_gauges.push_back(hud_gauge);
1904  }
1905 }
1906 
1907 
1909 {
1910  int time_text_offsets[2];
1911  int time_val_offsets[2];
1912  char fname[MAX_FILENAME_LEN] = "time1";
1913 
1914  settings->origin[0] = 1.0f;
1915  settings->origin[1] = 1.0f;
1916 
1917  if(gr_screen.res == GR_640) {
1918  settings->offset[0] = -53;
1919  settings->offset[1] = -32;
1920  } else {
1921  settings->offset[0] = -55;
1922  settings->offset[1] = -52;
1923  }
1924  time_text_offsets[0] = 4;
1925  time_text_offsets[1] = 4;
1926 
1927  time_val_offsets[0] = 26;
1928  time_val_offsets[1] = 12;
1929 
1930  HudGaugeMissionTime* hud_gauge = gauge_load_common<HudGaugeMissionTime>(settings);
1931 
1932  if(optional_string("Filename:")) {
1934  }
1935  if(optional_string("Text Offsets:")) {
1936  stuff_int_list(time_text_offsets, 2);
1937  }
1938  if(optional_string("Value Offsets:")) {
1939  stuff_int_list(time_val_offsets, 2);
1940  }
1941 
1942  hud_gauge->initTextOffsets(time_text_offsets[0], time_text_offsets[1]);
1943  hud_gauge->initValueOffsets(time_val_offsets[0], time_val_offsets[1]);
1944  hud_gauge->initBitmaps(fname);
1945 
1946  if(settings->ship_idx->at(0) >= 0) {
1947  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
1948  HudGaugeMissionTime* instance = new HudGaugeMissionTime();
1949  *instance = *hud_gauge;
1950  Ship_info[*ship_index].hud_gauges.push_back(instance);
1951  }
1952  delete hud_gauge;
1953  } else {
1954  default_hud_gauges.push_back(hud_gauge);
1955  }
1956 }
1957 
1959 {
1960  int Laser_warn_offsets[2];
1961  int Lock_warn_offsets[2];
1962  char fname_arc[MAX_FILENAME_LEN];
1963  char fname_laser[MAX_FILENAME_LEN];
1964  char fname_lock[MAX_FILENAME_LEN];
1965 
1966  settings->origin[0] = 0.5f;
1967  settings->origin[1] = 0.5f;
1968  settings->slew = true;
1969 
1971  if(gr_screen.res == GR_640) {
1972  settings->offset[0] = -79;
1973  settings->offset[1] = -103;
1974 
1975  Laser_warn_offsets[0] = 59;
1976  Laser_warn_offsets[1] = 0;
1977 
1978  Lock_warn_offsets[0] = 79;
1979  Lock_warn_offsets[1] = 0;
1980 
1981  strcpy_s(fname_arc, "toparc1_fs1");
1982  strcpy_s(fname_laser, "toparc2_fs1");
1983  strcpy_s(fname_lock, "toparc3_fs1");
1984  } else {
1985  settings->offset[0] = -126;
1986  settings->offset[1] = -165;
1987 
1988  Laser_warn_offsets[0] = 94;
1989  Laser_warn_offsets[1] = 0;
1990 
1991  Lock_warn_offsets[0] = 126;
1992  Lock_warn_offsets[1] = 0;
1993 
1994  strcpy_s(fname_arc, "2_toparc1_fs1");
1995  strcpy_s(fname_laser, "2_toparc2_fs1");
1996  strcpy_s(fname_lock, "2_toparc3_fs1");
1997  }
1998  } else {
1999  if(gr_screen.res == GR_640) {
2000  settings->offset[0] = 39;
2001  settings->offset[1] = -72;
2002 
2003  Laser_warn_offsets[0] = 41;
2004  Laser_warn_offsets[1] = 77;
2005 
2006  Lock_warn_offsets[0] = 35;
2007  Lock_warn_offsets[1] = 93;
2008 
2009  strcpy_s(fname_arc, "rightarc1");
2010  strcpy_s(fname_laser, "toparc2");
2011  strcpy_s(fname_lock, "toparc3");
2012  } else {
2013  settings->offset[0] = 62;
2014  settings->offset[1] = -115;
2015 
2016  Laser_warn_offsets[0] = 66;
2017  Laser_warn_offsets[1] = 124;
2018 
2019  Lock_warn_offsets[0] = 57;
2020  Lock_warn_offsets[1] = 150;
2021 
2022  strcpy_s(fname_arc, "2_rightarc1");
2023  strcpy_s(fname_laser, "2_toparc2");
2024  strcpy_s(fname_lock, "2_toparc3");
2025  }
2026  }
2027 
2028  HudGaugeThreatIndicator* hud_gauge = gauge_load_common<HudGaugeThreatIndicator>(settings);
2029 
2030  if(optional_string("Arc Filename:")) {
2031  stuff_string(fname_arc, F_NAME, MAX_FILENAME_LEN);
2032  }
2033  if(optional_string("Dumbfire Filename:")) {
2034  stuff_string(fname_laser, F_NAME, MAX_FILENAME_LEN);
2035  }
2036  if(optional_string("Lock Filename:")) {
2037  stuff_string(fname_lock, F_NAME, MAX_FILENAME_LEN);
2038  }
2039  if(optional_string("Dumbfire Offsets:")) {
2040  stuff_int_list(Laser_warn_offsets, 2);
2041  }
2042  if(optional_string("Lock Offsets:")) {
2043  stuff_int_list(Lock_warn_offsets, 2);
2044  }
2045 
2046  hud_gauge->initBitmaps(fname_arc, fname_laser, fname_lock);
2047  hud_gauge->initLaserWarnOffsets(Laser_warn_offsets[0], Laser_warn_offsets[1]);
2048  hud_gauge->initLockWarnOffsets(Lock_warn_offsets[0], Lock_warn_offsets[1]);
2049 
2050  if(settings->ship_idx->at(0) >= 0) {
2051  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
2053  *instance = *hud_gauge;
2054  Ship_info[*ship_index].hud_gauges.push_back(instance);
2055  }
2056  delete hud_gauge;
2057  } else {
2058  default_hud_gauges.push_back(hud_gauge);
2059  }
2060 }
2061 
2063 {
2064  char fname[MAX_FILENAME_LEN];
2065  bool firepoints = false;
2066  int scaleX = 15;
2067  int scaleY = 10;
2068  int size = 5;
2069 
2070  settings->origin[0] = 0.5f;
2071  settings->origin[1] = 0.5f;
2072  settings->slew = true;
2073 
2075  if(gr_screen.res == GR_640) {
2076  settings->offset[0] = -12;
2077  settings->offset[1] = -5;
2078 
2079  strcpy_s(fname, "reticle1_fs1");
2080  } else {
2081  settings->offset[0] = -19;
2082  settings->offset[1] = -8;
2083 
2084  strcpy_s(fname, "2_reticle1_fs1");
2085  }
2086  } else {
2087  if(gr_screen.res == GR_640) {
2088  settings->offset[0] = -12;
2089  settings->offset[1] = -5;
2090 
2091  strcpy_s(fname, "reticle1");
2092  } else {
2093  settings->offset[0] = -19;
2094  settings->offset[1] = -14;
2095 
2096  strcpy_s(fname, "2_reticle1");
2097  }
2098  }
2099 
2100  HudGaugeReticle* hud_gauge = gauge_load_common<HudGaugeReticle>(settings);
2101 
2102  if(optional_string("Filename:")) {
2104  }
2105 
2106  if(optional_string("Firepoint display:"))
2107  stuff_boolean(&firepoints);
2108 
2109  if (optional_string("Firepoint size:"))
2110  stuff_int(&size);
2111 
2112  if (optional_string("Firepoint X coordinate multiplier:"))
2113  stuff_int(&scaleX);
2114 
2115  if (optional_string("Firepoint Y coordinate multiplier:"))
2116  stuff_int(&scaleY);
2117 
2118  hud_gauge->initBitmaps(fname);
2119  hud_gauge->initFirepointDisplay(firepoints, scaleX, scaleY, size);
2120 
2121  if(settings->ship_idx->at(0) >= 0) {
2122  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
2123  HudGaugeReticle* instance = new HudGaugeReticle();
2124  *instance = *hud_gauge;
2125  Ship_info[*ship_index].hud_gauges.push_back(instance);
2126  }
2127  delete hud_gauge;
2128  } else {
2129  default_hud_gauges.push_back(hud_gauge);
2130  }
2131 }
2132 
2134 {
2135  int bottom_offset_y;
2136  int throttle_h, throttle_w;
2137  int throttle_aburn_h;
2138  int max_speed_offset[2];
2139  bool show_max_speed = true;
2140  int zero_speed_offset[2];
2141  bool show_min_speed = true;
2142  bool orbit = true;
2143  int orbit_center_offset[2];
2144  int orbit_radius;
2145  int target_speed_offset[2] = {0, 0};
2146  bool show_target_speed = false;
2147  bool show_target_speed_percent = false;
2148  int glide_offset[2] = {0, 0};
2149  bool custom_glide = false;
2150  int match_speed_offset[2] = {0, 0};
2151  bool custom_match = false;
2152  char fname[MAX_FILENAME_LEN];
2153  bool show_background = false;
2154 
2155  settings->origin[0] = 0.5f;
2156  settings->origin[1] = 0.5f;
2157  settings->slew = true;
2158 
2159  // default values for the throttle
2161  if(gr_screen.res == GR_640) {
2162  settings->offset[0] = -103;
2163  settings->offset[1] = 4;
2164 
2165  bottom_offset_y = 65;
2166  throttle_h = 50;
2167  throttle_w = 49;
2168  throttle_aburn_h = 17;
2169  max_speed_offset[0] = 14;
2170  max_speed_offset[1] = 14;
2171  zero_speed_offset[0] = 33;
2172  zero_speed_offset[1] = 63;
2173  orbit_center_offset[0] = 103;
2174  orbit_center_offset[1] = -1;
2175  orbit_radius = 104;
2176  strcpy_s(fname, "leftarc_fs1");
2177  } else {
2178  settings->offset[0] = -165;
2179  settings->offset[1] = 6;
2180 
2181  bottom_offset_y = 104;
2182  throttle_h = 80;
2183  throttle_w = 78;
2184  throttle_aburn_h = 27;
2185  max_speed_offset[0] = 22;
2186  max_speed_offset[1] = 22;
2187  zero_speed_offset[0] = 53;
2188  zero_speed_offset[1] = 101;
2189  orbit_center_offset[0] = 165;
2190  orbit_center_offset[1] = -1;
2191  orbit_radius = 166;
2192  strcpy_s(fname, "2_leftarc_fs1");
2193  }
2194  show_background = true;
2195  } else {
2196  if(gr_screen.res == GR_640) {
2197  settings->offset[0] = -104;
2198  settings->offset[1] = -72;
2199 
2200  bottom_offset_y = 139;
2201  throttle_h = 50;
2202  throttle_w = 49;
2203  throttle_aburn_h = 17;
2204  max_speed_offset[0] = 20;
2205  max_speed_offset[1] = 86;
2206  zero_speed_offset[0] = 36;
2207  zero_speed_offset[1] = 135;
2208  orbit_center_offset[0] = 104;
2209  orbit_center_offset[1] = 75;
2210  orbit_radius = 104;
2211  strcpy_s(fname, "leftarc");
2212  } else {
2213  settings->offset[0] = -166;
2214  settings->offset[1] = -115;
2215 
2216  bottom_offset_y = 222;
2217  throttle_h = 80;
2218  throttle_w = 78;
2219  throttle_aburn_h = 27;
2220  max_speed_offset[0] = 31;
2221  max_speed_offset[1] = 137;
2222  zero_speed_offset[0] = 57;
2223  zero_speed_offset[1] = 216;
2224  orbit_center_offset[0] = 166;
2225  orbit_center_offset[1] = 118;
2226  orbit_radius = 166;
2227  strcpy_s(fname, "2_leftarc");
2228  }
2229  }
2230 
2231  HudGaugeThrottle* hud_gauge = gauge_load_common<HudGaugeThrottle>(settings);
2232 
2233  if(optional_string("Filename:")) {
2235  }
2236  if(optional_string("Foreground Clip Bottom Y-offset:")) {
2237  stuff_int(&bottom_offset_y);
2238  }
2239  if(optional_string("Foreground Clip Width:")) {
2240  stuff_int(&throttle_w);
2241  }
2242  if(optional_string("Foreground Clip Height:")) {
2243  stuff_int(&throttle_h);
2244  }
2245  if(optional_string("Afterburner Clip Height:")) {
2246  stuff_int(&throttle_aburn_h);
2247  }
2248  if(optional_string("Show Background:")) {
2249  stuff_boolean(&show_background);
2250  }
2251  if(optional_string("Max Speed Label Offsets:")) {
2252  stuff_int_list(max_speed_offset, 2);
2253  }
2254  if(optional_string("Show Max Speed Label:")) {
2255  stuff_boolean(&show_max_speed);
2256  }
2257  if(optional_string("Min Speed Label Offsets:")) {
2258  stuff_int_list(zero_speed_offset, 2);
2259  }
2260  if(optional_string("Show Min Speed Label:")) {
2261  stuff_boolean(&show_min_speed);
2262  }
2263  if(optional_string("Orbit Center Offsets:")) {
2264  stuff_int_list(orbit_center_offset, 2);
2265  }
2266  if(optional_string("Orbit Radius:")) {
2267  stuff_int(&orbit_radius);
2268  }
2269  if(optional_string("Current Speed Offsets:")) {
2270  stuff_int_list(orbit_center_offset, 2);
2271  orbit = false;
2272  }
2273  if(optional_string("Target Speed Offsets:")) {
2274  stuff_int_list(target_speed_offset, 2);
2275  show_target_speed = true;
2276  }
2277  if ( optional_string("Show Percentage:") ) {
2278  stuff_boolean(&show_target_speed_percent);
2279  }
2280  if(optional_string("Glide Status Offsets:")) {
2281  stuff_int_list(glide_offset, 2);
2282  custom_glide = true;
2283  }
2284  if(optional_string("Match Speed Status Offsets:")) {
2285  stuff_int_list(match_speed_offset, 2);
2286  custom_match = true;
2287  }
2288 
2289  hud_gauge->initThrottleStartY(bottom_offset_y);
2290  hud_gauge->initThrottleSizes(throttle_w, throttle_h);
2291  hud_gauge->initAburnHeight(throttle_aburn_h);
2292  hud_gauge->initMaxSpeedOffsets(max_speed_offset[0], max_speed_offset[1], show_max_speed);
2293  hud_gauge->initZeroSpeedOffsets(zero_speed_offset[0], zero_speed_offset[1], show_min_speed);
2294  hud_gauge->initOrbitCenterOffsets(orbit_center_offset[0], orbit_center_offset[1], orbit);
2295  hud_gauge->initOrbitRadius(orbit_radius);
2296  hud_gauge->initTargetSpeedOffsets(target_speed_offset[0], target_speed_offset[1], show_target_speed, show_target_speed_percent);
2297  hud_gauge->initGlideOffsets(glide_offset[0], glide_offset[1], custom_glide);
2298  hud_gauge->initMatchSpeedOffsets(match_speed_offset[0], match_speed_offset[1], custom_match);
2299  hud_gauge->initBitmaps(fname);
2300  hud_gauge->showBackground(show_background);
2301 
2302  if(settings->ship_idx->at(0) >= 0) {
2303  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
2304  HudGaugeThrottle* instance = new HudGaugeThrottle();
2305  *instance = *hud_gauge;
2306  Ship_info[*ship_index].hud_gauges.push_back(instance);
2307  }
2308  delete hud_gauge;
2309  } else {
2310  default_hud_gauges.push_back(hud_gauge);
2311  }
2312 }
2313 
2319 {
2320  int bar_h;
2321  int letter_offsets[2];
2322  int top_offsets[2];
2323  int bottom_offsets[2];
2324  char ets_letters[num_retail_ets_gauges];
2325  char fname[MAX_FILENAME_LEN] = "energy1";
2326  int gauge_offset; // distance between micro gauges
2327  int i;
2328  int gauge_positions[num_retail_ets_gauges];
2329 
2330  settings->origin[0] = 1.0f;
2331  settings->origin[1] = 1.0f;
2332 
2333  if (Lcl_gr) {
2334  ets_letters[0] = 'G'; ets_letters[1] = 'S'; ets_letters[2] = 'A'; // German
2335  } else if (Lcl_fr) {
2336  ets_letters[0] = 'C'; ets_letters[1] = 'B'; ets_letters[2] = 'M'; // French
2337  } else {
2338  ets_letters[0] = 'G'; ets_letters[1] = 'S'; ets_letters[2] = 'E'; // English
2339  }
2340 
2341  // default values which may be overwritten by .tbl
2342  if(gr_screen.res == GR_640) {
2343  settings->offset[0] = -117;
2344  settings->offset[1] = -100;
2345 
2346  gauge_offset = 17;
2347  } else {
2348  settings->offset[0] = -144;
2349  settings->offset[1] = -120;
2350 
2351  gauge_offset = 18;
2352  }
2353  bar_h = 41;
2354  letter_offsets[0] = 2;
2355  letter_offsets[1] = 42;
2356  top_offsets[0] = 0;
2357  top_offsets[1] = 0;
2358  bottom_offsets[0] = 0;
2359  bottom_offsets[1] = 50;
2360 
2361  HudGaugeEtsRetail* hud_gauge = gauge_load_common<HudGaugeEtsRetail>(settings);
2362 
2363  if(optional_string("Filename:")) {
2365  }
2366  if(optional_string("Foreground Clip Height:")) {
2367  stuff_int(&bar_h);
2368  }
2369  if(optional_string("Letter Offsets:")) {
2370  stuff_int_list(letter_offsets, 2);
2371  }
2372  if(optional_string("Top Offsets:")) {
2373  stuff_int_list(top_offsets, 2);
2374  }
2375  if(optional_string("Bottom Offsets:")) {
2376  stuff_int_list(bottom_offsets, 2);
2377  }
2378  if(optional_string("Gauge Offset:")) {
2379  stuff_int(&gauge_offset);
2380  }
2381 
2382  // calculate offsets for the three gauges from settings->coords[0], which was set by gauge_load_common
2383  for (i = 0; i < num_retail_ets_gauges; ++i) {
2384  gauge_positions[i] = settings->coords[0] + gauge_offset * i;
2385  }
2386 
2387  hud_gauge->initLetters(ets_letters);
2388  hud_gauge->initLetterOffsets(letter_offsets[0], letter_offsets[1]);
2389  hud_gauge->initTopOffsets(top_offsets[0], top_offsets[1]);
2390  hud_gauge->initBottomOffsets(bottom_offsets[0], bottom_offsets[1]);
2391  hud_gauge->initBarHeight(bar_h);
2392  hud_gauge->initBitmaps(fname);
2393  hud_gauge->initGaugePositions(gauge_positions);
2394 
2395  if(settings->ship_idx->at(0) >= 0) {
2396  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
2397  HudGaugeEtsRetail* instance = new HudGaugeEtsRetail();
2398  *instance = *hud_gauge;
2399  Ship_info[*ship_index].hud_gauges.push_back(instance);
2400  }
2401  delete hud_gauge;
2402  } else {
2403  default_hud_gauges.push_back(hud_gauge);
2404  }
2405 }
2406 
2408 {
2409  int bar_h;
2410  int letter_offsets[2];
2411  int top_offsets[2];
2412  int bottom_offsets[2];
2413  char letter;
2414  char fname[MAX_FILENAME_LEN] = "energy1";
2415 
2416  settings->origin[0] = 1.0f;
2417  settings->origin[1] = 1.0f;
2418 
2419  if(Lcl_gr) {
2420  // German
2421  letter = 'G';
2422  } else if(Lcl_fr) {
2423  // French
2424  letter = 'C';
2425  } else {
2426  // English
2427  letter = 'G';
2428  }
2429 
2430  if(gr_screen.res == GR_640) {
2431  settings->offset[0] = -117;
2432  settings->offset[1] = -100;
2433  } else {
2434  settings->offset[0] = -144;
2435  settings->offset[1] = -120;
2436  }
2437  bar_h = 41;
2438  letter_offsets[0] = 2;
2439  letter_offsets[1] = 42;
2440  top_offsets[0] = 0;
2441  top_offsets[1] = 0;
2442  bottom_offsets[0] = 0;
2443  bottom_offsets[1] = 50;
2444 
2445  HudGaugeEtsWeapons* hud_gauge = gauge_load_common<HudGaugeEtsWeapons>(settings);
2446 
2447  if(optional_string("Filename:")) {
2449  }
2450  if(optional_string("Foreground Clip Height:")) {
2451  stuff_int(&bar_h);
2452  }
2453  if(optional_string("Letter Offsets:")) {
2454  stuff_int_list(letter_offsets, 2);
2455  }
2456  if(optional_string("Top Offsets:")) {
2457  stuff_int_list(top_offsets, 2);
2458  }
2459  if(optional_string("Bottom Offsets:")) {
2460  stuff_int_list(bottom_offsets, 2);
2461  }
2462 
2463  hud_gauge->initLetter(letter);
2464  hud_gauge->initLetterOffsets(letter_offsets[0], letter_offsets[1]);
2465  hud_gauge->initTopOffsets(top_offsets[0], top_offsets[1]);
2466  hud_gauge->initBottomOffsets(bottom_offsets[0], bottom_offsets[1]);
2467  hud_gauge->initBarHeight(bar_h);
2468  hud_gauge->initBitmaps(fname);
2469 
2470  if(settings->ship_idx->at(0) >= 0) {
2471  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
2472  HudGaugeEtsWeapons* instance = new HudGaugeEtsWeapons();
2473  *instance = *hud_gauge;
2474  Ship_info[*ship_index].hud_gauges.push_back(instance);
2475  }
2476  delete hud_gauge;
2477  } else {
2478  default_hud_gauges.push_back(hud_gauge);
2479  }
2480 }
2481 
2483 {
2484  int bar_h;
2485  int letter_offsets[2];
2486  int top_offsets[2];
2487  int bottom_offsets[2];
2488  char letter;
2489  char fname[MAX_FILENAME_LEN] = "energy1";
2490 
2491  settings->origin[0] = 1.0f;
2492  settings->origin[1] = 1.0f;
2493 
2494  if(Lcl_gr){
2495  // German
2496  letter = 'S';
2497  } else if(Lcl_fr){
2498  // French
2499  letter = 'B';
2500  } else {
2501  // English
2502  letter = 'S';
2503  }
2504 
2505  if(gr_screen.res == GR_640) {
2506  settings->offset[0] = -100;
2507  settings->offset[1] = -100;
2508  } else {
2509  settings->offset[0] = -126;
2510  settings->offset[1] = -120;
2511  }
2512  bar_h = 41;
2513 
2514  letter_offsets[0] = 2;
2515  letter_offsets[1] = 42;
2516  top_offsets[0] = 0;
2517  top_offsets[1] = 0;
2518  bottom_offsets[0] = 0;
2519  bottom_offsets[1] = 50;
2520 
2521  HudGaugeEtsShields* hud_gauge = gauge_load_common<HudGaugeEtsShields>(settings);
2522 
2523  if(optional_string("Filename:")) {
2525  }
2526  if(optional_string("Foreground Clip Height:")) {
2527  stuff_int(&bar_h);
2528  }
2529  if(optional_string("Letter Offsets:")) {
2530  stuff_int_list(letter_offsets, 2);
2531  }
2532  if(optional_string("Top Offsets:")) {
2533  stuff_int_list(top_offsets, 2);
2534  }
2535  if(optional_string("Bottom Offsets:")) {
2536  stuff_int_list(bottom_offsets, 2);
2537  }
2538 
2539  hud_gauge->initBarHeight(bar_h);
2540  hud_gauge->initBitmaps(fname);
2541  hud_gauge->initBottomOffsets(bottom_offsets[0], bottom_offsets[1]);
2542  hud_gauge->initLetter(letter);
2543  hud_gauge->initLetterOffsets(letter_offsets[0], letter_offsets[1]);
2544  hud_gauge->initTopOffsets(top_offsets[0], top_offsets[1]);
2545 
2546  if(settings->ship_idx->at(0) >= 0) {
2547  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
2548  HudGaugeEtsShields* instance = new HudGaugeEtsShields();
2549  *instance = *hud_gauge;
2550  Ship_info[*ship_index].hud_gauges.push_back(instance);
2551  }
2552  delete hud_gauge;
2553  } else {
2554  default_hud_gauges.push_back(hud_gauge);
2555  }
2556 }
2557 
2559 {
2560  int bar_h;
2561  int letter_offsets[2];
2562  int top_offsets[2];
2563  int bottom_offsets[2];
2564  char letter;
2565  char fname[MAX_FILENAME_LEN] = "energy1";
2566 
2567  settings->origin[0] = 1.0f;
2568  settings->origin[1] = 1.0f;
2569 
2570  if(Lcl_gr){
2571  // German
2572  letter = 'A';
2573  } else if(Lcl_fr){
2574  // French
2575  letter = 'M';
2576  } else {
2577  // English
2578  letter = 'E';
2579  }
2580 
2581  if(gr_screen.res == GR_640) {
2582  settings->offset[0] = -83;
2583  settings->offset[1] = -100;
2584  } else {
2585  settings->offset[0] = -108;
2586  settings->offset[1] = -120;
2587  }
2588 
2589  bar_h = 41;
2590 
2591  letter_offsets[0] = 2;
2592  letter_offsets[1] = 42;
2593  top_offsets[0] = 0;
2594  top_offsets[1] = 0;
2595  bottom_offsets[0] = 0;
2596  bottom_offsets[1] = 50;
2597 
2598  HudGaugeEtsEngines* hud_gauge = gauge_load_common<HudGaugeEtsEngines>(settings);
2599 
2600  if(optional_string("Filename:")) {
2602  }
2603  if(optional_string("Foreground Clip Height:")) {
2604  stuff_int(&bar_h);
2605  }
2606  if(optional_string("Letter Offsets:")) {
2607  stuff_int_list(letter_offsets, 2);
2608  }
2609  if(optional_string("Top Offsets:")) {
2610  stuff_int_list(top_offsets, 2);
2611  }
2612  if(optional_string("Bottom Offsets:")) {
2613  stuff_int_list(bottom_offsets, 2);
2614  }
2615 
2616  hud_gauge->initBarHeight(bar_h);
2617  hud_gauge->initBitmaps(fname);
2618  hud_gauge->initBottomOffsets(bottom_offsets[0], bottom_offsets[1]);
2619  hud_gauge->initLetter(letter);
2620  hud_gauge->initLetterOffsets(letter_offsets[0], letter_offsets[1]);
2621  hud_gauge->initTopOffsets(top_offsets[0], top_offsets[1]);
2622 
2623  if(settings->ship_idx->at(0) >= 0) {
2624  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
2625  HudGaugeEtsEngines* instance = new HudGaugeEtsEngines();
2626  *instance = *hud_gauge;
2627  Ship_info[*ship_index].hud_gauges.push_back(instance);
2628  }
2629  delete hud_gauge;
2630  } else {
2631  default_hud_gauges.push_back(hud_gauge);
2632  }
2633 }
2634 
2636 {
2637  int dock_offsets[2];
2638  int dock_max_w;
2639  int time_offsets[2];
2640  int bracket_offsets[2];
2641  int order_offsets[2];
2642  int order_max_w;
2643  char fname[MAX_FILENAME_LEN] = "targetview3";
2644 
2645  settings->origin[0] = 0.0f;
2646  settings->origin[1] = 1.0f;
2647 
2648  if(gr_screen.res == GR_640) {
2649  settings->offset[0] = 5;
2650  settings->offset[1] = -200;
2651 
2652  dock_offsets[0] = 8;
2653  dock_offsets[1] = 19;
2654 
2655  time_offsets[0] = 8;
2656  time_offsets[1] = 10;
2657  } else {
2658  settings->offset[0] = 5;
2659  settings->offset[1] = -216;
2660 
2661  dock_offsets[0] = 8;
2662  dock_offsets[1] = 18;
2663 
2664  time_offsets[0] = 8;
2665  time_offsets[1] = 9;
2666  }
2667 
2668  bracket_offsets[0] = 0;
2669  bracket_offsets[1] = 3;
2670 
2671  order_offsets[0] = 8;
2672  order_offsets[1] = 0;
2673 
2674  dock_max_w = 173;
2675  order_max_w = 162;
2676 
2677  HudGaugeExtraTargetData* hud_gauge = gauge_load_common<HudGaugeExtraTargetData>(settings);
2678 
2679  if(optional_string("Filename:")) {
2681  }
2682  if(optional_string("Bracket Offsets:")) {
2683  stuff_int_list(bracket_offsets, 2);
2684  }
2685  if(optional_string("Dock Offsets:")) {
2686  stuff_int_list(dock_offsets, 2);
2687  }
2688  if(optional_string("Dock Max Width:")) {
2689  stuff_int(&dock_max_w);
2690  }
2691  if(optional_string("Order Offsets:")) {
2692  stuff_int_list(order_offsets, 2);
2693  }
2694  if(optional_string("Order Max Width:")) {
2695  stuff_int(&order_max_w);
2696  }
2697  if(optional_string("Time Offsets:")) {
2698  stuff_int_list(time_offsets, 2);
2699  }
2700 
2701  hud_gauge->initBitmaps(fname);
2702  hud_gauge->initBracketOffsets(bracket_offsets[0], bracket_offsets[1]);
2703  hud_gauge->initDockOffsets(dock_offsets[0], dock_offsets[1]);
2704  hud_gauge->initDockMaxWidth(dock_max_w);
2705  hud_gauge->initOrderOffsets(order_offsets[0], order_offsets[1]);
2706  hud_gauge->initOrderMaxWidth(order_max_w);
2707  hud_gauge->initTimeOffsets(time_offsets[0], time_offsets[1]);
2708 
2709  if(settings->ship_idx->at(0) >= 0) {
2710  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
2712  *instance = *hud_gauge;
2713  Ship_info[*ship_index].hud_gauges.push_back(instance);
2714  }
2715  delete hud_gauge;
2716  } else {
2717  default_hud_gauges.push_back(hud_gauge);
2718  }
2719 }
2720 
2722 {
2723  int Radar_blip_radius_normal;
2724  int Radar_blip_radius_target;
2725  int Radar_radius[2];
2726  int Radar_dist_offsets[RR_MAX_RANGES][2];
2727  float Radar_center_offsets[2];
2728  char fname[MAX_FILENAME_LEN];
2729 
2730  settings->origin[0] = 0.5f;
2731  settings->origin[1] = 1.0f;
2732 
2733  if(gr_screen.res == GR_640) {
2734  settings->offset[0] = -63;
2735  settings->offset[1] = -111;
2736 
2737  Radar_blip_radius_normal = 2;
2738  Radar_blip_radius_target = 5;
2739 
2740  Radar_center_offsets[0] = 64.0f;
2741  Radar_center_offsets[1] = 53.0f;
2742 
2743  Radar_radius[0] = 120;
2744  Radar_radius[1] = 100;
2745 
2746  Radar_dist_offsets[0][0] = 110;
2747  Radar_dist_offsets[0][1] = 92;
2748 
2749  Radar_dist_offsets[1][0] = 107;
2750  Radar_dist_offsets[1][1] = 92;
2751 
2752  Radar_dist_offsets[2][0] = 111;
2753  Radar_dist_offsets[2][1] = 92;
2754 
2755  strcpy_s(fname, "radar1");
2756  } else {
2757  settings->offset[0] = -101;
2758  settings->offset[1] = -178;
2759 
2760  Radar_blip_radius_normal = 4;
2761  Radar_blip_radius_target = 8;
2762 
2763  Radar_center_offsets[0] = 104.0f;
2764  Radar_center_offsets[1] = 85.0f;
2765 
2766  Radar_radius[0] = 192;
2767  Radar_radius[1] = 160;
2768 
2769  Radar_dist_offsets[0][0] = 184;
2770  Radar_dist_offsets[0][1] = 150;
2771 
2772  Radar_dist_offsets[1][0] = 181;
2773  Radar_dist_offsets[1][1] = 150;
2774 
2775  Radar_dist_offsets[2][0] = 185;
2776  Radar_dist_offsets[2][1] = 150;
2777 
2778  strcpy_s(fname, "2_radar1");
2779  }
2780 
2781  HudGaugeRadarStd* hud_gauge = gauge_load_common<HudGaugeRadarStd>(settings);
2782 
2783  if(optional_string("Filename:")) {
2785  }
2786  if(optional_string("Radar Center Offsets:")) {
2787  stuff_float_list(Radar_center_offsets, 2);
2788  }
2789  if(optional_string("Radar Size:")) {
2790  stuff_int_list(Radar_radius, 2);
2791  }
2792  if(optional_string("Infinity Distance Offsets:")) {
2793  stuff_int_list(Radar_dist_offsets[2], 2);
2794  }
2795  if(optional_string("Long Distance Offsets:")) {
2796  stuff_int_list(Radar_dist_offsets[1], 2);
2797  }
2798  if(optional_string("Short Distance Offsets:")) {
2799  stuff_int_list(Radar_dist_offsets[0], 2);
2800  }
2801 
2802  // Only load this if the user hasn't specified a preference
2803  if (Cmdline_orb_radar == 0) {
2804  hud_gauge->initBitmaps(fname);
2805  hud_gauge->initBlipRadius(Radar_blip_radius_normal, Radar_blip_radius_target);
2806  hud_gauge->initCenterOffsets(Radar_center_offsets[0], Radar_center_offsets[1]);
2807  hud_gauge->initDistanceInfinityOffsets(Radar_dist_offsets[2][0], Radar_dist_offsets[2][1]);
2808  hud_gauge->initDistanceLongOffsets(Radar_dist_offsets[1][0], Radar_dist_offsets[1][1]);
2809  hud_gauge->initDistanceShortOffsets(Radar_dist_offsets[0][0], Radar_dist_offsets[0][1]);
2810  hud_gauge->initRadius(Radar_radius[0], Radar_radius[1]);
2811  hud_gauge->initInfinityIcon();
2812 
2813  if(settings->ship_idx->at(0) >= 0) {
2814  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
2815  HudGaugeRadarStd* instance = new HudGaugeRadarStd();
2816  *instance = *hud_gauge;
2817  Ship_info[*ship_index].hud_gauges.push_back(instance);
2818  }
2819  delete hud_gauge;
2820  } else {
2821  default_hud_gauges.push_back(hud_gauge);
2822  }
2823  }
2824  else
2825  {
2826  // cleanup
2827  delete hud_gauge;
2828  }
2829 }
2830 
2832 {
2833  int Radar_blip_radius_normal;
2834  int Radar_blip_radius_target;
2835  int Radar_radius[2];
2836  int Radar_dist_offsets[RR_MAX_RANGES][2];
2837  float Radar_center_offsets[2];
2838  char fname[MAX_FILENAME_LEN];
2839 
2840  settings->origin[0] = 0.5f;
2841  settings->origin[1] = 1.0f;
2842 
2843  if(gr_screen.res == GR_640) {
2844  settings->offset[0] = -63;
2845  settings->offset[1] = -111;
2846 
2847  Radar_blip_radius_normal = 2;
2848  Radar_blip_radius_target = 5;
2849 
2850  Radar_center_offsets[0] = 65.0f;
2851  Radar_center_offsets[1] = 53.0f;
2852 
2853  Radar_radius[0] = 120;
2854  Radar_radius[1] = 100;
2855 
2856  Radar_dist_offsets[0][0]=110;
2857  Radar_dist_offsets[0][1]=92;
2858 
2859  Radar_dist_offsets[1][0]=107;
2860  Radar_dist_offsets[1][1]=92;
2861 
2862  Radar_dist_offsets[2][0]=111;
2863  Radar_dist_offsets[2][1]=92;
2864 
2865  strcpy_s(fname, "radar1");
2866  } else {
2867  settings->offset[0] = -101;
2868  settings->offset[1] = -178;
2869 
2870  Radar_blip_radius_normal = 4;
2871  Radar_blip_radius_target = 8;
2872 
2873  Radar_center_offsets[0] = 104.0f;
2874  Radar_center_offsets[1] = 85.0f;
2875 
2876  Radar_radius[0] = 192;
2877  Radar_radius[1] = 160;
2878 
2879  Radar_dist_offsets[0][0]=184;
2880  Radar_dist_offsets[0][1]=150;
2881 
2882  Radar_dist_offsets[1][0]=181;
2883  Radar_dist_offsets[1][1]=150;
2884 
2885  Radar_dist_offsets[2][0]=185;
2886  Radar_dist_offsets[2][1]=150;
2887 
2888  strcpy_s(fname, "2_radar1");
2889  }
2890 
2891  HudGaugeRadarOrb* hud_gauge = gauge_load_common<HudGaugeRadarOrb>(settings);
2892 
2893  if(optional_string("Filename:")) {
2895  }
2896  if(optional_string("Radar Center Offsets:")) {
2897  stuff_float_list(Radar_center_offsets, 2);
2898  }
2899  if(optional_string("Radar Size:")) {
2900  stuff_int_list(Radar_radius, 2);
2901  }
2902  if(optional_string("Infinity Distance Offsets:")) {
2903  stuff_int_list(Radar_dist_offsets[2], 2);
2904  }
2905  if(optional_string("Long Distance Offsets:")) {
2906  stuff_int_list(Radar_dist_offsets[1], 2);
2907  }
2908  if(optional_string("Short Distance Offsets:")) {
2909  stuff_int_list(Radar_dist_offsets[0], 2);
2910  }
2911 
2912  //only load this if the user actually wants to use the orb radar.
2913  if (Cmdline_orb_radar == 1) {
2914  hud_gauge->initBitmaps(fname);
2915  hud_gauge->initBlipRadius(Radar_blip_radius_normal, Radar_blip_radius_target);
2916  hud_gauge->initCenterOffsets(Radar_center_offsets[0], Radar_center_offsets[1]);
2917  hud_gauge->initDistanceInfinityOffsets(Radar_dist_offsets[2][0], Radar_dist_offsets[2][1]);
2918  hud_gauge->initDistanceLongOffsets(Radar_dist_offsets[1][0], Radar_dist_offsets[1][1]);
2919  hud_gauge->initDistanceShortOffsets(Radar_dist_offsets[0][0], Radar_dist_offsets[0][1]);
2920  hud_gauge->initRadius(Radar_radius[0], Radar_radius[1]);
2921  hud_gauge->initInfinityIcon();
2922 
2923  if(settings->ship_idx->at(0) >= 0) {
2924  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
2925  HudGaugeRadarOrb* instance = new HudGaugeRadarOrb();
2926  *instance = *hud_gauge;
2927  Ship_info[*ship_index].hud_gauges.push_back(instance);
2928  }
2929  delete hud_gauge;
2930  } else {
2931  default_hud_gauges.push_back(hud_gauge);
2932  }
2933  }
2934  else
2935  {
2936  // cleanup
2937  delete hud_gauge;
2938  }
2939 }
2940 
2946 {
2947  // basic radar gauge info
2948  int Radar_radius[2];
2949 
2950  // bitmap filenames for the effect
2951  char xy_fname[MAX_FILENAME_LEN] = "dradis_xy";
2952  char xz_yz_fname[MAX_FILENAME_LEN] = "dradis_xz_yz";
2953  char sweep_fname[MAX_FILENAME_LEN] = "dradis_sweep";
2954  char target_fname[MAX_FILENAME_LEN] = "dradis_target";
2955  char unknown_fname[MAX_FILENAME_LEN] = "dradis_unknown";
2956 
2957  // render to texture parameters
2958  char display_name[MAX_FILENAME_LEN] = "";
2959  int display_offset[2] = {0, 0};
2960  int display_size[2] = {0, 0};
2961  int canvas_size[2] = {0, 0};
2962 
2963  int loop_snd = -1;
2964  float loop_snd_volume = 1.0f;
2965 
2966  int arrival_beep_snd = -1;
2967  int departure_beep_snd = -1;
2968 
2969  int stealth_arrival_snd = -1;
2970  int stealth_departure_snd = -1;
2971 
2972  float arrival_beep_delay = 0.0f;
2973  float departure_beep_delay = 0.0f;
2974 
2975  settings->origin[0] = 0.5f;
2976  settings->origin[1] = 1.0f;
2977 
2978  if(gr_screen.res == GR_640) {
2979  settings->offset[0] = -89;
2980  settings->offset[1] = -148;
2981  } else {
2982  settings->offset[0] = -143;
2983  settings->offset[1] = -237;
2984  }
2985 
2986  Radar_radius[0] = 281;
2987  Radar_radius[1] = 233;
2988 
2989  if(check_base_res(settings->base_res)) {
2990  if(optional_string("Position:")) {
2991  stuff_int_list(settings->coords, 2);
2992  settings->use_coords = true;
2993  } else {
2994  if (optional_string("Scale Gauge:")) {
2995  stuff_boolean(&settings->scale_gauge);
2996  }
2997 
2998  if (optional_string("Force Scaling Above:")) {
3000  }
3001 
3002  adjust_base_res(settings->base_res, settings->force_scaling_above_res, settings->scale_gauge);
3003 
3004  if(optional_string("Origin:")) {
3005  stuff_float_list(settings->origin, 2);
3006 
3007  required_string("Offset:");
3008  stuff_int_list(settings->offset, 2);
3009  }
3010 
3011  if(optional_string("Offset:")) {
3012  Error(LOCATION, "HUD gauges table: Offset must also have Origin defined");
3013  }
3014 
3015  settings->coords[0] = (int)(settings->base_res[0] * settings->origin[0]) + settings->offset[0];
3016  settings->coords[1] = (int)(settings->base_res[1] * settings->origin[1]) + settings->offset[1];
3017  settings->use_coords = true;
3018  }
3019  } else {
3020  if(gr_screen.res == GR_640) {
3021  settings->base_res[0] = 640;
3022  settings->base_res[1] = 480;
3023  } else {
3024  settings->base_res[0] = 1024;
3025  settings->base_res[1] = 768;
3026  }
3027 
3028  adjust_base_res(settings->base_res, settings->force_scaling_above_res, settings->scale_gauge);
3029 
3030  settings->coords[0] = (int)(settings->base_res[0] * settings->origin[0]) + settings->offset[0];
3031  settings->coords[1] = (int)(settings->base_res[1] * settings->origin[1]) + settings->offset[1];
3032  settings->use_coords = true;
3033  }
3034 
3035  if(optional_string("Font:")) {
3036  stuff_int(&settings->font_num);
3037  } else {
3038  if ( settings->font_num < 0 ) {
3039  settings->font_num = FONT1;
3040  }
3041  }
3042 
3043  if(optional_string("Size:")) {
3044  stuff_int_list(Radar_radius, 2);
3045  }
3046  if(optional_string("XY Disc Filename:")) {
3047  stuff_string(xy_fname, F_NAME, MAX_FILENAME_LEN);
3048  }
3049  if(optional_string("XZ YZ Disc Filename:")) {
3050  stuff_string(xz_yz_fname, F_NAME, MAX_FILENAME_LEN);
3051  }
3052  if(optional_string("Sweep Disc Filename:")) {
3053  stuff_string(sweep_fname, F_NAME, MAX_FILENAME_LEN);
3054  }
3055  if(optional_string("Default Contact Filename:")) {
3056  stuff_string(target_fname, F_NAME, MAX_FILENAME_LEN);
3057  }
3058  if(optional_string("Unknown Contact Filename:")) {
3059  stuff_string(unknown_fname, F_NAME, MAX_FILENAME_LEN);
3060  }
3061  if(optional_string("Cockpit Target:") && settings->ship_idx->at(0) >= 0) {
3062  stuff_string(display_name, F_NAME, MAX_FILENAME_LEN);
3063 
3064  if(optional_string("Canvas Size:")) {
3065  stuff_int_list(canvas_size, 2);
3066  }
3067 
3068  if ( optional_string("Display Offset:") ) {
3069  stuff_int_list(display_offset, 2);
3070  }
3071 
3072  required_string("Display Size:");
3073  stuff_int_list(display_size, 2);
3074  } else {
3075  // adjust for multimonitor setups ONLY if not rendering gauge to a texture
3076  adjust_for_multimonitor(settings->base_res, true, settings->coords);
3077  }
3078 
3079  parse_sound("Loop Sound:", &loop_snd, "DRADIS HudGauge");
3080 
3081  if (optional_string("Loop Volume:"))
3082  {
3083  stuff_float(&loop_snd_volume);
3084 
3085  if (loop_snd_volume <= 0.0f)
3086  {
3087  Warning(LOCATION, "\"Loop Volume:\" value of \"%f\" is invalid! Must be more than zero! Resetting to default.", arrival_beep_delay);
3088  loop_snd_volume = 1.0f;
3089  }
3090  }
3091 
3092  parse_sound("Arrival Beep Sound:", &arrival_beep_snd, "DRADIS HudGauge");
3093  parse_sound("Stealth arrival Beep Sound:", &stealth_arrival_snd, "DRADIS HudGauge");
3094 
3095  if (optional_string("Minimum Beep Delay:"))
3096  {
3097  stuff_float(&arrival_beep_delay);
3098 
3099  if (arrival_beep_delay < 0.0f)
3100  {
3101  Warning(LOCATION, "\"Minimum Beep Delay:\" value of \"%f\" is invalid! Must be more than or equal to zero! Resetting to default.", arrival_beep_delay);
3102  arrival_beep_delay = 0.0f;
3103  }
3104  }
3105 
3106  parse_sound("Departure Beep Sound:", &departure_beep_snd, "DRADIS HudGauge");
3107  parse_sound("Stealth departure Beep Sound:", &stealth_departure_snd, "DRADIS HudGauge");
3108 
3109  if (optional_string("Minimum Beep Delay:"))
3110  {
3111  stuff_float(&departure_beep_delay);
3112 
3113  if (departure_beep_delay < 0.0f)
3114  {
3115  Warning(LOCATION, "\"Minimum Beep Delay:\" value of \"%f\" is invalid! Must be more than or equal to zero! Resetting to default.", departure_beep_delay);
3116  departure_beep_delay = 0.0f;
3117  }
3118  }
3119 
3120  HudGaugeRadarDradis* hud_gauge = new HudGaugeRadarDradis();
3121  hud_gauge->initBaseResolution(settings->base_res[0], settings->base_res[1]);
3122  hud_gauge->initPosition(settings->coords[0], settings->coords[1]);
3123  hud_gauge->initRadius(Radar_radius[0], Radar_radius[1]);
3124  hud_gauge->initBitmaps(xy_fname, xz_yz_fname, sweep_fname, target_fname, unknown_fname);
3125  hud_gauge->initCockpitTarget(display_name, display_offset[0], display_offset[1], display_size[0], display_size[1], canvas_size[0], canvas_size[1]);
3126  hud_gauge->initFont(settings->font_num);
3127  hud_gauge->initSound(loop_snd, loop_snd_volume, arrival_beep_snd, departure_beep_snd, stealth_arrival_snd, stealth_departure_snd, arrival_beep_delay, departure_beep_delay);
3128 
3129  if(settings->ship_idx->at(0) >= 0) {
3130  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
3131  HudGaugeRadarDradis* instance = new HudGaugeRadarDradis();
3132  *instance = *hud_gauge;
3133  Ship_info[*ship_index].hud_gauges.push_back(instance);
3134  }
3135  delete hud_gauge;
3136  } else {
3137  default_hud_gauges.push_back(hud_gauge);
3138  }
3139 }
3140 
3142 {
3143  settings->origin[0] = 0.5f;
3144  settings->origin[1] = 0.5f;
3145  settings->slew = true;
3146 
3147  if(gr_screen.res == GR_640) {
3148  settings->offset[0] = 0;
3149  settings->offset[1] = -68;
3150  } else {
3151  settings->offset[0] = 0;
3152  settings->offset[1] = -109;
3153  }
3154 
3155  HudGaugeTextWarnings* hud_gauge = gauge_load_common<HudGaugeTextWarnings>(settings);
3156 
3157  if(settings->ship_idx->at(0) >= 0) {
3158  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
3159  HudGaugeTextWarnings* instance = new HudGaugeTextWarnings();
3160  *instance = *hud_gauge;
3161  Ship_info[*ship_index].hud_gauges.push_back(instance);
3162  }
3163  delete hud_gauge;
3164  } else {
3165  default_hud_gauges.push_back(hud_gauge);
3166  }
3167 }
3168 
3170 {
3171  int Viewport_size[2];
3172  int Viewport_offsets[2];
3173  int Integrity_bar_offsets[2];
3174  int Integrity_bar_h;
3175  int Status_offsets[2];
3176  int Name_offsets[2];
3177  int Class_offsets[2];
3178  int Dist_offsets[2];
3179  int Speed_offsets[2];
3180  int Cargo_string_offsets[2];
3181  int Hull_offsets[2];
3182  int Cargo_scan_start_offsets[2];
3183  int Cargo_scan_size[2];
3184 
3185  int Subsys_name_offsets[2] = {0, 0};
3186  bool Use_subsys_name_offsets = false;
3187 
3188  int Subsys_integrity_offsets[2] = {0, 0};
3189  bool Use_subsys_integrity_offsets = false;
3190 
3191  int Disabled_status_offsets[2] = {0, 0};
3192  bool Use_disabled_status_offsets = false;
3193 
3194  bool desaturate = false;
3195 
3196  char fname_monitor[MAX_FILENAME_LEN] = "targetview1";
3197  char fname_integrity[MAX_FILENAME_LEN] = "targetview2";
3198  char fname_static[MAX_FILENAME_LEN] = "TargetStatic";
3199  char fname_monitor_mask[MAX_FILENAME_LEN] = "";
3200 
3201  settings->origin[0] = 0.0f;
3202  settings->origin[1] = 1.0f;
3203 
3204  if(gr_screen.res == GR_640) {
3205  settings->offset[0] = 5;
3206  settings->offset[1] = -161;
3207  } else {
3208  settings->offset[0] = 5;
3209  settings->offset[1] = -178;
3210  }
3211 
3212  Viewport_size[0] = 131;
3213  Viewport_size[1] = 112;
3214  Viewport_offsets[0] = 3;
3215  Viewport_offsets[1] = 39;
3216 
3217  Integrity_bar_offsets[0] = 133;
3218  Integrity_bar_offsets[1] = 52;
3219  Integrity_bar_h = 88;
3220  Status_offsets[0] = 107;
3221  Status_offsets[1] = 53;
3222 
3223  Name_offsets[0] = 8;
3224  Name_offsets[1] = -3;
3225  Class_offsets[0] = 8;
3226  Class_offsets[1] = 7;
3227  Dist_offsets[0] = 8;
3228  Dist_offsets[1] = 18;
3229  Speed_offsets[0] = 85;
3230  Speed_offsets[1] = 18;
3231  Cargo_string_offsets[0] = 8;
3232  Cargo_string_offsets[1] = 30;
3233 
3234  // remember, below coords describe the rightmost position of their respective sub-element, not leftmost like it usually does.
3235  Hull_offsets[0] = 134;
3236  Hull_offsets[1] = 42;
3237 
3238  Cargo_scan_start_offsets[0] = 2;
3239  Cargo_scan_start_offsets[1] = 45;
3240  Cargo_scan_size[0] = 130;
3241  Cargo_scan_size[1] = 109;
3242 
3243  HudGaugeTargetBox* hud_gauge = gauge_load_common<HudGaugeTargetBox>(settings);
3244 
3245  if(optional_string("Monitor Filename:")) {
3246  stuff_string(fname_monitor, F_NAME, MAX_FILENAME_LEN);
3247  }
3248  if(optional_string("Monitor Alpha Mask Filename:")) {
3249  stuff_string(fname_monitor_mask, F_NAME, MAX_FILENAME_LEN);
3250  }
3251  if(optional_string("Integrity Bar Filename:")) {
3252  stuff_string(fname_integrity, F_NAME, MAX_FILENAME_LEN);
3253  }
3254  if(optional_string("Viewport Offsets:")) {
3255  stuff_int_list(Viewport_offsets, 2);
3256  }
3257  if(optional_string("Viewport Size:")) {
3258  stuff_int_list(Viewport_size, 2);
3259  }
3260  if(optional_string("Integrity Bar Offsets:")) {
3261  stuff_int_list(Integrity_bar_offsets, 2);
3262  }
3263  if(optional_string("Integrity Bar Foreground Clip Height:")) {
3264  stuff_int(&Integrity_bar_h);
3265  }
3266  if(optional_string("Status Offsets:")) {
3267  stuff_int_list(Status_offsets, 2);
3268  }
3269  if(optional_string("Name Offsets:")) {
3270  stuff_int_list(Name_offsets, 2);
3271  }
3272  if(optional_string("Class Offsets:")) {
3273  stuff_int_list(Class_offsets, 2);
3274  }
3275  if(optional_string("Distance Offsets:")) {
3276  stuff_int_list(Dist_offsets, 2);
3277  }
3278  if(optional_string("Speed Offsets:")) {
3279  stuff_int_list(Speed_offsets, 2);
3280  }
3281  if(optional_string("Hull Offsets:")) {
3282  stuff_int_list(Hull_offsets, 2);
3283  }
3284  if(optional_string("Cargo Contents Offsets:")) {
3285  stuff_int_list(Cargo_string_offsets, 2);
3286  }
3287  if(optional_string("Cargo Scan Start Offsets:")) {
3288  stuff_int_list(Cargo_scan_start_offsets, 2);
3289  }
3290  if(optional_string("Cargo Scan Size:")) {
3291  stuff_int_list(Cargo_scan_size, 2);
3292  }
3293  if ( optional_string("Subsystem Name Offsets:") ) {
3294  stuff_int_list(Subsys_name_offsets, 2);
3295  Use_subsys_name_offsets = true;
3296  }
3297  if ( optional_string("Subsystem Integrity Offsets:") ) {
3298  stuff_int_list(Subsys_integrity_offsets, 2);
3299  Use_subsys_integrity_offsets = true;
3300  }
3301  if ( optional_string("Disabled Status Offsets:") ) {
3302  stuff_int_list(Disabled_status_offsets, 2);
3303  Use_disabled_status_offsets = true;
3304  }
3305  if ( optional_string("Desaturate:") ) {
3306  stuff_boolean(&desaturate);
3307  }
3308 
3309  hud_gauge->initViewportOffsets(Viewport_offsets[0], Viewport_offsets[1]);
3310  hud_gauge->initViewportSize(Viewport_size[0], Viewport_size[1]);
3311  hud_gauge->initIntegrityOffsets(Integrity_bar_offsets[0], Integrity_bar_offsets[1]);
3312  hud_gauge->initIntegrityHeight(Integrity_bar_h);
3313  hud_gauge->initStatusOffsets(Status_offsets[0], Status_offsets[1]);
3314  hud_gauge->initNameOffsets(Name_offsets[0], Name_offsets[1]);
3315  hud_gauge->initClassOffsets(Class_offsets[0], Class_offsets[1]);
3316  hud_gauge->initDistOffsets(Dist_offsets[0], Dist_offsets[1]);
3317  hud_gauge->initSpeedOffsets(Speed_offsets[0], Speed_offsets[1]);
3318  hud_gauge->initCargoStringOffsets(Cargo_string_offsets[0], Cargo_string_offsets[1]);
3319  hud_gauge->initHullOffsets(Hull_offsets[0], Hull_offsets[1]);
3320  hud_gauge->initCargoScanStartOffsets(Cargo_scan_start_offsets[0], Cargo_scan_start_offsets[1]);
3321  hud_gauge->initCargoScanSize(Cargo_scan_size[0], Cargo_scan_size[1]);
3322  hud_gauge->initSubsysNameOffsets(Subsys_name_offsets[0], Subsys_name_offsets[1], Use_subsys_name_offsets);
3323  hud_gauge->initSubsysIntegrityOffsets(Subsys_integrity_offsets[0], Subsys_integrity_offsets[1], Use_subsys_integrity_offsets);
3324  hud_gauge->initDisabledStatusOffsets(Disabled_status_offsets[0], Disabled_status_offsets[1], Use_disabled_status_offsets);
3325  hud_gauge->initDesaturate(desaturate);
3326  hud_gauge->initBitmaps(fname_monitor, fname_monitor_mask, fname_integrity, fname_static);
3327 
3328  if(settings->ship_idx->at(0) >= 0) {
3329  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
3330  HudGaugeTargetBox* instance = new HudGaugeTargetBox();
3331  *instance = *hud_gauge;
3332  Ship_info[*ship_index].hud_gauges.push_back(instance);
3333  }
3334  delete hud_gauge;
3335  } else {
3336  default_hud_gauges.push_back(hud_gauge);
3337  }
3338 }
3339 
3341 {
3342  int Pgup_offsets[2];
3343  int Pgdn_offsets[2];
3344  int Header_offsets[2];
3345  int Item_start_offsets[2];
3346  int Middle_frame_start_offset_y;
3347  int bottom_bg_offset = 0;
3348  int Item_h;
3349  int Item_offset_x;
3350  char fname_top[MAX_FILENAME_LEN] = "message1";
3351  char fname_middle[MAX_FILENAME_LEN] = "message2";
3352  char fname_bottom[MAX_FILENAME_LEN] = "message3";
3353 
3354  settings->origin[0] = 1.0f;
3355  settings->origin[1] = 0.0f;
3356 
3357  if(gr_screen.res == GR_640) {
3358  settings->offset[0] = -195;
3359  settings->offset[1] = 5;
3360 
3361  Pgup_offsets[0] = 145;
3362  Pgup_offsets[1] = 4;
3363  Pgdn_offsets[0] = 145;
3364  Pgdn_offsets[1] = 115;
3365  } else {
3366  settings->offset[0] = -197;
3367  settings->offset[1] = 5;
3368 
3369  Pgup_offsets[0] = 110;
3370  Pgup_offsets[1] = 5;
3371  Pgdn_offsets[0] = 110;
3372  Pgdn_offsets[1] = 115;
3373  }
3374 
3375  Header_offsets[0] = 2;
3376  Header_offsets[1] = 1;
3377  Item_start_offsets[0] = 4;
3378  Item_start_offsets[1] = 13;
3379  Middle_frame_start_offset_y = 12;
3380  Item_h = 10;
3381  Item_offset_x = 17;
3382 
3383  HudGaugeSquadMessage* hud_gauge = gauge_load_common<HudGaugeSquadMessage>(settings);
3384 
3385  if(optional_string("Top Background Filename:")) {
3386  stuff_string(fname_top, F_NAME, MAX_FILENAME_LEN);
3387  }
3388  if(optional_string("Entry Background Filename:")) {
3389  stuff_string(fname_middle, F_NAME, MAX_FILENAME_LEN);
3390  }
3391  if(optional_string("Bottom Background Filename:")) {
3392  stuff_string(fname_bottom, F_NAME, MAX_FILENAME_LEN);
3393  }
3394  if(optional_string("Header Offsets:")) {
3395  stuff_int_list(Header_offsets, 2);
3396  }
3397  if(optional_string("List Start Offsets:")) {
3398  stuff_int_list(Item_start_offsets, 2);
3399  }
3400  if(optional_string("Top Background Height:")) {
3401  stuff_int(&Middle_frame_start_offset_y);
3402  }
3403  if(optional_string("Entry Height:")) {
3404  stuff_int(&Item_h);
3405  }
3406  if(optional_string("Bottom Background Offset:")) {
3407  stuff_int(&bottom_bg_offset);
3408  }
3409  if(optional_string("Command X-offset:")) {
3410  stuff_int(&Item_offset_x);
3411  }
3412  if(optional_string("Page Up Offsets:")) {
3413  stuff_int_list(Pgup_offsets, 2);
3414  }
3415  if(optional_string("Page Down Offsets:")) {
3416  stuff_int_list(Pgdn_offsets, 2);
3417  }
3418 
3419  hud_gauge->initBitmaps(fname_top, fname_middle, fname_bottom);
3420  hud_gauge->initHeaderOffsets(Header_offsets[0], Header_offsets[1]);
3421  hud_gauge->initItemStartOffsets(Item_start_offsets[0], Item_start_offsets[1]);
3422  hud_gauge->initMiddleFrameStartOffsetY(Middle_frame_start_offset_y);
3423  hud_gauge->initBottomBgOffset(bottom_bg_offset);
3424  hud_gauge->initItemHeight(Item_h);
3425  hud_gauge->initItemOffsetX(Item_offset_x);
3426  hud_gauge->initPgUpOffsets(Pgup_offsets[0], Pgup_offsets[1]);
3427  hud_gauge->initPgDnOffsets(Pgdn_offsets[0], Pgdn_offsets[1]);
3428 
3429  if(settings->ship_idx->at(0) >= 0) {
3430  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
3431  HudGaugeSquadMessage* instance = new HudGaugeSquadMessage();
3432  *instance = *hud_gauge;
3433  Ship_info[*ship_index].hud_gauges.push_back(instance);
3434  }
3435  delete hud_gauge;
3436  } else {
3437  default_hud_gauges.push_back(hud_gauge);
3438  }
3439 }
3440 
3442 {
3443  int Objective_text_offset_y;
3444  int Objective_text_val_offset_y;
3445  int Subspace_text_offset_y;
3446  int Subspace_text_val_offset_y;
3447  int Red_text_offset_y;
3448  int Red_text_val_offset_y;
3449  char fname[MAX_FILENAME_LEN] = "objective1";
3450 
3451  settings->origin[0] = 0.5f;
3452  settings->origin[1] = 0.5f;
3453 
3454  if(gr_screen.res == GR_640) {
3455  settings->offset[0] = -75;
3456  settings->offset[1] = -126;
3457 
3458  Objective_text_offset_y = 2;
3459  Objective_text_val_offset_y = 11;
3460  Subspace_text_offset_y = 2;
3461  Subspace_text_val_offset_y = 10;
3462  Red_text_offset_y = 2;
3463  Red_text_val_offset_y = 10;
3464  } else {
3465  settings->offset[0] = -76;
3466  settings->offset[1] = -200;
3467 
3468  Objective_text_offset_y = 2;
3469  Objective_text_val_offset_y = 11;
3470  Subspace_text_offset_y = 2;
3471  Subspace_text_val_offset_y = 10;
3472  Red_text_offset_y = 2;
3473  Red_text_val_offset_y = 10;
3474  }
3475 
3476  HudGaugeObjectiveNotify* hud_gauge = gauge_load_common<HudGaugeObjectiveNotify>(settings);
3477 
3478  if(optional_string("Filename:")) {
3480  }
3481  if(optional_string("Objective Text Y-offset:")) {
3482  stuff_int(&Objective_text_offset_y);
3483  }
3484  if(optional_string("Objective Value Y-offset:")) {
3485  stuff_int(&Objective_text_val_offset_y);
3486  }
3487  if(optional_string("Subspace Text Y-offset:")) {
3488  stuff_int(&Subspace_text_offset_y);
3489  }
3490  if(optional_string("Subspace Value Y-offset:")) {
3491  stuff_int(&Subspace_text_val_offset_y);
3492  }
3493  if(optional_string("Red Alert Text Y-offset:")) {
3494  stuff_int(&Red_text_offset_y);
3495  }
3496  if(optional_string("Red Alert Value Y-offset:")) {
3497  stuff_int(&Red_text_val_offset_y);
3498  }
3499 
3500  hud_gauge->initBitmaps(fname);
3501  hud_gauge->initObjTextOffsetY(Objective_text_offset_y);
3502  hud_gauge->initObjValueOffsetY(Objective_text_val_offset_y);
3503  hud_gauge->initSubspaceTextOffsetY(Subspace_text_offset_y);
3504  hud_gauge->initSubspaceValueOffsetY(Subspace_text_val_offset_y);
3505  hud_gauge->initRedAlertTextOffsetY(Red_text_offset_y);
3506  hud_gauge->initRedAlertValueOffsetY(Red_text_val_offset_y);
3507 
3508  if(settings->ship_idx->at(0) >= 0) {
3509  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
3511  *instance = *hud_gauge;
3512  Ship_info[*ship_index].hud_gauges.push_back(instance);
3513  }
3514  delete hud_gauge;
3515  } else {
3516  default_hud_gauges.push_back(hud_gauge);
3517  }
3518 }
3519 
3521 {
3522  int top_offset_x[NUM_HUD_SETTINGS];
3523  int Weapon_header_offsets[NUM_HUD_SETTINGS][2];
3524  int frame_offset_x[NUM_HUD_SETTINGS];
3525  int Weapon_plink_offset_x;
3526  int Weapon_pname_offset_x;
3527  int Weapon_pammo_offset_x;
3528  int Weapon_sammo_offset_x;
3529  int Weapon_sname_offset_x;
3530  int Weapon_sreload_offset_x;
3531  int Weapon_slinked_offset_x;
3532  int Weapon_sunlinked_offset_x;
3533  int top_primary_h;
3534  int top_secondary_h;
3535  int pname_start_offset_y;
3536  int sname_start_offset_y;
3537  int primary_text_h;
3538  int secondary_text_h;
3539 
3540  // thank god both GR640 and GR1024 use the same weapons gauge bitmaps
3541  char fname_p_top[MAX_FILENAME_LEN] = "weapons1";
3542  char fname_p_top_b[MAX_FILENAME_LEN] = "weapons1_b";
3543  char fname_p_middle[MAX_FILENAME_LEN] = "weapons2";
3544  char fname_p_middle_b[MAX_FILENAME_LEN] = "weapons2_b";
3545  char fname_p_last[MAX_FILENAME_LEN] = "weapons6";
3546  // The bottom portion of the primary weapons listing for the ballistic ammo version of this gauge can simply use the middle portion.
3547  char fname_p_last_b[MAX_FILENAME_LEN] = "weapons2_b";
3548  char fname_s_top[MAX_FILENAME_LEN] = "weapons3";
3549  char fname_s_top_b[MAX_FILENAME_LEN] = "weapons3_b";
3550  char fname_s_middle[MAX_FILENAME_LEN] = "weapons4";
3551  char fname_s_middle_b[MAX_FILENAME_LEN] = "weapons4_b";
3552  char fname_s_bottom[MAX_FILENAME_LEN] = "weapons5";
3553  char fname_s_bottom_b[MAX_FILENAME_LEN] = "weapons5_b";
3554 
3555  settings->origin[0] = 1.0f;
3556  settings->origin[1] = 1.0f;
3557 
3558  if(gr_screen.res == GR_640) {
3559  settings->offset[0] = -143;
3560  settings->offset[1] = -228;
3561  } else {
3562  settings->offset[0] = -144;
3563  settings->offset[1] = -257;
3564  }
3565 
3566  top_offset_x[0] = 12;
3567  top_offset_x[1] = -12;
3568 
3569  Weapon_header_offsets[0][0] = 21;
3570  Weapon_header_offsets[0][1] = 2;
3571  Weapon_header_offsets[1][0] = -10;
3572  Weapon_header_offsets[1][1] = 2;
3573 
3574  frame_offset_x[0] = 0;
3575  frame_offset_x[1] = -12;
3576 
3577  Weapon_plink_offset_x = 33;
3578  Weapon_pname_offset_x = 39;
3579  Weapon_pammo_offset_x = 28;
3580  Weapon_sammo_offset_x = 28;
3581  Weapon_sname_offset_x = 39;
3582  Weapon_sreload_offset_x = 118;
3583  Weapon_slinked_offset_x = 28;
3584  Weapon_sunlinked_offset_x = 33;
3585 
3586  top_primary_h = 20;
3587  top_secondary_h = 12;
3588  pname_start_offset_y = 12;
3589  sname_start_offset_y = 4;
3590 
3591  primary_text_h = 12;
3592  secondary_text_h = 9;
3593 
3594  HudGaugeWeapons* hud_gauge = gauge_load_common<HudGaugeWeapons>(settings);
3595 
3596  if(optional_string("Primary List Top Background Filename:")) {
3597  stuff_string(fname_p_top, F_NAME, MAX_FILENAME_LEN);
3598  if(optional_string("Alt Ballistic Filename:")) {
3599  stuff_string(fname_p_top_b, F_NAME, MAX_FILENAME_LEN);
3600  }
3601  }
3602  if(optional_string("Primary List Middle Background Filename:")) {
3603  stuff_string(fname_p_middle, F_NAME, MAX_FILENAME_LEN);
3604  if(optional_string("Alt Ballistic Filename:")) {
3605  stuff_string(fname_p_middle_b, F_NAME, MAX_FILENAME_LEN);
3606  }
3607  }
3608  if(optional_string("Primary List Bottom Background Filename:")) {
3609  stuff_string(fname_p_last, F_NAME, MAX_FILENAME_LEN);
3610  if(optional_string("Alt Ballistic Filename:")) {
3611  stuff_string(fname_p_last_b, F_NAME, MAX_FILENAME_LEN);
3612  }
3613  }
3614  if(optional_string("Secondary List Top Background Filename:")) {
3615  stuff_string(fname_s_top, F_NAME, MAX_FILENAME_LEN);
3616  if(optional_string("Alt Ballistic Filename:")) {
3617  stuff_string(fname_s_top_b, F_NAME, MAX_FILENAME_LEN);
3618  }
3619  }
3620  if(optional_string("Secondary List Entry Background Filename:")) {
3621  stuff_string(fname_s_middle, F_NAME, MAX_FILENAME_LEN);
3622  if(optional_string("Alt Ballistic Filename:")) {
3623  stuff_string(fname_s_middle_b, F_NAME, MAX_FILENAME_LEN);
3624  }
3625  }
3626  if(optional_string("Secondary List Bottom Background Filename:")) {
3627  stuff_string(fname_s_bottom, F_NAME, MAX_FILENAME_LEN);
3628  if(optional_string("Alt Ballistic Filename:")) {
3629  stuff_string(fname_s_bottom_b, F_NAME, MAX_FILENAME_LEN);
3630  }
3631  }
3632  if(optional_string("Header Offsets:")) {
3633  stuff_int_list(Weapon_header_offsets[0], 2);
3634  if(optional_string("Alt Ballistic Offsets:")) {
3635  stuff_int_list(Weapon_header_offsets[1], 2);
3636  }
3637  }
3638  if(optional_string("Top Primary Background X-offset:")) {
3639  stuff_int(&top_offset_x[0]);
3640  if(optional_string("Alt Ballistic X-offset:")) {
3641  stuff_int(&top_offset_x[1]);
3642  }
3643  }
3644  if(optional_string("Text X-offset:")) {
3645  stuff_int(&frame_offset_x[0]);
3646  if(optional_string("Alt Ballistic X-offset:")) {
3647  stuff_int(&frame_offset_x[1]);
3648  }
3649  }
3650  if(optional_string("Top Primary Frame Height:")) {
3651  stuff_int(&top_primary_h);
3652  }
3653  if(optional_string("Top Secondary Frame Height:")) {
3654  stuff_int(&top_secondary_h);
3655  }
3656  if(optional_string("Primary List Start Y-offset:")) {
3657  stuff_int(&pname_start_offset_y);
3658  }
3659  if(optional_string("Secondary List Start Y-offset:")) {
3660  stuff_int(&sname_start_offset_y);
3661  }
3662  if(optional_string("Primary Weapon Ammo X-offset:")) {
3663  stuff_int(&Weapon_pammo_offset_x);
3664  }
3665  if(optional_string("Primary Weapon Link X-offset:")) {
3666  stuff_int(&Weapon_plink_offset_x);
3667  }
3668  if(optional_string("Primary Weapon Name X-offset:")) {
3669  stuff_int(&Weapon_pname_offset_x);
3670  }
3671  if(optional_string("Secondary Weapon Ammo X-offset:")) {
3672  stuff_int(&Weapon_sammo_offset_x);
3673  }
3674  if(optional_string("Secondary Weapon Unlinked X-offset:")) {
3675  stuff_int(&Weapon_sunlinked_offset_x);
3676  }
3677  if(optional_string("Secondary Weapon Linked X-offset:")) {
3678  stuff_int(&Weapon_slinked_offset_x);
3679  }
3680  if(optional_string("Secondary Weapon Name X-offset:")) {
3681  stuff_int(&Weapon_sname_offset_x);
3682  }
3683  if(optional_string("Secondary Weapon Reload X-offset:")) {
3684  stuff_int(&Weapon_sreload_offset_x);
3685  }
3686  if(optional_string("Primary Weapon Entry Height:")) {
3687  stuff_int(&primary_text_h);
3688  }
3689  if(optional_string("Secondary Weapon Entry Height:")) {
3690  stuff_int(&secondary_text_h);
3691  }
3692 
3693  hud_gauge->initBitmapsPrimaryTop(fname_p_top, fname_p_top_b);
3694  hud_gauge->initBitmapsPrimaryMiddle(fname_p_middle, fname_p_middle_b);
3695  hud_gauge->initBitmapsPrimaryLast(fname_p_last, fname_p_last_b);
3696  hud_gauge->initBitmapsSecondaryTop(fname_s_top, fname_s_top_b);
3697  hud_gauge->initBitmapsSecondaryMiddle(fname_s_middle, fname_s_middle_b);
3698  hud_gauge->initBitmapsSecondaryBottom(fname_s_bottom, fname_s_bottom_b);
3699  hud_gauge->initTopOffsetX(top_offset_x[0], top_offset_x[1]);
3700  hud_gauge->initHeaderOffsets(Weapon_header_offsets[0][0], Weapon_header_offsets[0][1],
3701  Weapon_header_offsets[1][0], Weapon_header_offsets[1][1]);
3702  hud_gauge->initFrameOffsetX(frame_offset_x[0], frame_offset_x[1]);
3703  hud_gauge->initStartNameOffsetsY(pname_start_offset_y, sname_start_offset_y);
3704  hud_gauge->initPrimaryWeaponOffsets(Weapon_plink_offset_x, Weapon_pname_offset_x, Weapon_pammo_offset_x);
3705  hud_gauge->initSecondaryWeaponOffsets(Weapon_sammo_offset_x, Weapon_sname_offset_x, Weapon_sreload_offset_x, Weapon_slinked_offset_x, Weapon_sunlinked_offset_x);
3706  hud_gauge->initPrimaryHeights(top_primary_h, primary_text_h);
3707  hud_gauge->initSecondaryHeights(top_secondary_h, secondary_text_h);
3708  hud_gauge->initLinkIcon();
3709 
3710  if(settings->ship_idx->at(0) >= 0) {
3711  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
3712  HudGaugeWeapons* instance = new HudGaugeWeapons();
3713  *instance = *hud_gauge;
3714  Ship_info[*ship_index].hud_gauges.push_back(instance);
3715  }
3716  delete hud_gauge;
3717  } else {
3718  default_hud_gauges.push_back(hud_gauge);
3719  }
3720 }
3721 
3723 {
3724  int header_offsets[2];
3725  int middle_frame_offset_y;
3726  int text_start_offsets[2];
3727  int text_h;
3728  int max_line_width = 167;
3729  char fname_top[MAX_FILENAME_LEN] = "directives1";
3730  char fname_middle[MAX_FILENAME_LEN] = "directives2";
3731  char fname_bottom[MAX_FILENAME_LEN] = "directives3";
3732  int bottom_bg_offset = 0;
3733 
3734  settings->origin[0] = 0.0f;
3735  settings->origin[1] = 0.5f;
3736 
3737  if(gr_screen.res == GR_640) {
3738  settings->offset[0] = 5;
3739  settings->offset[1] = -62;
3740  } else {
3741  settings->offset[0] = 5;
3742  settings->offset[1] = -106;
3743  }
3744 
3745  header_offsets[0] = 2;
3746  header_offsets[1] = 2;
3747  middle_frame_offset_y = 12;
3748  text_start_offsets[0] = 3;
3749  text_start_offsets[1] = 14;
3750  text_h = 9;
3751 
3752  HudGaugeDirectives* hud_gauge = gauge_load_common<HudGaugeDirectives>(settings);
3753 
3754  if(optional_string("Top Background Filename:")) {
3755  stuff_string(fname_top, F_NAME, MAX_FILENAME_LEN);
3756  }
3757  if(optional_string("Entry Background Filename:")) {
3758  stuff_string(fname_middle, F_NAME, MAX_FILENAME_LEN);
3759  }
3760  if(optional_string("Bottom Background Filename:")) {
3761  stuff_string(fname_bottom, F_NAME, MAX_FILENAME_LEN);
3762  }
3763  if(optional_string("Header Offsets:")) {
3764  stuff_int_list(header_offsets, 2);
3765  }
3766  if(optional_string("Top Background Height:")) {
3767  stuff_int(&middle_frame_offset_y);
3768  }
3769  if(optional_string("List Start Offsets:")) {
3770  stuff_int_list(text_start_offsets, 2);
3771  }
3772  if(optional_string("Entry Height:")) {
3773  stuff_int(&text_h);
3774  }
3775  if(optional_string("Bottom Background Offset:")) {
3776  stuff_int(&bottom_bg_offset);
3777  }
3778  if ( optional_string("Max Line Width:") ) {
3779  stuff_int(&max_line_width);
3780  }
3781 
3782  hud_gauge->initBitmaps(fname_top, fname_middle, fname_bottom);
3783  hud_gauge->initMiddleFrameOffsetY(middle_frame_offset_y);
3784  hud_gauge->initTextHeight(text_h);
3785  hud_gauge->initBottomBgOffset(bottom_bg_offset);
3786  hud_gauge->initTextStartOffsets(text_start_offsets[0], text_start_offsets[1]);
3787  hud_gauge->initHeaderOffsets(header_offsets[0], header_offsets[1]);
3788  hud_gauge->initMaxLineWidth(max_line_width);
3789 
3790  if(settings->ship_idx->at(0) >= 0) {
3791  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
3792  HudGaugeDirectives* instance = new HudGaugeDirectives();
3793  *instance = *hud_gauge;
3794  Ship_info[*ship_index].hud_gauges.push_back(instance);
3795  }
3796  delete hud_gauge;
3797  } else {
3798  default_hud_gauges.push_back(hud_gauge);
3799  }
3800 }
3801 
3803 {
3804  int Header_offsets[2];
3805  int Anim_offsets[2];
3806  int Anim_size[2];
3807  char fname[MAX_FILENAME_LEN] = "head1";
3808 
3809  settings->origin[0] = 0.0f;
3810  settings->origin[1] = 0.0f;
3811 
3812  if(gr_screen.res == GR_640) {
3813  settings->offset[0] = 5;
3814  settings->offset[1] = 35;
3815  } else {
3816  settings->offset[0] = 5;
3817  settings->offset[1] = 56;
3818  }
3819 
3820  Header_offsets[0] = 2;
3821  Header_offsets[1] = 2;
3822  Anim_offsets[0] = 2;
3823  Anim_offsets[1] = 10;
3824  Anim_size[0] = 160;
3825  Anim_size[1] = 120;
3826 
3827  HudGaugeTalkingHead* hud_gauge = gauge_load_common<HudGaugeTalkingHead>(settings);
3828 
3829  if(optional_string("Filename:")) {
3831  }
3832  if(optional_string("Header Offsets:")) {
3833  stuff_int_list(Header_offsets, 2);
3834  }
3835  if(optional_string("Animation Offsets:")) {
3836  stuff_int_list(Anim_offsets, 2);
3837  }
3838  if(optional_string("Animation Background Size:")) {
3839  mprintf(("Animation Background Size in hud_gauges.tbl and -hdg.tbms is deprecated. Use \"Animation Size\" instead.\n"));
3840  stuff_int_list(Anim_size, 2);
3841  }
3842  if(optional_string("Animation Size:")) {
3843  stuff_int_list(Anim_size, 2);
3844  }
3845 
3846  hud_gauge->initAnimOffsets(Anim_offsets[0], Anim_offsets[1]);
3847  hud_gauge->initAnimSizes(Anim_size[0], Anim_size[1]);
3848  hud_gauge->initBitmaps(fname);
3849  hud_gauge->initHeaderOffsets(Header_offsets[0], Header_offsets[1]);
3850 
3851  if(settings->ship_idx->at(0) >= 0) {
3852  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
3853  HudGaugeTalkingHead* instance = new HudGaugeTalkingHead();
3854  *instance = *hud_gauge;
3855  Ship_info[*ship_index].hud_gauges.push_back(instance);
3856  }
3857  delete hud_gauge;
3858  } else {
3859  default_hud_gauges.push_back(hud_gauge);
3860  }
3861 }
3862 
3864 {
3865  int cm_text_offset[2];
3866  int cm_text_val_offset[2];
3867  char fname[MAX_FILENAME_LEN] = "countermeasure1";
3868 
3869  settings->origin[0] = 1.0f;
3870  settings->origin[1] = 1.0f;
3871 
3872  if(gr_screen.res == GR_640) {
3873  settings->offset[0] = -143;
3874  settings->offset[1] = -137;
3875  } else {
3876  settings->offset[0] = -144;
3877  settings->offset[1] = -166;
3878  }
3879  cm_text_offset[0] = 36;
3880  cm_text_offset[1] = 4;
3881  cm_text_val_offset[0] = 9;
3882  cm_text_val_offset[1] = 4;
3883 
3884  HudGaugeCmeasures* hud_gauge = gauge_load_common<HudGaugeCmeasures>(settings);
3885 
3886  if(optional_string("Filename:")) {
3888  }
3889  if(optional_string("Text Offsets:")) {
3890  stuff_int_list(cm_text_offset, 2);
3891  }
3892  if(optional_string("Value Offsets:")) {
3893  stuff_int_list(cm_text_val_offset, 2);
3894  }
3895 
3896  hud_gauge->initBitmaps(fname);
3897  hud_gauge->initCountTextOffsets(cm_text_offset[0], cm_text_offset[1]);
3898  hud_gauge->initCountValueOffsets(cm_text_val_offset[0], cm_text_val_offset[1]);
3899 
3900  if(settings->ship_idx->at(0) >= 0) {
3901  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
3902  HudGaugeCmeasures* instance = new HudGaugeCmeasures();
3903  *instance = *hud_gauge;
3904  Ship_info[*ship_index].hud_gauges.push_back(instance);
3905  }
3906  delete hud_gauge;
3907  } else {
3908  default_hud_gauges.push_back(hud_gauge);
3909  }
3910 }
3911 
3913 {
3914  int auto_text_offset[2];
3915  int target_text_offset[2];
3916  char fname[MAX_FILENAME_LEN] = "toggle1";
3917 
3918  int on_color[4] = {0, 0, 0, 255};
3919  int off_color[4] = {-1, -1, -1, -1};
3920 
3921  settings->origin[0] = 1.0f;
3922  settings->origin[1] = 1.0f;
3923 
3924  if(gr_screen.res == GR_640) {
3925  settings->offset[0] = -63;
3926  settings->offset[1] = -100;
3927  } else {
3928  settings->offset[0] = -64;
3929  settings->offset[1] = -120;
3930  }
3931 
3932  auto_text_offset[0] = 13;
3933  auto_text_offset[1] = 2;
3934  if (Lcl_pl) {
3935  target_text_offset[0] = 2;
3936  target_text_offset[1] = 10;
3937  } else {
3938  target_text_offset[0] = 7;
3939  target_text_offset[1] = 10;
3940  }
3941 
3942  HudGaugeAutoTarget* hud_gauge = gauge_load_common<HudGaugeAutoTarget>(settings);
3943 
3944  if(optional_string("Filename:")) {
3946  }
3947  if(optional_string("Auto Offsets:")) {
3948  stuff_int_list(auto_text_offset, 2);
3949  }
3950  if(optional_string("Target Offsets:")) {
3951  stuff_int_list(target_text_offset, 2);
3952  }
3953 
3954  if ( optional_string("On Text Color:") ) {
3955  stuff_int_list(on_color, 4);
3956  }
3957 
3958  if ( optional_string("Off Text Color:") ) {
3959  stuff_int_list(off_color, 4);
3960  }
3961 
3962  hud_gauge->initAutoTextOffsets(auto_text_offset[0], auto_text_offset[1]);
3963  hud_gauge->initBitmaps(fname);
3964  hud_gauge->initTargetTextOffsets(target_text_offset[0], target_text_offset[1]);
3965  hud_gauge->initOnColor(on_color[0], on_color[1], on_color[2], on_color[3]);
3966  hud_gauge->initOffColor(off_color[0], off_color[1], off_color[2], off_color[3]);
3967 
3968  if(settings->ship_idx->at(0) >= 0) {
3969  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
3970  HudGaugeAutoTarget* instance = new HudGaugeAutoTarget();
3971  *instance = *hud_gauge;
3972  Ship_info[*ship_index].hud_gauges.push_back(instance);
3973  }
3974  delete hud_gauge;
3975  } else {
3976  default_hud_gauges.push_back(hud_gauge);
3977  }
3978 }
3979 
3981 {
3982  int auto_text_offset[2];
3983  int speed_text_offset[2];
3984  char fname[MAX_FILENAME_LEN] = "toggle1";
3985  int on_color[4] = {0, 0, 0, 255};
3986  int off_color[4] = {-1, -1, -1, -1};
3987 
3988  settings->origin[0] = 1.0f;
3989  settings->origin[1] = 1.0f;
3990 
3991  if(gr_screen.res == GR_640) {
3992  settings->offset[0] = -63;
3993  settings->offset[1] = -76;
3994  } else {
3995  settings->offset[0] = -64;
3996  settings->offset[1] = -96;
3997  }
3998 
3999  auto_text_offset[0] = 13;
4000  auto_text_offset[1] = 2;
4001  if (Lcl_pl) {
4002  speed_text_offset[0] = 9;
4003  speed_text_offset[1] = 10;
4004  } else {
4005  speed_text_offset[0] = 10;
4006  speed_text_offset[1] = 10;
4007  }
4008 
4009  HudGaugeAutoSpeed* hud_gauge = gauge_load_common<HudGaugeAutoSpeed>(settings);
4010 
4011  if(optional_string("Filename:")) {
4013  }
4014  if(optional_string("Auto Offsets:")) {
4015  stuff_int_list(auto_text_offset, 2);
4016  }
4017  if(optional_string("Speed Offsets:")) {
4018  stuff_int_list(speed_text_offset, 2);
4019  }
4020 
4021  if ( optional_string("On Text Color:") ) {
4022  stuff_int_list(on_color, 4);
4023  }
4024 
4025  if ( optional_string("Off Text Color:") ) {
4026  stuff_int_list(off_color, 4);
4027  }
4028 
4029  hud_gauge->initAutoTextOffsets(auto_text_offset[0], auto_text_offset[1]);
4030  hud_gauge->initBitmaps(fname);
4031  hud_gauge->initSpeedTextOffsets(speed_text_offset[0], speed_text_offset[1]);
4032  hud_gauge->initOnColor(on_color[0], on_color[1], on_color[2], on_color[3]);
4033  hud_gauge->initOffColor(off_color[0], off_color[1], off_color[2], off_color[3]);
4034 
4035  if(settings->ship_idx->at(0) >= 0) {
4036  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4037  HudGaugeAutoSpeed* instance = new HudGaugeAutoSpeed();
4038  *instance = *hud_gauge;
4039  Ship_info[*ship_index].hud_gauges.push_back(instance);
4040  }
4041  delete hud_gauge;
4042  } else {
4043  default_hud_gauges.push_back(hud_gauge);
4044  }
4045 }
4046 
4048 {
4049  int header_offsets[2];
4050  bool fixed_header_position;
4051  int left_frame_end_x;
4052 
4053  int single_wing_offsets[2];
4054  int multiple_wing_offsets[2];
4055  int wing_width;
4056  int right_bg_offset = 0;
4057  int wing_name_offsets[2];
4058 
4059  int wingmate_offsets[MAX_SHIPS_PER_WING][2];
4060  char fname_left[MAX_FILENAME_LEN] = "wingman1";
4061  char fname_middle[MAX_FILENAME_LEN] = "wingman2";
4062  char fname_right[MAX_FILENAME_LEN] = "wingman3";
4063  char fname_dots[MAX_FILENAME_LEN] = "wingman4";
4064  // "wingman5" isn't used anymore since Goober implemented string based wing names
4065 
4066  settings->origin[0] = 1.0f;
4067  settings->origin[1] = 0.0f;
4068 
4069  if(gr_screen.res == GR_640) {
4070  settings->offset[0] = -90;
4071  settings->offset[1] = 144;
4072  } else {
4073  settings->offset[0] = -92;
4074  settings->offset[1] = 144;
4075  }
4076 
4077  header_offsets[0] = 2;
4078  header_offsets[1] = 2;
4079  fixed_header_position = false;
4080  left_frame_end_x = 71;
4081 
4082  single_wing_offsets[0] = 28;
4083  single_wing_offsets[1] = 15;
4084  multiple_wing_offsets[0] = 46;
4085  multiple_wing_offsets[1] = 15;
4086  wing_width = 35;
4087  wing_name_offsets[0] = 15;
4088  wing_name_offsets[1] = 26;
4089 
4090  wingmate_offsets[0][0] = 11;
4091  wingmate_offsets[0][1] = 0;
4092  wingmate_offsets[1][0] = 4;
4093  wingmate_offsets[1][1] = 8;
4094  wingmate_offsets[2][0] = 18;
4095  wingmate_offsets[2][1] = 8;
4096  wingmate_offsets[3][0] = 11;
4097  wingmate_offsets[3][1] = 16;
4098  wingmate_offsets[4][0] = 0;
4099  wingmate_offsets[4][1] = 16;
4100  wingmate_offsets[5][0] = 22;
4101  wingmate_offsets[5][1] = 16;
4102 
4103  HudGaugeWingmanStatus* hud_gauge = gauge_load_common<HudGaugeWingmanStatus>(settings);
4104 
4105  if(optional_string("Left Background Filename:")) {
4106  stuff_string(fname_left, F_NAME, MAX_FILENAME_LEN);
4107  }
4108  if(optional_string("First Background Filename:")) {
4109  stuff_string(fname_left, F_NAME, MAX_FILENAME_LEN);
4110  }
4111  if(optional_string("Entry Background Filename:")) {
4112  stuff_string(fname_middle, F_NAME, MAX_FILENAME_LEN);
4113  }
4114  if(optional_string("Right Background Filename:") || optional_string("Last Background Filename:")) {
4115  stuff_string(fname_right, F_NAME, MAX_FILENAME_LEN);
4116  }
4117  if(optional_string("Dot Filename:")) {
4118  stuff_string(fname_dots, F_NAME, MAX_FILENAME_LEN);
4119  }
4120  if(optional_string("Header Offsets:")) {
4121  stuff_int_list(header_offsets, 2);
4122  }
4123  if(optional_string("Fixed Header Position:")) {
4124  stuff_boolean(&fixed_header_position);
4125  }
4126  if(optional_string("Left Background Width:")) {
4127  stuff_int(&left_frame_end_x);
4128  }
4129  if(optional_string("First Background Size:")) {
4130  stuff_int(&left_frame_end_x);
4131  }
4132  if(optional_string("Entry Width:")) {
4133  stuff_int(&wing_width);
4134  }
4135  if(optional_string("Entry Size:")) {
4136  stuff_int(&wing_width);
4137  }
4138  if(optional_string("Right Background Offset:") || optional_string("Last Background Offset:")) {
4139  stuff_int(&right_bg_offset);
4140  }
4141  if(optional_string("Single Wing Offsets:")) {
4142  stuff_int_list(single_wing_offsets, 2);
4143  }
4144  if(optional_string("Multiple Wing Start Offsets:")) {
4145  stuff_int_list(multiple_wing_offsets, 2);
4146  }
4147  if(optional_string("Wing Name Offsets:")) {
4148  stuff_int_list(wing_name_offsets, 2);
4149  }
4150  if(optional_string("Dot Offsets:")) {
4151  stuff_int_list(wingmate_offsets[0], 2);
4152  stuff_int_list(wingmate_offsets[1], 2);
4153  stuff_int_list(wingmate_offsets[2], 2);
4154  stuff_int_list(wingmate_offsets[3], 2);
4155  stuff_int_list(wingmate_offsets[4], 2);
4156  stuff_int_list(wingmate_offsets[5], 2);
4157  }
4158 
4159  int grow_mode = 0; //By default, expand the gauge to the left (in -x direction)
4160 
4161  if(optional_string("Expansion Mode:")) {
4162  if(optional_string("Right"))
4163  grow_mode = 1;
4164  else if(optional_string("Down"))
4165  grow_mode = 2;
4166  }
4167 
4168  hud_gauge->initBitmaps(fname_left, fname_middle, fname_right, fname_dots);
4169  hud_gauge->initHeaderOffsets(header_offsets[0], header_offsets[1]);
4170  hud_gauge->initFixedHeaderPosition(fixed_header_position);
4171  hud_gauge->initLeftFrameEndX(left_frame_end_x);
4172  hud_gauge->initMultipleWingOffsets(multiple_wing_offsets[0], multiple_wing_offsets[1]);
4173  hud_gauge->initSingleWingOffsets(single_wing_offsets[0], single_wing_offsets[1]);
4174  hud_gauge->initWingmate1Offsets(wingmate_offsets[0][0], wingmate_offsets[0][1]);
4175  hud_gauge->initWingmate2Offsets(wingmate_offsets[1][0], wingmate_offsets[1][1]);
4176  hud_gauge->initWingmate3Offsets(wingmate_offsets[2][0], wingmate_offsets[2][1]);
4177  hud_gauge->initWingmate4Offsets(wingmate_offsets[3][0], wingmate_offsets[3][1]);
4178  hud_gauge->initWingmate5Offsets(wingmate_offsets[4][0], wingmate_offsets[4][1]);
4179  hud_gauge->initWingmate6Offsets(wingmate_offsets[5][0], wingmate_offsets[5][1]);
4180  hud_gauge->initWingNameOffsets(wing_name_offsets[0], wing_name_offsets[1]);
4181  hud_gauge->initWingWidth(wing_width);
4182  hud_gauge->initRightBgOffset(right_bg_offset);
4183  hud_gauge->initGrowMode(grow_mode);
4184 
4185  if(settings->ship_idx->at(0) >= 0) {
4186  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4187  HudGaugeWingmanStatus* instance = new HudGaugeWingmanStatus();
4188  *instance = *hud_gauge;
4189  Ship_info[*ship_index].hud_gauges.push_back(instance);
4190  }
4191  delete hud_gauge;
4192  } else {
4193  default_hud_gauges.push_back(hud_gauge);
4194  }
4195 }
4196 
4198 {
4199  int header_offsets[2];
4200  int hull_integ_offsets[2];
4201  int hull_integ_val_offset_x;
4202  int middle_frame_start_offset_y;
4203  int subsys_integ_start_offsets[2];
4204  int subsys_integ_val_offset_x;
4205  int bottom_bg_offset = 0;
4206  int line_h;
4207  char fname_top[MAX_FILENAME_LEN] = "damage1";
4208  char fname_middle[MAX_FILENAME_LEN] = "damage2";
4209  char fname_bottom[MAX_FILENAME_LEN] = "damage3";
4210 
4211  settings->origin[0] = 0.5f;
4212  settings->origin[1] = 0.0f;
4213 
4214  if(gr_screen.res == GR_640) {
4215  settings->offset[0] = -75;
4216  settings->offset[1] = 38;
4217  } else {
4218  settings->offset[0] = -72;
4219  settings->offset[1] = 61;
4220  }
4221  header_offsets[0] = 3;
4222  header_offsets[1] = 2;
4223  hull_integ_offsets[0] = 4;
4224  hull_integ_offsets[1] = 15;
4225  hull_integ_val_offset_x = 142;
4226  middle_frame_start_offset_y = 25;
4227  subsys_integ_start_offsets[0] = 4;
4228  subsys_integ_start_offsets[1] = 27;
4229  subsys_integ_val_offset_x = 142;
4230  line_h = 9;
4231 
4232  HudGaugeDamage* hud_gauge = gauge_load_common<HudGaugeDamage>(settings);
4233 
4234  if(optional_string("Top Background Filename:")) {
4235  stuff_string(fname_top, F_NAME, MAX_FILENAME_LEN);
4236  }
4237  if(optional_string("Entry Background Filename:")) {
4238  stuff_string(fname_middle, F_NAME, MAX_FILENAME_LEN);
4239  }
4240  if(optional_string("Bottom Background Filename:")) {
4241  stuff_string(fname_bottom, F_NAME, MAX_FILENAME_LEN);
4242  }
4243  if(optional_string("Header Offsets:")) {
4244  stuff_int_list(header_offsets, 2);
4245  }
4246  if(optional_string("Hull Integrity Offsets:")) {
4247  stuff_int_list(hull_integ_offsets, 2);
4248  }
4249  if(optional_string("Hull Integrity Value X-offset:")) {
4250  stuff_int(&hull_integ_val_offset_x);
4251  }
4252  if(optional_string("Top Background Height:")) {
4253  stuff_int(&middle_frame_start_offset_y);
4254  }
4255  if(optional_string("Subsystem Entry Height:")) {
4256  stuff_int(&line_h);
4257  }
4258  if(optional_string("Subsystem List Start Offsets:")) {
4259  stuff_int_list(subsys_integ_start_offsets, 2);
4260  }
4261  if(optional_string("Subsystem Entry Value X-offset:")) {
4262  stuff_int(&subsys_integ_val_offset_x);
4263  }
4264  if(optional_string("Bottom Background Offset:")) {
4265  stuff_int(&bottom_bg_offset);
4266  }
4267 
4268  hud_gauge->initBitmaps(fname_top, fname_middle, fname_bottom);
4269  hud_gauge->initHullIntegOffsets(hull_integ_offsets[0], hull_integ_offsets[1]);
4270  hud_gauge->initHullIntegValueOffsetX(hull_integ_val_offset_x);
4271  hud_gauge->initLineHeight(line_h);
4272  hud_gauge->initMiddleFrameStartOffsetY(middle_frame_start_offset_y);
4273  hud_gauge->initSubsysIntegStartOffsets(subsys_integ_start_offsets[0], subsys_integ_start_offsets[1]);
4274  hud_gauge->initSubsysIntegValueOffsetX(subsys_integ_val_offset_x);
4275  hud_gauge->initBottomBgOffset(bottom_bg_offset);
4276  hud_gauge->initHeaderOffsets(header_offsets[0], header_offsets[1]);
4277 
4278  if(settings->ship_idx->at(0) >= 0) {
4279  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4280  HudGaugeDamage* instance = new HudGaugeDamage();
4281  *instance = *hud_gauge;
4282  Ship_info[*ship_index].hud_gauges.push_back(instance);
4283  }
4284  delete hud_gauge;
4285  } else {
4286  default_hud_gauges.push_back(hud_gauge);
4287  }
4288 }
4289 
4291 {
4292  int header_offsets[2];
4293  int text_val_offset_y;
4294  int text_dock_offset_x;
4295  int text_dock_val_offset_x;
4296  char fname[MAX_FILENAME_LEN] = "support1";
4297 
4298  settings->origin[0] = 0.5f;
4299  settings->origin[1] = 0.5f;
4300 
4301  if(gr_screen.res == GR_640) {
4302  settings->offset[0] = -55;
4303  settings->offset[1] = 94;
4304 
4305  header_offsets[0] = 2;
4306  header_offsets[1] = 1;
4307  text_val_offset_y = 14;
4308  text_dock_offset_x = 5;
4309  text_dock_val_offset_x = 63;
4310  } else {
4311  settings->offset[0] = -53;
4312  settings->offset[1] = 150;
4313 
4314  header_offsets[0] = 3;
4315  header_offsets[1] = 2;
4316  text_val_offset_y = 12;
4317  text_dock_offset_x = 6;
4318  text_dock_val_offset_x = 65;
4319  }
4320 
4321  HudGaugeSupport* hud_gauge = gauge_load_common<HudGaugeSupport>(settings);
4322 
4323  if(optional_string("Filename:")) {
4325  }
4326  if(optional_string("Header Offsets:")) {
4327  stuff_int_list(header_offsets, 2);
4328  }
4329  if(optional_string("Text Y-offset:")) {
4330  stuff_int(&text_val_offset_y);
4331  }
4332  if(optional_string("Dock Status X-offset:")) {
4333  stuff_int(&text_dock_offset_x);
4334  }
4335  if(optional_string("Dock Time X-offset:")) {
4336  stuff_int(&text_dock_val_offset_x);
4337  }
4338 
4339  hud_gauge->initBitmaps(fname);
4340  hud_gauge->initHeaderOffsets(header_offsets[0], header_offsets[1]);
4341  hud_gauge->initTextDockOffsetX(text_dock_offset_x);
4342  hud_gauge->initTextDockValueOffsetX(text_dock_val_offset_x);
4343  hud_gauge->initTextValueOffsetY(text_val_offset_y);
4344 
4345  if(settings->ship_idx->at(0) >= 0) {
4346  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4347  HudGaugeSupport* instance = new HudGaugeSupport();
4348  *instance = *hud_gauge;
4349  Ship_info[*ship_index].hud_gauges.push_back(instance);
4350  }
4351  delete hud_gauge;
4352  } else {
4353  default_hud_gauges.push_back(hud_gauge);
4354  }
4355 }
4356 
4358 {
4359  settings->origin[0] = 0.5f;
4360  settings->origin[1] = 0.5f;
4361 
4362  if(gr_screen.res == GR_640) {
4363  settings->offset[0] = -146;
4364  settings->offset[1] = -200;
4365  } else {
4366  settings->offset[0] = -133;
4367  settings->offset[1] = -259;
4368  }
4369 
4370  HudGaugeTrainingMessages* hud_gauge = gauge_load_common<HudGaugeTrainingMessages>(settings);
4371 
4372  if(settings->ship_idx->at(0) >= 0) {
4373  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4375  *instance = *hud_gauge;
4376  Ship_info[*ship_index].hud_gauges.push_back(instance);
4377  }
4378  delete hud_gauge;
4379  } else {
4380  default_hud_gauges.push_back(hud_gauge);
4381  }
4382 }
4383 
4385 {
4386  int max_lines = 3;
4387  int max_width;
4388  int scroll_time = 30;
4389  int step_size = 3;
4390  int total_life = 14000;
4391  int line_height = 9;
4392  bool hidden_by_comms_menu = true;
4393 
4394  settings->origin[0] = 0.0f;
4395  settings->origin[1] = 0.0f;
4396  settings->offset[0] = 8;
4397  settings->offset[1] = 5;
4398 
4399  if(gr_screen.res == GR_640) {
4400  max_width = 620;
4401  } else {
4402  max_width = 1004;
4403  }
4404 
4405  HudGaugeMessages* hud_gauge = gauge_load_common<HudGaugeMessages>(settings);
4406 
4407  if ( optional_string("Max Lines:") ) {
4408  stuff_int(&max_lines);
4409  }
4410  if ( optional_string("Max Width:") ) {
4411  stuff_int(&max_width);
4412  }
4413  if ( optional_string("Line Height:") ) {
4414  stuff_int(&line_height);
4415  }
4416  if ( optional_string("Total Lifetime:") ) {
4417  stuff_int(&total_life);
4418  }
4419  if ( optional_string("Scroll Time:") ) {
4420  stuff_int(&scroll_time);
4421  }
4422  if ( optional_string("Step Size:") ) {
4423  stuff_int(&step_size);
4424  }
4425  if ( optional_string("Hidden By Comms Menu:") ) {
4426  stuff_boolean(&hidden_by_comms_menu);
4427  }
4428 
4429  hud_gauge->initMaxLines(max_lines);
4430  hud_gauge->initMaxWidth(max_width);
4431  hud_gauge->initScrollTime(scroll_time);
4432  hud_gauge->initStepSize(step_size);
4433  hud_gauge->initTotalLife(total_life);
4434  hud_gauge->initLineHeight(line_height);
4435  hud_gauge->initHiddenByCommsMenu(hidden_by_comms_menu);
4436 
4437  if(settings->ship_idx->at(0) >= 0) {
4438  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4439  HudGaugeMessages* instance = new HudGaugeMessages();
4440  *instance = *hud_gauge;
4441  Ship_info[*ship_index].hud_gauges.push_back(instance);
4442  }
4443  delete hud_gauge;
4444  } else {
4445  default_hud_gauges.push_back(hud_gauge);
4446  }
4447 }
4448 
4450 {
4451  gr_set_font(FONT1);
4452  int h = gr_get_font_height();
4453 
4454  settings->use_coords = true;
4455  settings->coords[0] = 0x8000; //Magic number, means "Center on X"
4456  settings->coords[1] = 5 + (h * 3);
4457 
4458  HudGaugeFixedMessages* hud_gauge = gauge_load_common<HudGaugeFixedMessages>(settings);
4459 
4460  if(settings->ship_idx->at(0) >= 0) {
4461  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4462  HudGaugeFixedMessages* instance = new HudGaugeFixedMessages();
4463  *instance = *hud_gauge;
4464  Ship_info[*ship_index].hud_gauges.push_back(instance);
4465  }
4466  delete hud_gauge;
4467  } else {
4468  default_hud_gauges.push_back(hud_gauge);
4469  }
4470 }
4471 
4473 {
4474  int Weapon_link_offsets[NUM_WEAPON_LINK_MODES][2];
4475  char fname_arc[MAX_FILENAME_LEN];
4476  char fname_primary_link_1[MAX_FILENAME_LEN];
4477  char fname_primary_link_2[MAX_FILENAME_LEN];
4478  char fname_secondary_link_1[MAX_FILENAME_LEN];
4479  char fname_secondary_link_2[MAX_FILENAME_LEN];
4480  char fname_secondary_link_3[MAX_FILENAME_LEN];
4481 
4482  settings->origin[0] = 0.5f;
4483  settings->origin[1] = 0.5f;
4484  settings->slew = true;
4485 
4486  if(gr_screen.res == GR_640) {
4487  settings->offset[0] = 54;
4488  settings->offset[1] = 2;
4489 
4490  Weapon_link_offsets[LINK_ONE_PRIMARY][0] = 32;
4491  Weapon_link_offsets[LINK_ONE_PRIMARY][1] = 11;
4492  Weapon_link_offsets[LINK_TWO_PRIMARY][0] = 32;
4493  Weapon_link_offsets[LINK_TWO_PRIMARY][1] = 11;
4494  Weapon_link_offsets[LINK_ONE_SECONDARY][0] = 17;
4495  Weapon_link_offsets[LINK_ONE_SECONDARY][1] = 34;
4496  Weapon_link_offsets[LINK_TWO_SECONDARY][0] = 17;
4497  Weapon_link_offsets[LINK_TWO_SECONDARY][1] = 34;
4498  Weapon_link_offsets[LINK_THREE_SECONDARY][0] = 17;
4499  Weapon_link_offsets[LINK_THREE_SECONDARY][1] = 34;
4500 
4501  strcpy_s(fname_arc, "rightarc1_fs1");
4502  strcpy_s(fname_primary_link_1, "rightarc2_fs1");
4503  strcpy_s(fname_primary_link_2, "rightarc3_fs1");
4504  strcpy_s(fname_secondary_link_1, "rightarc4_fs1");
4505  strcpy_s(fname_secondary_link_2, "rightarc5_fs1");
4506  strcpy_s(fname_secondary_link_3, "rightarc6_fs1");
4507  } else {
4508  settings->offset[0] = 86;
4509  settings->offset[1] = 3;
4510 
4511  Weapon_link_offsets[LINK_ONE_PRIMARY][0] = 52;
4512  Weapon_link_offsets[LINK_ONE_PRIMARY][1] = 18;
4513  Weapon_link_offsets[LINK_TWO_PRIMARY][0] = 52;
4514  Weapon_link_offsets[LINK_TWO_PRIMARY][1] = 18;
4515  Weapon_link_offsets[LINK_ONE_SECONDARY][0] = 28;
4516  Weapon_link_offsets[LINK_ONE_SECONDARY][1] = 55;
4517  Weapon_link_offsets[LINK_TWO_SECONDARY][0] = 28;
4518  Weapon_link_offsets[LINK_TWO_SECONDARY][1] = 55;
4519  Weapon_link_offsets[LINK_THREE_SECONDARY][0] = 28;
4520  Weapon_link_offsets[LINK_THREE_SECONDARY][1] = 55;
4521 
4522  strcpy_s(fname_arc, "2_rightarc1_fs1");
4523  strcpy_s(fname_primary_link_1, "2_rightarc2_fs1");
4524  strcpy_s(fname_primary_link_2, "2_rightarc3_fs1");
4525  strcpy_s(fname_secondary_link_1, "2_rightarc4_fs1");
4526  strcpy_s(fname_secondary_link_2, "2_rightarc5_fs1");
4527  strcpy_s(fname_secondary_link_3, "2_rightarc6_fs1");
4528  }
4529 
4530  HudGaugeWeaponLinking* hud_gauge = gauge_load_common<HudGaugeWeaponLinking>(settings);
4531 
4532  if(optional_string("Arc Filename:")) {
4533  stuff_string(fname_arc, F_NAME, MAX_FILENAME_LEN);
4534  }
4535  if(optional_string("Single Primary Filename:")) {
4536  stuff_string(fname_primary_link_1, F_NAME, MAX_FILENAME_LEN);
4537  }
4538  if(optional_string("Double Primary Filename:")) {
4539  stuff_string(fname_primary_link_2, F_NAME, MAX_FILENAME_LEN);
4540  }
4541  if(optional_string("Single Secondary Filename:")) {
4542  stuff_string(fname_secondary_link_1, F_NAME, MAX_FILENAME_LEN);
4543  }
4544  if(optional_string("Double Secondary Filename:")) {
4545  stuff_string(fname_secondary_link_2, F_NAME, MAX_FILENAME_LEN);
4546  }
4547  if(optional_string("Triple Secondary Filename:")) {
4548  stuff_string(fname_secondary_link_3, F_NAME, MAX_FILENAME_LEN);
4549  }
4550  if(optional_string("Single Primary Offsets:")) {
4551  stuff_int_list(Weapon_link_offsets[LINK_ONE_PRIMARY], 2);
4552  }
4553  if(optional_string("Double Primary Offsets:")) {
4554  stuff_int_list(Weapon_link_offsets[LINK_TWO_PRIMARY], 2);
4555  }
4556  if(optional_string("Single Secondary Offsets:")) {
4557  stuff_int_list(Weapon_link_offsets[LINK_ONE_SECONDARY], 2);
4558  }
4559  if(optional_string("Double Secondary Offsets:")) {
4560  stuff_int_list(Weapon_link_offsets[LINK_TWO_SECONDARY], 2);
4561  }
4562  if(optional_string("Triple Secondary Offsets:")) {
4563  stuff_int_list(Weapon_link_offsets[LINK_THREE_SECONDARY], 2);
4564  }
4565 
4566  hud_gauge->init1PrimaryOffsets(Weapon_link_offsets[LINK_ONE_PRIMARY][0], Weapon_link_offsets[LINK_ONE_PRIMARY][1]);
4567  hud_gauge->init2PrimaryOffsets(Weapon_link_offsets[LINK_TWO_PRIMARY][0], Weapon_link_offsets[LINK_TWO_PRIMARY][1]);
4568  hud_gauge->init1SecondaryOffsets(Weapon_link_offsets[LINK_ONE_SECONDARY][0], Weapon_link_offsets[LINK_ONE_SECONDARY][1]);
4569  hud_gauge->init2SecondaryOffsets(Weapon_link_offsets[LINK_TWO_SECONDARY][0], Weapon_link_offsets[LINK_TWO_SECONDARY][1]);
4570  hud_gauge->init3SecondaryOffsets(Weapon_link_offsets[LINK_THREE_SECONDARY][0], Weapon_link_offsets[LINK_THREE_SECONDARY][1]);
4571  hud_gauge->initBitmaps(fname_arc, fname_primary_link_1, fname_primary_link_2, fname_secondary_link_1, fname_secondary_link_2, fname_secondary_link_3);
4572 
4573  if(settings->ship_idx->at(0) >= 0) {
4574  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4575  HudGaugeWeaponLinking* instance = new HudGaugeWeaponLinking();
4576  *instance = *hud_gauge;
4577  Ship_info[*ship_index].hud_gauges.push_back(instance);
4578  }
4579  delete hud_gauge;
4580  } else {
4581  default_hud_gauges.push_back(hud_gauge);
4582  }
4583 }
4584 
4586 {
4587  settings->origin[0] = 0.0f;
4588  settings->origin[1] = 0.5f;
4589 
4590  if(gr_screen.res == GR_640) {
4591  settings->offset[0] = 5;
4592  settings->offset[1] = -90;
4593  } else {
4594  settings->offset[0] = 8;
4595  settings->offset[1] = -144;
4596  }
4597 
4598  HudGaugeMultiMsg* hud_gauge = gauge_load_common<HudGaugeMultiMsg>(settings);
4599 
4600  if(settings->ship_idx->at(0) >= 0) {
4601  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4602  HudGaugeMultiMsg* instance = new HudGaugeMultiMsg();
4603  *instance = *hud_gauge;
4604  Ship_info[*ship_index].hud_gauges.push_back(instance);
4605  }
4606  delete hud_gauge;
4607  } else {
4608  default_hud_gauges.push_back(hud_gauge);
4609  }
4610 }
4611 
4613 {
4614  settings->origin[0] = 0.0f;
4615  settings->origin[1] = 0.5f;
4616 
4617  if(gr_screen.res == GR_640) {
4618  settings->offset[0] = 5;
4619  settings->offset[1] = -75;
4620  } else {
4621  settings->offset[0] = 8;
4622  settings->offset[1] = -129;
4623  }
4624 
4625  HudGaugeVoiceStatus* hud_gauge = gauge_load_common<HudGaugeVoiceStatus>(settings);
4626 
4627  if(settings->ship_idx->at(0) >= 0) {
4628  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4629  HudGaugeVoiceStatus* instance = new HudGaugeVoiceStatus();
4630  *instance = *hud_gauge;
4631  Ship_info[*ship_index].hud_gauges.push_back(instance);
4632  }
4633  delete hud_gauge;
4634  } else {
4635  default_hud_gauges.push_back(hud_gauge);
4636  }
4637 }
4638 
4640 {
4641  settings->origin[0] = 1.0f;
4642  settings->origin[1] = 0.0f;
4643 
4644  if(gr_screen.res == GR_640) {
4645  settings->offset[0] = -80;
4646  settings->offset[1] = 3;
4647  } else {
4648  settings->offset[0] = -128;
4649  settings->offset[1] = 5;
4650  }
4651 
4652  HudGaugePing* hud_gauge = gauge_load_common<HudGaugePing>(settings);
4653 
4654  if(settings->ship_idx->at(0) >= 0) {
4655  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4656  HudGaugePing* instance = new HudGaugePing();
4657  *instance = *hud_gauge;
4658  Ship_info[*ship_index].hud_gauges.push_back(instance);
4659  }
4660  delete hud_gauge;
4661  } else {
4662  default_hud_gauges.push_back(hud_gauge);
4663  }
4664 }
4665 
4667 {
4668  settings->origin[0] = 0.5f;
4669  settings->origin[1] = 0.5f;
4670 
4671  if(gr_screen.res == GR_640) {
4672  settings->offset[0] = -220;
4673  settings->offset[1] = -140;
4674  } else {
4675  settings->offset[0] = -342;
4676  settings->offset[1] = -214;
4677  }
4678 
4679  HudGaugeSupernova* hud_gauge = gauge_load_common<HudGaugeSupernova>(settings);
4680 
4681  if(settings->ship_idx->at(0) >= 0) {
4682  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4683  HudGaugeSupernova* instance = new HudGaugeSupernova();
4684  *instance = *hud_gauge;
4685  Ship_info[*ship_index].hud_gauges.push_back(instance);
4686  }
4687  delete hud_gauge;
4688  } else {
4689  default_hud_gauges.push_back(hud_gauge);
4690  }
4691 }
4692 
4694 {
4695  int Lock_gauge_half_w;
4696  int Lock_gauge_half_h;
4697  int Lockspin_half_w;
4698  int Lockspin_half_h;
4699  float Lock_triangle_height;
4700  float Lock_triangle_base;
4703  bool loop_locked_anim;
4704  char fname_lock[MAX_FILENAME_LEN];
4705  char fname_spin[MAX_FILENAME_LEN];
4706 
4707  settings->set_position = false;
4708  settings->set_colour = false;
4709 
4711  if(gr_screen.res == GR_640) {
4712  Lock_gauge_half_w = 15;
4713  Lock_gauge_half_h = 15;
4714  Lockspin_half_w = 16;
4715  Lockspin_half_h = 16;
4716  Lock_triangle_height = 4.0f;
4717  Lock_triangle_base = 4.0f;
4718  Lock_target_box_width = 19;
4719  Lock_target_box_height = 30;
4720  loop_locked_anim = true;
4721 
4722  strcpy_s(fname_lock, "lock1_fs1");
4723  strcpy_s(fname_spin, "lockspin_fs1");
4724  } else {
4725  Lock_gauge_half_w = 24;
4726  Lock_gauge_half_h = 25;
4727  Lockspin_half_w = 26;
4728  Lockspin_half_h = 26;
4729  Lock_triangle_height = 6.5f;
4730  Lock_triangle_base = 6.5f;
4731  Lock_target_box_width = 19;
4732  Lock_target_box_height = 30;
4733  loop_locked_anim = true;
4734 
4735  strcpy_s(fname_lock, "2_lock1_fs1");
4736  strcpy_s(fname_spin, "2_lockspin_fs1");
4737  }
4738  } else {
4739  if(gr_screen.res == GR_640) {
4740  Lock_gauge_half_w = 17;
4741  Lock_gauge_half_h = 15;
4742  Lockspin_half_w = 31;
4743  Lockspin_half_h = 32;
4744  Lock_triangle_height = 4.0f;
4745  Lock_triangle_base = 4.0f;
4746  Lock_target_box_width = 19;
4747  Lock_target_box_height = 30;
4748  loop_locked_anim = false;
4749 
4750  strcpy_s(fname_lock, "lock1");
4751  strcpy_s(fname_spin, "lockspin");
4752  } else {
4753  Lock_gauge_half_w = 28;
4754  Lock_gauge_half_h = 25;
4755  Lockspin_half_w = 50;
4756  Lockspin_half_h = 52;
4757  Lock_triangle_height = 6.5f;
4758  Lock_triangle_base = 6.5f;
4759  Lock_target_box_width = 19;
4760  Lock_target_box_height = 30;
4761  loop_locked_anim = false;
4762 
4763  strcpy_s(fname_lock, "2_lock1");
4764  strcpy_s(fname_spin, "2_lockspin");
4765  }
4766  }
4767 
4768  HudGaugeLock* hud_gauge = gauge_load_common<HudGaugeLock>(settings);
4769 
4770  if(optional_string("Lock Filename:")) {
4771  stuff_string(fname_lock, F_NAME, MAX_FILENAME_LEN);
4772  }
4773  if(optional_string("Locked Filename:")) {
4774  stuff_string(fname_spin, F_NAME, MAX_FILENAME_LEN);
4775  }
4776  if(optional_string("Lock Center Offsets:")) {
4777  int temp[2];
4778 
4779  stuff_int_list(temp, 2);
4780 
4781  Lock_gauge_half_w = temp[0];
4782  Lock_gauge_half_h = temp[1];
4783  }
4784  if(optional_string("Locked Center Offsets:")) {
4785  int temp[2];
4786 
4787  stuff_int_list(temp, 2);
4788 
4789  Lockspin_half_w = temp[0];
4790  Lockspin_half_h = temp[1];
4791  }
4792 
4793  hud_gauge->initBitmaps(fname_lock, fname_spin);
4794  hud_gauge->initLoopLockedAnim(loop_locked_anim);
4795  hud_gauge->initGaugeHalfSize(Lock_gauge_half_w, Lock_gauge_half_h);
4796  hud_gauge->initSpinHalfSize(Lockspin_half_w, Lockspin_half_h);
4797  hud_gauge->initTriHeight(Lock_triangle_height);
4798  hud_gauge->initTriBase(Lock_triangle_base);
4799  hud_gauge->initTargetBoxSize(Lock_target_box_width, Lock_target_box_height);
4800 
4801  if(settings->ship_idx->at(0) >= 0) {
4802  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4803  HudGaugeLock* instance = new HudGaugeLock();
4804  *instance = *hud_gauge;
4805  Ship_info[*ship_index].hud_gauges.push_back(instance);
4806  }
4807  delete hud_gauge;
4808  } else {
4809  default_hud_gauges.push_back(hud_gauge);
4810  }
4811 }
4812 
4814 {
4816  float Max_front_seperation;
4817  float Offscreen_tri_base;
4818  float Offscreen_tri_height;
4819 
4820  settings->set_position = false;
4821  settings->set_colour = false;
4822 
4823  if(gr_screen.res == GR_640) {
4824  Max_offscreen_tri_seperation = 10.0f;
4825  Max_front_seperation = 10.0f;
4826  Offscreen_tri_base = 6.0f;
4827  Offscreen_tri_height = 7.0f;
4828  } else {
4829  Max_offscreen_tri_seperation = 16.0f;
4830  Max_front_seperation = 16.0f;
4831  Offscreen_tri_base = 9.5f;
4832  Offscreen_tri_height = 11.0f;
4833  }
4834 
4835  HudGaugeOffscreen* hud_gauge = gauge_load_common<HudGaugeOffscreen>(settings);
4836 
4837  hud_gauge->initMaxTriSeperation(Max_offscreen_tri_seperation);
4838  hud_gauge->initMaxFrontSeperation(Max_front_seperation);
4839  hud_gauge->initTriBase(Offscreen_tri_base);
4840  hud_gauge->initTriHeight(Offscreen_tri_height);
4841 
4842  if(settings->ship_idx->at(0) >= 0) {
4843  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4844  HudGaugeOffscreen* instance = new HudGaugeOffscreen();
4845  *instance = *hud_gauge;
4846  Ship_info[*ship_index].hud_gauges.push_back(instance);
4847  }
4848  delete hud_gauge;
4849  } else {
4850  default_hud_gauges.push_back(hud_gauge);
4851  }
4852 }
4853 
4855 {
4856  int min_target_box[2];
4857  int min_subtarget_box[2];
4858  char fname[MAX_FILENAME_LEN] = "attacker";
4859 
4860  settings->set_position = false;
4861  settings->set_colour = false;
4862 
4863  if(gr_screen.res == GR_640) {
4864  min_target_box[0] = 20;
4865  min_target_box[1] = 20;
4866  min_subtarget_box[0] = 12;
4867  min_subtarget_box[1] = 12;
4868  } else {
4869  min_target_box[0] = 30;
4870  min_target_box[1] = 30;
4871  min_subtarget_box[0] = 24;
4872  min_subtarget_box[1] = 24;
4873  }
4874 
4875  HudGaugeBrackets* hud_gauge = gauge_load_common<HudGaugeBrackets>(settings);
4876 
4877  if(optional_string("Dot Filename:")) {
4879  }
4880 
4881  hud_gauge->initBitmaps(fname);
4882  hud_gauge->initMinSubTargetBoxSizes(min_subtarget_box[0], min_subtarget_box[1]);
4883  hud_gauge->initMinTargetBoxSizes(min_target_box[0], min_target_box[1]);
4884 
4885  if(settings->ship_idx->at(0) >= 0) {
4886  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4887  HudGaugeBrackets* instance = new HudGaugeBrackets();
4888  *instance = *hud_gauge;
4889  Ship_info[*ship_index].hud_gauges.push_back(instance);
4890  }
4891  delete hud_gauge;
4892  } else {
4893  default_hud_gauges.push_back(hud_gauge);
4894  }
4895 }
4896 
4898 {
4899  int Radius;
4900  float Target_triangle_base;
4901  float Target_triangle_height;
4902 
4903  settings->origin[0] = 0.5f;
4904  settings->origin[1] = 0.5f;
4905  settings->slew = true;
4906 
4907  if(gr_screen.res == GR_640) {
4908  settings->offset[0] = 0;
4909  settings->offset[1] = 2;
4910 
4911  Target_triangle_base = 6.0f;
4912  Target_triangle_height = 7.0f;
4913  Radius = 104;
4914  } else {
4915  settings->offset[0] = 0;
4916  settings->offset[1] = 3;
4917 
4918  Target_triangle_base = 9.5f;
4919  Target_triangle_height = 11.0f;
4920  Radius = 166;
4921  }
4922 
4923  HudGaugeHostileTriangle* hud_gauge = gauge_load_common<HudGaugeHostileTriangle>(settings);
4924 
4925  if(optional_string("Radius:")) {
4926  stuff_int(&Radius);
4927  }
4928  if(optional_string("Triangle Base:")) {
4929  stuff_float(&Target_triangle_base);
4930  }
4931  if(optional_string("Triangle Height:")) {
4932  stuff_float(&Target_triangle_height);
4933  }
4934 
4935  hud_gauge->initRadius(Radius);
4936  hud_gauge->initTriBase(Target_triangle_base);
4937  hud_gauge->initTriHeight(Target_triangle_height);
4938 
4939  if(settings->ship_idx->at(0) >= 0) {
4940  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4942  *instance = *hud_gauge;
4943  Ship_info[*ship_index].hud_gauges.push_back(instance);
4944  }
4945  delete hud_gauge;
4946  } else {
4947  default_hud_gauges.push_back(hud_gauge);
4948  }
4949 }
4950 
4952 {
4953  int Radius;
4954  float Target_triangle_base;
4955  float Target_triangle_height;
4956 
4957  settings->origin[0] = 0.5f;
4958  settings->origin[1] = 0.5f;
4959  settings->slew = true;
4960 
4961  if(gr_screen.res == GR_640) {
4962  settings->offset[0] = 0;
4963  settings->offset[1] = 2;
4964 
4965  Target_triangle_base = 6.0f;
4966  Target_triangle_height = 7.0f;
4967  Radius = 104;
4968  } else {
4969  settings->offset[0] = 0;
4970  settings->offset[1] = 3;
4971 
4972  Target_triangle_base = 9.5f;
4973  Target_triangle_height = 11.0f;
4974  Radius = 166;
4975  }
4976 
4977  HudGaugeTargetTriangle* hud_gauge = gauge_load_common<HudGaugeTargetTriangle>(settings);
4978 
4979  if(optional_string("Radius:")) {
4980  stuff_int(&Radius);
4981  }
4982  if(optional_string("Triangle Base:")) {
4983  stuff_float(&Target_triangle_base);
4984  }
4985  if(optional_string("Triangle Height:")) {
4986  stuff_float(&Target_triangle_height);
4987  }
4988 
4989  hud_gauge->initRadius(Radius);
4990  hud_gauge->initTriBase(Target_triangle_base);
4991  hud_gauge->initTriHeight(Target_triangle_height);
4992 
4993  if(settings->ship_idx->at(0) >= 0) {
4994  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
4996  *instance = *hud_gauge;
4997  Ship_info[*ship_index].hud_gauges.push_back(instance);
4998  }
4999  delete hud_gauge;
5000  } else {
5001  default_hud_gauges.push_back(hud_gauge);
5002  }
5003 }
5004 
5006 {
5007  int Radius;
5008  float Target_triangle_base;
5009  float Target_triangle_height;
5010 
5011  settings->origin[0] = 0.5f;
5012  settings->origin[1] = 0.5f;
5013  settings->slew = true;
5014 
5015  if(gr_screen.res == GR_640) {
5016  settings->offset[0] = 0;
5017  settings->offset[1] = 2;
5018 
5019  Target_triangle_base = 6.0f;
5020  Target_triangle_height = 7.0f;
5021  Radius = 104;
5022  } else {
5023  settings->offset[0] = 0;
5024  settings->offset[1] = 3;
5025 
5026  Target_triangle_base = 9.5f;
5027  Target_triangle_height = 11.0f;
5028  Radius = 166;
5029  }
5030 
5031  HudGaugeMissileTriangles* hud_gauge = gauge_load_common<HudGaugeMissileTriangles>(settings);
5032 
5033  if(optional_string("Radius:")) {
5034  stuff_int(&Radius);
5035  }
5036  if(optional_string("Triangle Base:")) {
5037  stuff_float(&Target_triangle_base);
5038  }
5039  if(optional_string("Triangle Height:")) {
5040  stuff_float(&Target_triangle_height);
5041  }
5042 
5043  hud_gauge->initRadius(Radius);
5044  hud_gauge->initTriBase(Target_triangle_base);
5045  hud_gauge->initTriHeight(Target_triangle_height);
5046 
5047  if(settings->ship_idx->at(0) >= 0) {
5048  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
5050  *instance = *hud_gauge;
5051  Ship_info[*ship_index].hud_gauges.push_back(instance);
5052  }
5053  delete hud_gauge;
5054  } else {
5055  default_hud_gauges.push_back(hud_gauge);
5056  }
5057 }
5058 
5060 {
5061  float Lead_indicator_half[2];
5062  char fname[MAX_FILENAME_LEN];
5063 
5064  settings->set_position = false;
5065  settings->set_colour = false;
5066 
5068  if(gr_screen.res == GR_640) {
5069  Lead_indicator_half[0] = 12.5f;
5070  Lead_indicator_half[1] = 12.5f;
5071 
5072  strcpy_s(fname, "lead1_fs1");
5073  } else {
5074  Lead_indicator_half[0] = 20.0f;
5075  Lead_indicator_half[1] = 20.0f;
5076 
5077  strcpy_s(fname, "2_lead1_fs1");
5078  }
5079  } else {
5080  if(gr_screen.res == GR_640) {
5081  Lead_indicator_half[0] = 8.0f;
5082  Lead_indicator_half[1] = 8.0f;
5083 
5084  strcpy_s(fname, "lead1");
5085  } else {
5086  Lead_indicator_half[0] = 13.0f;
5087  Lead_indicator_half[1] = 13.0f;
5088 
5089  strcpy_s(fname, "2_lead1");
5090  }
5091  }
5092 
5093  HudGaugeLeadIndicator* hud_gauge = gauge_load_common<HudGaugeLeadIndicator>(settings);
5094 
5095  if(optional_string("Filename:")) {
5097  }
5098  if(optional_string("Center Offsets:")) {
5099  int temp[2];
5100 
5101  stuff_int_list(temp, 2);
5102 
5103  Lead_indicator_half[0] = i2fl(temp[0]);
5104  Lead_indicator_half[1] = i2fl(temp[1]);
5105  }
5106 
5107  hud_gauge->initHalfSize(Lead_indicator_half[0], Lead_indicator_half[1]);
5108  hud_gauge->initBitmaps(fname);
5109 
5110  if(settings->ship_idx->at(0) >= 0) {
5111  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
5112  HudGaugeLeadIndicator* instance = new HudGaugeLeadIndicator();
5113  *instance = *hud_gauge;
5114  Ship_info[*ship_index].hud_gauges.push_back(instance);
5115  }
5116  delete hud_gauge;
5117  } else {
5118  default_hud_gauges.push_back(hud_gauge);
5119  }
5120 }
5121 
5123 {
5124  int Radius;
5125 
5126  settings->origin[0] = 0.5f;
5127  settings->origin[1] = 0.5f;
5128  settings->slew = true;
5129 
5130  if(gr_screen.res == GR_640) {
5131  settings->offset[0] = 0;
5132  settings->offset[1] = 2;
5133 
5134  Radius = 104;
5135  } else {
5136  settings->offset[0] = 0;
5137  settings->offset[1] = 3;
5138 
5139  Radius = 166;
5140  }
5141 
5142  HudGaugeOrientationTee* hud_gauge = gauge_load_common<HudGaugeOrientationTee>(settings);
5143 
5144  if(optional_string("Radius:")) {
5145  stuff_int(&Radius);
5146  }
5147 
5148  hud_gauge->initRadius(Radius);
5149 
5150  if(settings->ship_idx->at(0) >= 0) {
5151  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
5153  *instance = *hud_gauge;
5154  Ship_info[*ship_index].hud_gauges.push_back(instance);
5155  }
5156  delete hud_gauge;
5157  } else {
5158  default_hud_gauges.push_back(hud_gauge);
5159  }
5160 }
5161 
5163 {
5164  char fname[MAX_FILENAME_LEN] = "leadsight";
5165 
5166  settings->origin[0] = 0.5f;
5167  settings->origin[1] = 0.5f;
5168  settings->slew = true;
5169 
5170  if(gr_screen.res == GR_640) {
5171  settings->offset[0] = 0;
5172  settings->offset[1] = 2;
5173  } else {
5174  settings->offset[0] = 0;
5175  settings->offset[1] = 3;
5176  }
5177 
5178  HudGaugeLeadSight* hud_gauge = gauge_load_common<HudGaugeLeadSight>(settings);
5179 
5180  if(optional_string("Filename:")) {
5182  }
5183 
5184  hud_gauge->initBitmaps(fname);
5185 
5186  if(settings->ship_idx->at(0) >= 0) {
5187  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
5188  HudGaugeLeadSight* instance = new HudGaugeLeadSight();
5189  *instance = *hud_gauge;
5190  Ship_info[*ship_index].hud_gauges.push_back(instance);
5191  }
5192  delete hud_gauge;
5193  } else {
5194  default_hud_gauges.push_back(hud_gauge);
5195  }
5196 }
5197 
5199 {
5200  int text_offsets[2] = {6, 4};
5201  int text_value_offsets[2] = {74, 4};
5202  char fname[MAX_FILENAME_LEN] = "kills1";
5203 
5204  settings->origin[0] = 1.0f;
5205  settings->origin[1] = 1.0f;
5206 
5207  if(gr_screen.res == GR_640) {
5208  settings->offset[0] = -143;
5209  settings->offset[1] = -119;
5210 
5211  if(Lcl_gr) {
5212  text_value_offsets[0] = 118;
5213  text_value_offsets[1] = 4;
5214  }
5215  } else {
5216  settings->offset[0] = -144;
5217  settings->offset[1] = -144;
5218 
5219  if(Lcl_gr) {
5220  text_value_offsets[0] = 104;
5221  text_value_offsets[1] = 4;
5222  }
5223  }
5224 
5225  HudGaugeKills* hud_gauge = gauge_load_common<HudGaugeKills>(settings);
5226 
5227  if(optional_string("Filename:")) {
5229  }
5230  if(optional_string("Text Offsets:")) {
5231  stuff_int_list(text_offsets, 2);
5232  }
5233  if(optional_string("Value Offsets:")) {
5234  stuff_int_list(text_value_offsets, 2);
5235  }
5236 
5237  hud_gauge->initBitmaps(fname);
5238  hud_gauge->initTextOffsets(text_offsets[0], text_offsets[1]);
5239  hud_gauge->initTextValueOffsets(text_value_offsets[0], text_value_offsets[1]);
5240 
5241  if(settings->ship_idx->at(0) >= 0) {
5242  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
5243  HudGaugeKills* instance = new HudGaugeKills();
5244  *instance = *hud_gauge;
5245  Ship_info[*ship_index].hud_gauges.push_back(instance);
5246  }
5247  delete hud_gauge;
5248  } else {
5249  default_hud_gauges.push_back(hud_gauge);
5250  }
5251 }
5252 
5254 {
5255  int Marker_half[2];
5256  char fname[MAX_FILENAME_LEN] = "flight_path";
5257 
5258  Marker_half[0] = 21;
5259  Marker_half[1] = 21;
5260 
5261  settings->set_position = false;
5262 
5263  HudGaugeFlightPath* hud_gauge = gauge_load_common<HudGaugeFlightPath>(settings);
5264 
5265  if(optional_string("Filename:")) {
5267  }
5268  if(optional_string("Center Offsets:")) {
5269  stuff_int_list(Marker_half, 2);
5270  }
5271 
5272  hud_gauge->initHalfSize(Marker_half[0], Marker_half[1]);
5273  hud_gauge->initBitmap(fname);
5274 
5275  if(settings->ship_idx->at(0) >= 0) {
5276  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
5277  HudGaugeFlightPath* instance = new HudGaugeFlightPath();
5278  *instance = *hud_gauge;
5279  Ship_info[*ship_index].hud_gauges.push_back(instance);
5280  }
5281  delete hud_gauge;
5282  } else {
5283  default_hud_gauges.push_back(hud_gauge);
5284  }
5285 }
5286 
5288 {
5289  int warhead_name_offsets[2] = {6, 4};
5290  int warhead_count_offsets[2] = {74, 4};
5291  int icon_width = 0;
5292  int icon_height = 0;
5293  int max_icons = 0;
5294  int max_columns = 0;
5295  int alignment = 0;
5296  char fname[MAX_FILENAME_LEN] = "warhead_icon";
5297 
5298  settings->origin[0] = 1.0f;
5299  settings->origin[1] = 1.0f;
5300  settings->slew = true;
5301 
5302  if ( gr_screen.res == GR_640 ) {
5303  settings->offset[0] = -143;
5304  settings->offset[1] = -119;
5305  } else {
5306  settings->offset[0] = -144;
5307  settings->offset[1] = -144;
5308  }
5309 
5310  HudGaugeWarheadCount* hud_gauge = gauge_load_common<HudGaugeWarheadCount>(settings);
5311 
5312  if ( optional_string("Filename:") ) {
5314  }
5315 
5316  if ( optional_string("Name Offsets:") ) {
5317  stuff_int_list(warhead_name_offsets, 2);
5318  }
5319 
5320  if ( optional_string("Count Offsets:") ) {
5321  stuff_int_list(warhead_count_offsets, 2);
5322  }
5323 
5324  if ( optional_string("Icon Width:") ) {
5325  stuff_int(&icon_width);
5326  }
5327 
5328  if ( optional_string("Icon Height:") ) {
5329  stuff_int(&icon_height);
5330  }
5331 
5332  if ( optional_string("Max Icons:") ) {
5333  stuff_int(&max_icons);
5334  }
5335 
5336  if ( optional_string("Max Columns:") ) {
5337  stuff_int(&max_columns);
5338  }
5339 
5340  if ( optional_string("Name Alignment:") ) {
5341  if ( optional_string("Right") ) {
5342  alignment = 1;
5343  } else {
5344  alignment = 0;
5345  }
5346  }
5347 
5348  hud_gauge->initBitmap(fname);
5349  hud_gauge->initNameOffsets(warhead_name_offsets[0], warhead_name_offsets[1]);
5350  hud_gauge->initCountOffsets(warhead_count_offsets[0], warhead_count_offsets[1]);
5351  hud_gauge->initCountSizes(icon_width, icon_height);
5352  hud_gauge->initMaxSymbols(max_icons);
5353  hud_gauge->initMaxColumns(max_columns);
5354  hud_gauge->initTextAlign(alignment);
5355 
5356  if(settings->ship_idx->at(0) >= 0) {
5357  for (SCP_vector<int>::iterator ship_index = settings->ship_idx->begin(); ship_index != settings->ship_idx->end(); ++ship_index) {
5358  HudGaugeWarheadCount* instance = new HudGaugeWarheadCount();
5359  *instance = *hud_gauge;
5360  Ship_info[*ship_index].hud_gauges.push_back(instance);
5361  }
5362  delete hud_gauge;
5363  } else {
5364  default_hud_gauges.push_back(hud_gauge);
5365  }
5366 }
5367 
5369 {