FS2_Open
Open source remastering of the Freespace 2 engine
hudshield.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 
12 
13 #include "gamesnd/gamesnd.h"
14 #include "hud/hudescort.h"
15 #include "hud/hudparse.h"
16 #include "hud/hudshield.h"
17 #include "hud/hudtargetbox.h"
18 #include "io/timer.h"
19 #include "network/multi.h"
20 #include "object/object.h"
21 #include "object/objectshield.h"
22 #include "parse/parselo.h"
23 #include "playerman/player.h"
24 #include "render/3d.h" //For g3_start_frame
25 #include "ship/ship.h"
26 #include "weapon/emp.h"
27 
28 
29 
30 
31 #define NUM_SHIELD_LEVELS 8
32 
33 #define SHIELD_TRANSFER_PERCENT 0.083f // 1/12 total shield strength
34 
35 #define SHIELD_HIT_DURATION_SHORT 300 // time a shield quadrant flashes after being hit
36 #define SHIELD_FLASH_INTERVAL_FAST 200 // time between shield quadrant flashes
37 
38 // CommanderDJ - now dynamic
39 // #define MAX_SHIELD_ICONS 80
40 
42 
44 
45 static int Hud_shield_inited = 0;
46 /*static int Player_shield_coords[GR_NUM_RESOLUTIONS][2] =
47 {
48  { // GR_640
49  396, 379
50  },
51  { // GR_1024
52  634, 670
53  }
54 };
55 
56 static int Target_shield_coords[GR_NUM_RESOLUTIONS][2] =
57 {
58  { // GR_640
59  142, 379
60  },
61  { // GR_1024
62  292, 670
63  }
64 };*/
65 
66 
68  { // GR_640
69  305, 291
70  },
71  { // GR_1024
72  497, 470
73  }
74 };
75 
76 // draw on the mini shield icon what the ship integrity is
78  { // GR_640
79  310, 298, 0
80  },
81  { // GR_1024
82  502, 477, 0
83  }
84 };
86  { // GR_640
87  313, 298, 2
88  },
89  { // GR_1024
90  506, 477, 2
91  }
92 };
94  { // GR_640
95  316, 298, 6
96  },
97  { // GR_1024
98  511, 477, 6
99  }
100 };
102  { // GR_640
103  310, 298
104  },
105  { // GR_1024
106  502, 477
107  }
108 };
109 
112 
113 #define SHIELD_HIT_PLAYER 0
114 #define SHIELD_HIT_TARGET 1
115 static shield_hit_info Shield_hit_data[2];
116 
117 // translate between clockwise-from-top shield quadrant ordering to way quadrants are numbered in the game
119 
120 // called at the start of each level from HUD_init. Use Hud_shield_init so we only init Shield_gauges[] once.
122 {
123  unsigned int i;
125 
126  hud_shield_hit_reset(Player_obj, 1); // reset for the player
127 
128  if ( !Hud_shield_inited ) {
129  for ( i = 0; i < Hud_shield_filenames.size(); i++ ) {
130  Shield_gauges.push_back(temp);
131  Shield_gauges.at(i).first_frame = -1;
132  Shield_gauges.at(i).num_frames = 0;
133  }
134 
135  Hud_shield_inited = 1;
136  }
137 
138  Shield_mini_gauge.first_frame = bm_load_animation("targhit1", &Shield_mini_gauge.num_frames);
139  if ( Shield_mini_gauge.first_frame == -1 ) {
140  Warning(LOCATION, "Could not load in the HUD shield ani: targhit1\n");
141  return;
142  }
143  Shield_mini_loaded = 1;
144 }
145 
146 int hud_shield_maybe_flash(int gauge, int target_index, int shield_offset)
147 {
148  int flashed = 0;
149  shield_hit_info *shi;
150 
151  shi = &Shield_hit_data[target_index];
152 
153  if ( !timestamp_elapsed(shi->shield_hit_timers[shield_offset]) ) {
154  if ( timestamp_elapsed(shi->shield_hit_next_flash[shield_offset]) ) {
156  shi->shield_show_bright ^= (1<<shield_offset); // toggle between default and bright frames
157  }
158 
159  if ( shi->shield_show_bright & (1<<shield_offset) ) {
160  // hud_set_bright_color();
162  flashed = 1;
163  } else {
165  // hud_set_default_color();
166  }
167  }
168 
169  return flashed;
170 }
171 
172 extern int Cmdline_nohtl;
174 
175 // called at beginning of level to page in all ship icons
176 // used in this level
178 {
179  hud_frames *sgp;
180 
181  if ( sip->shield_icon_index == 255 ) {
182  return;
183  }
184 
185  // load in shield frames if not already loaded
186  Assert(sip->shield_icon_index < (ubyte)Hud_shield_filenames.size());
187  sgp = &Shield_gauges.at(sip->shield_icon_index);
188 
189  if ( sgp->first_frame == -1 ) {
190  sgp->first_frame = bm_load_animation(Hud_shield_filenames.at(sip->shield_icon_index).c_str(), &sgp->num_frames);
191  if ( sgp->first_frame == -1 ) {
192  Warning(LOCATION, "Could not load in the HUD shield ani: %s\n", Hud_shield_filenames.at(sip->shield_icon_index).c_str());
193  return;
194  }
195  }
196 
197  int i;
198  for (i=0; i<sgp->num_frames; i++ ) {
199  bm_page_in_aabitmap(sgp->first_frame+i, 1);
200  }
201 
202 }
203 
204 // ------------------------------------------------------------------
205 // hud_shield_equalize()
206 //
207 // Equalize all shield quadrants for an object
208 //
209 void hud_shield_equalize(object *objp, player *pl)
210 {
211  float strength;
212  int idx;
213  int all_equal;
214 
215  Assert(objp != NULL);
216  if (objp == NULL)
217  return;
218 
219  Assert(pl != NULL);
220  if (pl == NULL)
221  return;
222 
223  Assert(objp->type == OBJ_SHIP);
224  if (objp->type != OBJ_SHIP)
225  return;
226 
227  // Goober5000 - quick out if we have no shields
228  if (objp->flags & OF_NO_SHIELDS)
229  return;
230 
231  // are all quadrants equal?
232  all_equal = 1;
233  for (idx = 0; idx < objp->n_quadrants - 1; idx++) {
234  if (objp->shield_quadrant[idx] != objp->shield_quadrant[idx + 1]) {
235  all_equal = 0;
236  break;
237  }
238  }
239 
240  if (all_equal)
241  return;
242 
243  strength = shield_get_strength(objp);
244  if (strength == 0.0f)
245  return;
246 
247  // maybe impose a 2% penalty - server side and single player only
249  strength *= 0.98f;
250 
251  // reset the penalty timestamp
252  pl->shield_penalty_stamp = timestamp(1000);
253  }
254 
255  shield_set_strength(objp, strength);
256 
257  // beep
258  if (objp == Player_obj) {
260  }
261 }
262 
263 // ------------------------------------------------------------------
264 // hud_augment_shield_quadrant()
265 //
266 // Transfer shield energy to a shield quadrant from the three other
267 // quadrants. Works by trying to transfer a fixed amount of shield
268 // energy from the other three quadrants, taking the same percentage
269 // from each quadrant.
270 //
271 // input: objp => object to perform shield transfer on
272 // direction => which quadrant to augment:
273 // 0 - right
274 // 1 - top
275 // 2 - bottom
276 // 3 - left
277 //
278 void hud_augment_shield_quadrant(object *objp, int direction)
279 {
280  Assert(objp->type == OBJ_SHIP);
281 
282  ship *shipp = &Ships[objp->instance];
283  ship_info *sip = &Ship_info[shipp->ship_info_index];
284  float xfer_amount, energy_avail, percent_to_take, delta;
285  float max_quadrant_val;
286  int i;
287 
288  if (sip->flags2 & SIF2_MODEL_POINT_SHIELDS) {
289  direction = sip->shield_point_augment_ctrls[direction];
290 
291  // The re-mapped direction can be -1 if this direction cannot be augmented
292  if (direction < 0)
293  return;
294  }
295 
296  Assert(direction >= 0 && direction < objp->n_quadrants);
297 
298  xfer_amount = shipp->ship_max_shield_strength * SHIELD_TRANSFER_PERCENT;
299  max_quadrant_val = get_max_shield_quad(objp);
300 
301  if ( (objp->shield_quadrant[direction] + xfer_amount) > max_quadrant_val )
302  xfer_amount = max_quadrant_val - objp->shield_quadrant[direction];
303 
304  Assert(xfer_amount >= 0);
305  if ( xfer_amount == 0 ) {
306  // TODO: provide a feedback sound
307  return;
308  }
309  else {
311  }
312 
313  energy_avail = 0.0f;
314  for ( i = 0; i < objp->n_quadrants; i++ ) {
315  if ( i == direction )
316  continue;
317  energy_avail += objp->shield_quadrant[i];
318  }
319 
320  percent_to_take = xfer_amount/energy_avail;
321  if ( percent_to_take > 1.0f )
322  percent_to_take = 1.0f;
323 
324  for ( i = 0; i < objp->n_quadrants; i++ ) {
325  if ( i == direction )
326  continue;
327  delta = percent_to_take * objp->shield_quadrant[i];
328  objp->shield_quadrant[i] -= delta;
329  Assert(objp->shield_quadrant[i] >= 0 );
330  objp->shield_quadrant[direction] += delta;
331  if ( objp->shield_quadrant[direction] > max_quadrant_val )
332  objp->shield_quadrant[direction] = max_quadrant_val;
333  }
334 }
335 
336 // Try to find a match between filename and the names inside
337 // of Hud_shield_filenames. This will provide us with an
338 // association of ship class to shield icon information.
340 {
341  ubyte i;
342 
343  for ( i = 0; i < (ubyte)Hud_shield_filenames.size(); i++ ) {
344  if ( !stricmp(filename, Hud_shield_filenames.at(i).c_str()) ) {
345  sip->shield_icon_index = i;
346  return;
347  }
348  }
349 
350  //No HUD icon found. Add one!
351  sip->shield_icon_index = (unsigned char) Hud_shield_filenames.size();
352  Hud_shield_filenames.push_back((SCP_string)filename);
353 }
354 
355 void hud_show_mini_ship_integrity(object *objp, int x_force, int y_force)
356 {
357  char text_integrity[64];
358  int numeric_integrity;
359  float p_target_integrity;
360  int final_pos[2];
361 
362  p_target_integrity = get_hull_pct(objp);
363 
364  numeric_integrity = fl2i(p_target_integrity*100 + 0.5f);
365  if(numeric_integrity > 100){
366  numeric_integrity = 100;
367  }
368  // Assert(numeric_integrity <= 100);
369 
370  // 3 digit hull strength
371  if ( numeric_integrity == 100 ) {
372  final_pos[0] = x_force + Hud_mini_3digit[gr_screen.res][0] - Shield_mini_coords[gr_screen.res][0];
373  final_pos[1] = y_force + Hud_mini_3digit[gr_screen.res][1] - Shield_mini_coords[gr_screen.res][1];
374  }
375  // 1 digit hull strength
376  else if ( numeric_integrity < 10 ) {
377  final_pos[0] = x_force + Hud_mini_1digit[gr_screen.res][0] - Shield_mini_coords[gr_screen.res][0];
378  final_pos[1] = y_force + Hud_mini_1digit[gr_screen.res][1] - Shield_mini_coords[gr_screen.res][1];
379  }
380  // 2 digit hull strength
381  else {
382  final_pos[0] = x_force + Hud_mini_2digit[gr_screen.res][0] - Shield_mini_coords[gr_screen.res][0];
383  final_pos[1] = y_force + Hud_mini_2digit[gr_screen.res][1] - Shield_mini_coords[gr_screen.res][1];
384  }
385 
386  if ( numeric_integrity == 0 ) {
387  if ( p_target_integrity > 0 ) {
388  numeric_integrity = 1;
389  }
390  }
391 
392  sprintf(text_integrity, "%d", numeric_integrity);
393  if ( numeric_integrity < 100 ) {
394  hud_num_make_mono(text_integrity);
395  }
396 
397  gr_string(final_pos[0], final_pos[1], text_integrity);
398 }
399 
400 // Draw the miniature shield icon that is drawn near the reticle
401 // this function is only used by multi_ingame_join_display_ship() in multi_ingame.cpp as of the new HudGauge implementation (Swifty)
402 void hud_shield_show_mini(object *objp, int x_force, int y_force, int x_hull_offset, int y_hull_offset)
403 {
404  float max_shield;
405  int hud_color_index, range, frame_offset;
406  int sx, sy, i;
407 
408  if ( objp->type != OBJ_SHIP ) {
409  return;
410  }
411 
413 
414  if (!Shield_mini_loaded)
415  return;
416 
417  sx = (x_force == -1) ? Shield_mini_coords[gr_screen.res][0]+fl2i(HUD_offset_x) : x_force;
418  sy = (y_force == -1) ? Shield_mini_coords[gr_screen.res][1]+fl2i(HUD_offset_y) : y_force;
419 
420  // draw the ship first
422  hud_show_mini_ship_integrity(objp, x_force + x_hull_offset,y_force + y_hull_offset);
423 
424  // draw the four quadrants
425  // Draw shield quadrants at one of NUM_SHIELD_LEVELS
426  max_shield = get_max_shield_quad(objp);
427 
428  for ( i = 0; i < objp->n_quadrants; i++ ) {
429 
430  if ( objp->flags & OF_NO_SHIELDS || i >= DEFAULT_SHIELD_SECTIONS) {
431  break;
432  }
433 
434  if (objp->shield_quadrant[Quadrant_xlate[i]] < 0.1f ) {
435  continue;
436  }
437 
439  frame_offset = i+objp->n_quadrants;
440  } else {
441  frame_offset = i;
442  }
443 
444  range = HUD_color_alpha;
445  hud_color_index = fl2i( (objp->shield_quadrant[Quadrant_xlate[i]] / max_shield) * range + 0.5);
446  Assert(hud_color_index >= 0 && hud_color_index <= range);
447 
448  if ( hud_color_index < 0 ) {
449  hud_color_index = 0;
450  }
451  if ( hud_color_index >= HUD_NUM_COLOR_LEVELS ) {
452  hud_color_index = HUD_NUM_COLOR_LEVELS - 1;
453  }
454 
456  // hud_set_bright_color();
458  } else {
459  // gr_set_color_fast(&HUD_color_defaults[hud_color_index]);
460  hud_set_gauge_color(HUD_TARGET_MINI_ICON, hud_color_index);
461  }
462 
463  GR_AABITMAP(Shield_mini_gauge.first_frame + frame_offset, sx + HUD_nose_x, sy + HUD_nose_y);
464  }
465 
466  // hud_set_default_color();
467 }
468 
469 // reset the shield_hit_info data structure
470 // pass NULL as objp if you only need to initialize a shield_hit_info without an
471 // associated ship
473 {
474  int n_quadrants = (objp != NULL) ? objp->n_quadrants : 0;
475 
476  shi->members = n_quadrants + 1;
477  shi->hull_hit_index = n_quadrants;
478  shi->shield_hit_timers.resize(shi->members);
479  shi->shield_hit_next_flash.resize(shi->members);
480 
481  for ( int i = 0; i < shi->members; i++ ) {
482  shi->shield_hit_timers[i] = timestamp(0);
483  shi->shield_hit_next_flash[i] = timestamp(0);
484  }
485 
486  shi->shield_hit_status = 0;
487  shi->shield_show_bright = 0;
488 }
489 
490 // reset the timers and hit flags for the shield gauges
491 //
492 // This needs to be called whenever the player selects a new target
493 //
494 // input: player => optional parameter (default value 0). This is to indicate that player shield hit
495 // info should be reset. This is normally not the case.
496 // is for the player's current target
497 void hud_shield_hit_reset(object *objp, int player)
498 {
499  shield_hit_info *shi;
500 
501  if (player) {
502  shi = &Shield_hit_data[SHIELD_HIT_PLAYER];
503  } else {
504  shi = &Shield_hit_data[SHIELD_HIT_TARGET];
505  }
506 
507  shield_info_reset(objp, shi);
508 }
509 
510 // called once per frame to update the state of Shield_hit_status based on the Shield_hit_timers[]
512 {
513  int i, j, limit;
514 
515  limit = 1;
516  if ( Player_ai->target_objnum >= 0 ) {
517  limit = 2;
518  }
519 
520  for ( i = 0; i < limit; i++ ) {
521  for ( j = 0; j < Shield_hit_data[i].members; j++ ) {
522  if ( timestamp_elapsed(Shield_hit_data[i].shield_hit_timers[j]) ) {
523  Shield_hit_data[i].shield_hit_status &= ~(1<<j);
524  Shield_hit_data[i].shield_show_bright &= ~(1<<j);
525  } else {
526  if ( timestamp_elapsed(Shield_hit_data[i].shield_hit_next_flash[j]) ) {
528  Shield_hit_data[i].shield_show_bright ^= (1<<j); // toggle between default and bright frames
529  }
530  }
531  }
532  }
533 }
534 
535 // called when a shield quadrant is struct, so we can update the timer that will draw the quadrant
536 // as flashing
537 //
538 // input:
539 // objp => object pointer for ship that has been hit
540 // quadrant => quadrant of shield getting hit (-1 if no shield is present)
541 void hud_shield_quadrant_hit(object *objp, int quadrant)
542 {
543  shield_hit_info *shi;
544  int num;
545 
547  return;
548 
549  Assertion(objp != NULL, "hud_shield_quadrant_hit() called with a NULL objp; get a coder!\n");
550 
551  if ( objp->type != OBJ_SHIP )
552  return;
553 
554  hud_escort_ship_hit(objp, quadrant);
556 
557  if ( OBJ_INDEX(objp) == Player_ai->target_objnum ) {
558  shi = &Shield_hit_data[SHIELD_HIT_TARGET];
559  } else if ( objp == Player_obj ) {
560  shi = &Shield_hit_data[SHIELD_HIT_PLAYER];
561  } else {
562  return;
563  }
564 
565  Assertion(shi->shield_hit_timers.size() > 0, "Shield hit info object for object '%s' has a size " SIZE_T_ARG " shield_hit_timers; get a coder!\n", Ships[objp->instance].ship_name, shi->shield_hit_timers.size());
566  Assertion(shi->hull_hit_index < (int) shi->shield_hit_timers.size(), "Shield hit info object for object '%s' has a hull_hit_index of %d (should be between 0 and " SIZE_T_ARG "); get a coder!\n", Ships[objp->instance].ship_name, shi->hull_hit_index, shi->shield_hit_timers.size() - 1);
567 
568  if ( quadrant >= 0 ) {
570  num = Quadrant_xlate[quadrant];
571  else
572  num = quadrant;
573 
574  Assertion(num < shi->hull_hit_index, "Shield hit info object for object '%s' hit on quadrant #%d, despite having a hull_hit_index of %d; get a coder!\n", Ships[objp->instance].ship_name, num, shi->hull_hit_index);
576  } else {
579  }
580 }
581 
584 {
585 }
586 
587 HudGaugeShield::HudGaugeShield(int _gauge_object, int _gauge_config):
588 HudGauge(_gauge_object, _gauge_config, false, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_OTHER_SHIP), 255, 255, 255)
589 {
590 }
591 
592 void HudGaugeShield::render(float frametime)
593 {
594 }
595 
597 {
598 // static int fod_model = -1;
599  float max_shield;
600  int hud_color_index, range;
601  int sx, sy, i;
602  ship *sp;
603  ship_info *sip;
604  hud_frames *sgp=NULL;
605 
606  if ( objp->type != OBJ_SHIP )
607  return;
608 
609  // Goober5000 - don't show if primitive sensors
611  return;
612 
613  sp = &Ships[objp->instance];
614  sip = &Ship_info[sp->ship_info_index];
615 
616 // bool digitus_improbus = (fod_model != -2 && strstr(sp->ship_name, "Sathanas") != NULL);
617  if ( sip->shield_icon_index == 255 && !(sip->flags2 & SIF2_GENERATE_HUD_ICON) /*&& !digitus_improbus*/) {
618  return;
619  }
620 
621  setGaugeColor();
622 
623  // load in shield frames if not already loaded
624  if (sip->shield_icon_index != 255) {
625  sgp = &Shield_gauges.at(sip->shield_icon_index);
626 
627  if ( (sgp->first_frame == -1) && (sip->shield_icon_index < Hud_shield_filenames.size()) ) {
628  sgp->first_frame = bm_load_animation(Hud_shield_filenames.at(sip->shield_icon_index).c_str(), &sgp->num_frames);
629  if (sgp->first_frame == -1) {
632  Warning(LOCATION, "Could not load in the HUD shield ani: %s\n", Hud_shield_filenames.at(sip->shield_icon_index).c_str());
633  }
634  return;
635  }
636  }
637  }
638 
639  sx = position[0];
640  sy = position[1];
641 
642  sx += fl2i(HUD_offset_x);
643  sy += fl2i(HUD_offset_y);
644 
645  // draw the ship first
646  maybeFlashShield(SHIELD_HIT_PLAYER, Shield_hit_data[SHIELD_HIT_PLAYER].hull_hit_index);
647 
648  if(sip->shield_icon_index != 255)
649  {
650  renderBitmap(sgp->first_frame, sx, sy);
651  }
652  else
653  {
654  bool g3_yourself = !g3_in_frame();
655  angles rot_angles = {-1.570796327f,0.0f,0.0f};
656  matrix object_orient;
657 
658  vm_angles_2_matrix(&object_orient, &rot_angles);
659 
660  gr_screen.clip_width = 112;
661  gr_screen.clip_height = 93;
662 
663  //Fire it up
664  if(g3_yourself)
665  g3_start_frame(1);
667  setClip(sx, sy, 112, 93);
668 
669  //if(!digitus_improbus)
671  /*else
672  {
673  vec3d finger_vec = {0.0f, 0.0f, 176.0f};
674  g3_set_view_matrix( &finger_vec, &vmd_identity_matrix, 1.0f);
675  }*/
676 
677  if (!Cmdline_nohtl) {
680  }
681 
682  //We're ready to show stuff
683  //if(!digitus_improbus)
684  {
685  model_render_params render_info;
686 
689  render_info.set_detail_level_lock(1);
690  render_info.set_object_number(OBJ_INDEX(objp));
691 
692  model_render_immediate( &render_info, sip->model_num, &object_orient, &vmd_zero_vector );
693  }
694  /*else
695  {
696  if(fod_model == -1)
697  {
698  fod_model = model_load(NOX("FoD.pof"), 0, NULL);
699  if(fod_model == -1)
700  {
701  fod_model = -2;
702  return;
703  }
704  }
705  model_render(fod_model, &object_orient, &vmd_zero_vector, MR_NO_LIGHTING | MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_FOGGING, -1, -1);
706  }*/
707 
708  //We're done
709  if(!Cmdline_nohtl)
710  {
713  }
714  if(g3_yourself)
715  g3_end_frame();
717 
718  resetClip();
719  }
720 
721  if(!sip->max_shield_strength)
722  return;
723 
724  // draw the quadrants
725  //
726  // Draw shield quadrants at one of NUM_SHIELD_LEVELS
727  max_shield = get_max_shield_quad(objp);
728 
729  coord2d shield_icon_coords[6];
730 
731  for ( i = 0; i < objp->n_quadrants; i++ ) {
732 
733  if ( objp->flags & OF_NO_SHIELDS ) {
734  break;
735  }
736 
737  if ( !(sip->flags2 & SIF2_MODEL_POINT_SHIELDS) ) {
738  if ( objp->shield_quadrant[Quadrant_xlate[i]] < 0.1f )
739  continue;
740  } else {
741  if ( objp->shield_quadrant[i] < 0.1f )
742  continue;
743  }
744 
746 
747  if ( !(sip->flags2 & SIF2_MODEL_POINT_SHIELDS) )
748  hud_color_index = fl2i( (objp->shield_quadrant[Quadrant_xlate[i]] / max_shield) * range);
749  else
750  hud_color_index = fl2i( (objp->shield_quadrant[i] / max_shield) * range);
751 
752  Assert(hud_color_index >= 0 && hud_color_index <= range);
753 
754  if ( hud_color_index < 0 ) {
755  hud_color_index = 0;
756  }
757  if ( hud_color_index >= HUD_NUM_COLOR_LEVELS ) {
758  hud_color_index = HUD_NUM_COLOR_LEVELS - 1;
759  }
760 
761  int flash=0;
762  flash = maybeFlashShield(mode, i);
763 
764 
765  if ( !flash ) {
766  // gr_set_color_fast(&HUD_color_defaults[hud_color_index]);
767  setGaugeColor(hud_color_index);
768 
769 
770  if(sip->shield_icon_index != 255)
771  {
772  int framenum = sgp->first_frame+i+1;
773  if (framenum < sgp->first_frame+sgp->num_frames)
774  renderBitmap(framenum, sx, sy);
775  }
776  else
777  {
778  //Ugh, draw four shield quadrants
779  static const int TRI_EDGE = 6;
780  static const int BAR_LENGTH = 112;
781  static const int BAR_HEIGHT = 54;
782  static const int BAR_WIDTH = 6;
783  static const int SHIELD_OFFSET = BAR_WIDTH + TRI_EDGE + 3;
784 
785  switch(i)
786  {
787  //Top
788  case 0:
789  shield_icon_coords[0].x = sx; shield_icon_coords[0].y = sy+BAR_WIDTH+TRI_EDGE;
790  shield_icon_coords[1].x = sx; shield_icon_coords[1].y = sy;
791  shield_icon_coords[2].x = sx+TRI_EDGE; shield_icon_coords[2].y = sy+BAR_WIDTH;
792  shield_icon_coords[3].x = sx+BAR_LENGTH; shield_icon_coords[3].y = sy;
793  shield_icon_coords[4].x = sx+BAR_LENGTH-TRI_EDGE; shield_icon_coords[4].y = sy+BAR_WIDTH;
794  shield_icon_coords[5].x = sx+BAR_LENGTH; shield_icon_coords[5].y = sy+BAR_WIDTH+TRI_EDGE;
795  renderShieldIcon(shield_icon_coords);
796  break;
797  //Left
798  case 3:
799  sy += SHIELD_OFFSET;
800  shield_icon_coords[0].x = sx+BAR_WIDTH+TRI_EDGE; shield_icon_coords[0].y = sy+BAR_HEIGHT;
801  shield_icon_coords[1].x = sx; shield_icon_coords[1].y = sy+BAR_HEIGHT;
802  shield_icon_coords[2].x = sx+BAR_WIDTH; shield_icon_coords[2].y = sy+BAR_HEIGHT-TRI_EDGE;
803  shield_icon_coords[3].x = sx; shield_icon_coords[3].y = sy;
804  shield_icon_coords[4].x = sx+BAR_WIDTH; shield_icon_coords[4].y = sy+TRI_EDGE;
805  shield_icon_coords[5].x = sx+BAR_WIDTH+TRI_EDGE; shield_icon_coords[5].y = sy;
806  renderShieldIcon(shield_icon_coords);
807  sy -= SHIELD_OFFSET + BAR_WIDTH + TRI_EDGE;
808  break;
809  //Right
810  case 1:
811  sx += BAR_LENGTH;
812  sy += SHIELD_OFFSET;
813  shield_icon_coords[0].x = sx-BAR_WIDTH-TRI_EDGE; shield_icon_coords[0].y = sy;
814  shield_icon_coords[1].x = sx; shield_icon_coords[1].y = sy;
815  shield_icon_coords[2].x = sx-BAR_WIDTH; shield_icon_coords[2].y = sy+TRI_EDGE;
816  shield_icon_coords[3].x = sx; shield_icon_coords[3].y = sy+BAR_HEIGHT;
817  shield_icon_coords[4].x = sx-BAR_WIDTH; shield_icon_coords[4].y = sy+BAR_HEIGHT-TRI_EDGE;
818  shield_icon_coords[5].x = sx-BAR_WIDTH-TRI_EDGE; shield_icon_coords[5].y = sy+BAR_HEIGHT;
819  renderShieldIcon(shield_icon_coords);
820  sx -= BAR_LENGTH;
821  sy -= SHIELD_OFFSET;
822  break;
823  //Bottom
824  case 2:
825  sy += BAR_HEIGHT + SHIELD_OFFSET*2 - BAR_WIDTH - TRI_EDGE;
826  shield_icon_coords[0].x = sx+BAR_LENGTH; shield_icon_coords[0].y = sy;
827  shield_icon_coords[1].x = sx+BAR_LENGTH; shield_icon_coords[1].y = sy+BAR_WIDTH+TRI_EDGE;
828  shield_icon_coords[2].x = sx+BAR_LENGTH-TRI_EDGE; shield_icon_coords[2].y = sy+TRI_EDGE;
829  shield_icon_coords[3].x = sx; shield_icon_coords[3].y = sy+BAR_WIDTH+TRI_EDGE;
830  shield_icon_coords[4].x = sx+TRI_EDGE; shield_icon_coords[4].y = sy+TRI_EDGE;
831  shield_icon_coords[5].x = sx; shield_icon_coords[5].y = sy;
832  renderShieldIcon(shield_icon_coords);
833  sy -= BAR_HEIGHT + SHIELD_OFFSET*2 - BAR_WIDTH - TRI_EDGE;
834  break;
835  //Whoops?
836  default:
837  nprintf(("HUD", "Invalid shield quadrant %d specified!\n", i));
838  break;
839  }
840  }
841  }
842  }
843 
844  // hud_set_default_color();
845 }
846 
847 /*
848  * Render a shield icon - basic shape is:
849  * 1 3
850  * ***************************
851  * ***************************
852  * ** 2 4 **
853  * * *
854  * 0 5
855  *
856  * Defined by 6 points, must be passed in the order show above (i.e. a valid triangle strip)
857  *
858  */
860 {
861  int nx = 0, ny = 0, i;
862 
863  if ( gr_screen.rendering_to_texture != -1 ) {
865  } else {
866  if ( reticle_follow ) {
867  nx = HUD_nose_x;
868  ny = HUD_nose_y;
869 
870  gr_resize_screen_pos(&nx, &ny);
872  gr_unsize_screen_pos(&nx, &ny);
873  } else {
875  }
876  }
877 
878  for (i = 0; i < 6; ++i) {
879  coords[i].x += nx;
880  coords[i].y += ny;
881  }
882 
883  gr_shield_icon(coords);
885 }
886 
887 int HudGaugeShield::maybeFlashShield(int target_index, int shield_offset)
888 {
889  int flashed = 0;
890  shield_hit_info *shi;
891 
892  shi = &Shield_hit_data[target_index];
893 
894  if ( !timestamp_elapsed(shi->shield_hit_timers[shield_offset]) ) {
895  if ( shi->shield_show_bright & (1<<shield_offset) ) {
896  // hud_set_bright_color();
898  flashed = 1;
899  } else {
901  // hud_set_default_color();
902  }
903  }
904 
905  return flashed;
906 }
907 
910 {
911 }
912 
913 void HudGaugeShieldPlayer::render(float frametime)
914 {
916 }
917 
920 {
921 
922 }
923 
924 void HudGaugeShieldTarget::render(float frametime)
925 {
926  if (Player_ai->target_objnum == -1)
927  return;
928 
929  object *targetp = &Objects[Player_ai->target_objnum];
930 
931  // check to see if there is even a current target
932  if ( targetp == &obj_used_list ) {
933  return;
934  }
935 
936  if ( targetp == Player_obj)
937  return;
938 
939  showShields(targetp, SHIELD_HIT_TARGET);
940 }
941 
942 HudGaugeShieldMini::HudGaugeShieldMini(): // HUD_TARGET_MINI_ICON
944 {
945 }
946 
948 {
949  Mini_3digit_offsets[0] = x;
950  Mini_3digit_offsets[1] = y;
951 }
952 
954 {
955  Mini_1digit_offsets[0] = x;
956  Mini_1digit_offsets[1] = y;
957 }
958 
960 {
961  Mini_2digit_offsets[0] = x;
962  Mini_2digit_offsets[1] = y;
963 }
964 
966 {
967  Shield_mini_gauge.first_frame = bm_load_animation(fname, &Shield_mini_gauge.num_frames);
968  if ( Shield_mini_gauge.first_frame == -1 ) {
969  Warning(LOCATION, "Could not load in the HUD shield ani: %s\n", fname);
970  }
971 }
972 
973 void HudGaugeShieldMini::render(float frametime)
974 {
975  if (Player_ai->target_objnum == -1)
976  return;
977 
978  object *targetp = &Objects[Player_ai->target_objnum];
979 
980  // check to see if there is even a current target
981  if ( targetp == &obj_used_list ) {
982  return;
983  }
984 
985  showMiniShields(targetp);
986 }
987 
989 {
990  bm_page_in_aabitmap( Shield_mini_gauge.first_frame, Shield_mini_gauge.num_frames );
991 }
992 
993 // Draw the miniature shield icon that is drawn near the reticle
995 {
996  float max_shield;
997  int hud_color_index, range, frame_offset;
998  int sx, sy, i;
999 
1000  if ( objp->type != OBJ_SHIP ) {
1001  return;
1002  }
1003 
1004  setGaugeColor();
1005 
1006  sx = position[0]+fl2i(HUD_offset_x);
1007  sy = position[1]+fl2i(HUD_offset_y);
1008 
1009  // draw the ship first
1010  maybeFlashShield(SHIELD_HIT_TARGET, Shield_hit_data[SHIELD_HIT_TARGET].hull_hit_index);
1011  showIntegrity(get_hull_pct(objp));
1012 
1013  // draw the four quadrants
1014  // Draw shield quadrants at one of NUM_SHIELD_LEVELS
1015  max_shield = get_max_shield_quad(objp);
1016 
1017  for ( i = 0; i < objp->n_quadrants; i++ ) {
1018 
1019  if ( objp->flags & OF_NO_SHIELDS ) {
1020  break;
1021  }
1022 
1023  if ( objp->shield_quadrant[Quadrant_xlate[i]] < 0.1f ) {
1024  continue;
1025  }
1026 
1027  if ( maybeFlashShield(SHIELD_HIT_TARGET, i) ) {
1028  frame_offset = i+objp->n_quadrants;
1029  } else {
1030  frame_offset = i;
1031  }
1032 
1033  range = HUD_color_alpha;
1034  hud_color_index = fl2i( (objp->shield_quadrant[Quadrant_xlate[i]] / max_shield) * range + 0.5);
1035  Assert(hud_color_index >= 0 && hud_color_index <= range);
1036 
1037  if ( hud_color_index < 0 ) {
1038  hud_color_index = 0;
1039  }
1040  if ( hud_color_index >= HUD_NUM_COLOR_LEVELS ) {
1041  hud_color_index = HUD_NUM_COLOR_LEVELS - 1;
1042  }
1043 
1044  if ( maybeFlashSexp() == 1) {
1045  // hud_set_bright_color();
1047  } else {
1048  // gr_set_color_fast(&HUD_color_defaults[hud_color_index]);
1049  setGaugeColor(hud_color_index);
1050  }
1051 
1052  if (frame_offset < Shield_mini_gauge.num_frames)
1053  renderBitmap(Shield_mini_gauge.first_frame + frame_offset, sx, sy);
1054  }
1055 
1056  // hud_set_default_color();
1057 }
1058 
1059 void HudGaugeShieldMini::showIntegrity(float p_target_integrity)
1060 {
1061  char text_integrity[64];
1062  int numeric_integrity;
1063  int final_pos[2];
1064 
1065  numeric_integrity = fl2i(p_target_integrity*100 + 0.5f);
1066  if(numeric_integrity > 100){
1067  numeric_integrity = 100;
1068  }
1069  // Assert(numeric_integrity <= 100);
1070 
1071  // 3 digit hull strength
1072  if ( numeric_integrity == 100 ) {
1073  memcpy(final_pos, Mini_3digit_offsets, sizeof(final_pos));
1074  }
1075  // 1 digit hull strength
1076  else if ( numeric_integrity < 10 ) {
1077  memcpy(final_pos, Mini_1digit_offsets, sizeof(final_pos));
1078  }
1079  // 2 digit hull strength
1080  else {
1081  memcpy(final_pos, Mini_2digit_offsets, sizeof(final_pos));
1082  }
1083 
1084  if ( numeric_integrity == 0 ) {
1085  if ( p_target_integrity > 0 ) {
1086  numeric_integrity = 1;
1087  }
1088  }
1089 
1090  final_pos[0] += fl2i( HUD_offset_x ) + position[0];
1091  final_pos[1] += fl2i( HUD_offset_y ) + position[1];
1092 
1093  sprintf(text_integrity, "%d", numeric_integrity);
1094  if ( numeric_integrity < 100 ) {
1095  hud_num_make_mono(text_integrity, font_num);
1096  }
1097 
1098  renderString(final_pos[0], final_pos[1], text_integrity);
1099 }
1100 
1101 int HudGaugeShieldMini::maybeFlashShield(int target_index, int shield_offset)
1102 {
1103  int flashed = 0;
1104  shield_hit_info *shi;
1105 
1106  shi = &Shield_hit_data[target_index];
1107 
1108  if ( !timestamp_elapsed(shi->shield_hit_timers[shield_offset]) ) {
1109  if ( shi->shield_show_bright & (1<<shield_offset) ) {
1110  // hud_set_bright_color();
1112  flashed = 1;
1113  } else {
1115  // hud_set_default_color();
1116  }
1117  }
1118 
1119  return flashed;
1120 }
void hud_shield_equalize(object *objp, player *pl)
Definition: hudshield.cpp:209
int target_h
Definition: hud.h:241
int Mini_2digit_offsets[2]
Definition: hudshield.h:89
int timestamp(int delta_ms)
Definition: timer.cpp:226
#define MULTIPLAYER_CLIENT
Definition: multi.h:132
int i
Definition: multi_pxo.cpp:466
float get_max_shield_quad(object *objp)
Definition: object.cpp:260
void hud_ship_icon_page_in(ship_info *sip)
Definition: hudshield.cpp:177
ubyte shield_icon_index
Definition: ship.h:1337
int HUD_color_alpha
Definition: hud.cpp:76
#define timestamp_elapsed_safe(_a, _b)
Definition: timer.h:114
#define HUD_TARGET_SHIELD_ICON
Definition: hudgauges.h:29
void hud_gauge_popup_start(int gauge_index, int time)
Start a gauge to pop-up.
Definition: hud.cpp:3036
float Proj_fov
Definition: 3dsetup.cpp:31
int HUD_nose_x
Definition: hud.cpp:94
ai_info * Player_ai
Definition: ai.cpp:24
int target_w
Definition: hud.h:241
#define HUD_C_BRIGHT
Definition: hud.h:162
void showIntegrity(float p_target_integrity)
Definition: hudshield.cpp:1059
int maybeFlashShield(int target_index, int shield_offset)
Definition: hudshield.cpp:887
int Game_mode
Definition: systemvars.cpp:24
int Hud_mini_3digit[GR_NUM_RESOLUTIONS][3]
Definition: hudshield.cpp:77
int Shield_mini_loaded
Definition: hudshield.cpp:110
int HUD_nose_y
Definition: hud.cpp:95
float shield_get_strength(object *objp)
SCP_vector< game_snd > Snds
Definition: gamesnd.cpp:19
#define gr_end_view_matrix
Definition: 2d.h:896
void hud_num_make_mono(char *num_str, int font_num)
Convert a number string to use mono-spaced 1 character.
Definition: hud.cpp:2275
#define VM_WARP_CHASE
Definition: systemvars.h:37
matrix * vm_angles_2_matrix(matrix *m, const angles *a)
Definition: vecmat.cpp:752
int canvas_h
Definition: hud.h:240
#define SIF2_GENERATE_HUD_ICON
Definition: ship.h:923
void setGaugeColor(int bright_index=-4)
Definition: hud.cpp:445
int model_num
Definition: ship.h:1189
float ship_max_shield_strength
Definition: ship.h:596
SCP_vector< int > shield_hit_next_flash
Definition: hudshield.h:26
int Hud_mini_2digit[GR_NUM_RESOLUTIONS][3]
Definition: hudshield.cpp:85
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
Assert(pm!=NULL)
int target_objnum
Definition: ai.h:339
#define HUD_NUM_COLOR_LEVELS
Definition: hud.h:66
bool reticle_follow
Definition: hud.h:214
#define GR_NUM_RESOLUTIONS
Definition: 2d.h:651
SCP_vector< SCP_string > Hud_shield_filenames
Definition: hudshield.cpp:41
__inline void gr_string(int x, int y, const char *string, int resize_mode=GR_RESIZE_FULL)
Definition: 2d.h:769
#define VM_EXTERNAL
Definition: systemvars.h:31
#define HUD_OBJECT_TARGET_SHIELD
Definition: hudparse.h:118
matrix Eye_matrix
Definition: 3dsetup.cpp:26
int res
Definition: 2d.h:370
int shield_show_bright
Definition: hudshield.h:28
void hud_escort_ship_hit(object *objp, int quadrant)
Definition: hudescort.cpp:989
void set_flags(uint flags)
#define MR_NO_LIGHTING
Definition: model.h:867
int base_h
Definition: hud.h:205
void model_render_immediate(model_render_params *render_info, int model_num, matrix *orient, vec3d *pos, int render, bool sort)
int maybeFlashShield(int target_index, int shield_offset)
Definition: hudshield.cpp:1101
GLclampf f
Definition: Glext.h:7097
#define SIZE_T_ARG
Definition: clang.h:61
#define OF_NO_SHIELDS
Definition: object.h:110
#define Assertion(expr, msg,...)
Definition: clang.h:41
object obj_used_list
Definition: object.cpp:53
void set_detail_level_lock(int detail_level_lock)
GLenum mode
Definition: Glext.h:5794
#define HUD_OBJECT_MINI_SHIELD
Definition: hudparse.h:112
int n_quadrants
Definition: object.h:158
void gr_set_screen_scale(int w, int h, int zoom_w, int zoom_h, int max_w, int max_h, int center_w, int center_h, bool force_stretch)
Definition: 2d.cpp:104
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
Definition: vmallocator.h:21
object * objp
Definition: lua.cpp:3105
int x
Definition: pstypes.h:218
ship * shipp
Definition: lua.cpp:9162
#define gr_end_proj_matrix
Definition: 2d.h:894
void setClip(int x, int y, int w, int h)
Definition: hud.cpp:942
#define HUD_COLOR_ALPHA_MAX
Definition: hud.h:73
int y
Definition: pstypes.h:218
int clip_height
Definition: 2d.h:378
void hud_shield_show_mini(object *objp, int x_force, int y_force, int x_hull_offset, int y_hull_offset)
Definition: hudshield.cpp:402
int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *keyframe, int can_drop_frames, int dir_type)
Loads a bitmap sequance so we can draw with it.
Definition: bmpman.cpp:1420
Definition: hud.h:201
int shield_penalty_stamp
Definition: player.h:200
int Cmdline_nohtl
Definition: cmdline.cpp:438
void render(float frametime)
Definition: hudshield.cpp:924
#define gr_set_view_matrix
Definition: 2d.h:895
int Shield_mini_coords[GR_NUM_RESOLUTIONS][2]
Definition: hudshield.cpp:67
int instance
Definition: object.h:150
GLenum GLint * range
Definition: Glext.h:7096
Definition: player.h:85
#define VM_DEAD_VIEW
Definition: systemvars.h:33
#define gr_set_proj_matrix
Definition: 2d.h:893
GLfloat ny
Definition: Glext.h:8367
void shield_info_reset(object *objp, shield_hit_info *shi)
Definition: hudshield.cpp:472
SCP_vector< hud_frames > Shield_gauges
Definition: hudshield.cpp:43
#define HUD_TARGET_MINI_ICON
Definition: hudgauges.h:41
#define nprintf(args)
Definition: pstypes.h:239
GLuint coords
Definition: Glext.h:6925
int font_num
Definition: hud.h:210
#define GR_AABITMAP(a, b, c)
Definition: hud.h:79
SCP_vector< int > shield_hit_timers
Definition: hudshield.h:25
float clip_aspect
Definition: 2d.h:372
int * ship_replacement_textures
Definition: ship.h:751
#define SHIELD_HIT_PLAYER
Definition: hudshield.cpp:113
void g3_set_view_matrix(const vec3d *view_pos, const matrix *view_matrix, float zoom)
Definition: 3dsetup.cpp:152
float get_hull_pct(object *objp)
Definition: object.cpp:271
char * filename
int num_frames
Definition: hud.h:34
int Mini_1digit_offsets[2]
Definition: hudshield.h:88
void hud_shield_level_init()
Definition: hudshield.cpp:121
int base_w
Definition: hud.h:205
float Max_draw_distance
Definition: 2d.cpp:85
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
void hud_shield_quadrant_hit(object *objp, int quadrant)
Definition: hudshield.cpp:541
void gr_shield_icon(coord2d coords[6], int resize_mode)
Definition: 2d.cpp:2046
ubyte Quadrant_xlate[DEFAULT_SHIELD_SECTIONS]
Definition: hudshield.cpp:118
int snd_play(game_snd *gs, float pan, float vol_scale, int priority, bool is_voice_msg)
Definition: sound.cpp:517
void init1DigitOffsets(int x, int y)
Definition: hudshield.cpp:953
float max_shield_strength
Definition: ship.h:1310
Definition: hud.h:32
void hud_set_gauge_color(int gauge_index, int bright_index)
Set the HUD color for the gauge, based on whether it is flashing or not.
Definition: hud.cpp:3095
vec3d closeup_pos
Definition: ship.h:1327
#define DEFAULT_SHIELD_SECTIONS
Definition: object.h:24
int flags2
Definition: ship.h:1228
int hud_shield_maybe_flash(int gauge, int target_index, int shield_offset)
Definition: hudshield.cpp:146
Definition: ship.h:534
#define delta
Definition: fvi.cpp:418
int idx
Definition: multiui.cpp:761
void resetClip()
Definition: hud.cpp:978
void renderString(int x, int y, const char *str)
Definition: hud.cpp:665
#define SHIELD_HIT_DURATION_SHORT
Definition: hudshield.cpp:35
GLint GLint GLint GLint GLint x
Definition: Glext.h:5182
object Objects[MAX_OBJECTS]
Definition: object.cpp:62
unsigned char ubyte
Definition: pstypes.h:62
void render(float frametime)
Definition: hudshield.cpp:913
void set_replacement_textures(int *textures)
#define OBJ_INDEX(objp)
Definition: object.h:235
virtual void render(float frametime)
Definition: hudshield.cpp:592
void hud_shield_hit_update()
Definition: hudshield.cpp:511
#define SHIELD_HIT_TARGET
Definition: hudshield.cpp:114
#define OBJ_SHIP
Definition: object.h:32
#define GM_STANDALONE_SERVER
Definition: systemvars.h:27
void renderShieldIcon(coord2d coords[6])
Definition: hudshield.cpp:859
#define TBOX_FLASH_HULL
Definition: hudtargetbox.h:28
int shield_point_augment_ctrls[4]
Definition: ship.h:1316
int maybeFlashSexp()
Definition: hud.cpp:617
int canvas_w
Definition: hud.h:240
int first_frame
Definition: hud.h:33
int hud_gauge_maybe_flash(int gauge_index)
Set the color for a gauge that may be flashing.
Definition: hud.cpp:3167
vec3d Eye_position
Definition: 3dsetup.cpp:27
#define HUD_PLAYER_SHIELD_ICON
Definition: hudgauges.h:30
ship Ships[MAX_SHIPS]
Definition: ship.cpp:122
bool gr_resize_screen_pos(int *x, int *y, int *w, int *h, int resize_mode)
Definition: 2d.cpp:212
void init2DigitOffsets(int x, int y)
Definition: hudshield.cpp:959
#define HUD_C_NORMAL
Definition: hud.h:164
GLuint GLuint num
Definition: Glext.h:9089
void hud_shield_assign_info(ship_info *sip, char *filename)
Definition: hudshield.cpp:339
int shield_hit_status
Definition: hudshield.h:27
bool shield_ani_warning_displayed_already
Definition: hudshield.cpp:173
int position[2]
Definition: hud.h:204
hud_frames Shield_mini_gauge
Definition: hudshield.cpp:111
void bm_page_in_aabitmap(int bitmapnum, int nframes)
Marks a texture as being used for this level, and is anti-aliased.
Definition: bmpman.cpp:2354
int g3_in_frame()
Definition: 3dsetup.cpp:66
#define fl2i(fl)
Definition: floating.h:33
void hud_targetbox_start_flash(int index, int duration)
#define g3_end_frame()
Definition: 3d.h:49
GLfloat GLfloat GLfloat GLfloat nx
Definition: Glext.h:8369
int clip_width
Definition: 2d.h:378
screen gr_screen
Definition: 2d.cpp:46
float Min_draw_distance
Definition: 2d.cpp:84
void init3DigitOffsets(int x, int y)
Definition: hudshield.cpp:947
int ship_info_index
Definition: ship.h:539
int hull_hit_index
Definition: hudshield.h:24
#define SHIELD_FLASH_INTERVAL_FAST
Definition: hudshield.cpp:36
void hud_augment_shield_quadrant(object *objp, int direction)
Definition: hudshield.cpp:278
SCP_vector< ship_info > Ship_info
Definition: ship.cpp:164
#define LOCATION
Definition: pstypes.h:245
int Hud_mini_1digit[GR_NUM_RESOLUTIONS][3]
Definition: hudshield.cpp:93
#define VM_PADLOCK_ANY
Definition: systemvars.h:46
void gr_reset_screen_scale()
Definition: 2d.cpp:176
void initBitmaps(char *fname)
Definition: hudshield.cpp:965
#define timestamp_elapsed(stamp)
Definition: timer.h:102
SCP_vector< float > shield_quadrant
Definition: object.h:159
void render(float frametime)
Definition: hudshield.cpp:973
bool gr_unsize_screen_pos(int *x, int *y, int *w, int *h, int resize_mode)
Definition: 2d.cpp:320
#define SIF2_MODEL_POINT_SHIELDS
Definition: ship.h:936
float HUD_offset_x
Definition: hud.cpp:90
void shield_set_strength(object *objp, float strength)
void hud_shield_hit_reset(object *objp, int player)
Definition: hudshield.cpp:497
#define SHIELD_TRANSFER_PERCENT
Definition: hudshield.cpp:33
object * Player_obj
Definition: object.cpp:56
uint flags2
Definition: ship.h:645
int temp
Definition: lua.cpp:4996
#define HUD_OBJECT_PLAYER_SHIELD
Definition: hudparse.h:115
int Hud_mini_base[GR_NUM_RESOLUTIONS][2]
Definition: hudshield.cpp:101
#define MAX(a, b)
Definition: pstypes.h:299
float closeup_zoom
Definition: ship.h:1328
float HUD_offset_y
Definition: hud.cpp:91
#define VM_OTHER_SHIP
Definition: systemvars.h:35
#define SF2_PRIMITIVE_SENSORS
Definition: ship.h:483
false
Definition: lua.cpp:6789
uint flags
Definition: object.h:151
shield quadrant transfer successful
Definition: gamesnd.h:111
void hud_show_mini_ship_integrity(object *objp, int x_force, int y_force)
Definition: hudshield.cpp:355
void set_object_number(int num)
int rendering_to_texture
Definition: 2d.h:403
char type
Definition: object.h:146
vec3d vmd_zero_vector
Definition: vecmat.cpp:24
GLint limit
Definition: Glext.h:9797
int Mini_3digit_offsets[2]
Definition: hudshield.h:87
void showShields(object *objp, int mode)
Definition: hudshield.cpp:596
#define MR_NO_FOGGING
Definition: model.h:884
#define stricmp(s1, s2)
Definition: config.h:271
void showMiniShields(object *objp)
Definition: hudshield.cpp:994
matrix vmd_identity_matrix
Definition: vecmat.cpp:28
char ship_name[NAME_LENGTH]
Definition: ship.h:604
void hud_save_restore_camera_data(int save)
Called to save and restore the 3D camera settings.
Definition: hud.cpp:3656
GLint y
Definition: Gl.h:1505
#define g3_start_frame(zbuffer_flag)
Definition: 3d.h:39
void renderBitmap(int x, int y)
Definition: hud.cpp:782
#define MR_AUTOCENTER
Definition: model.h:875