Open source remastering of the Freespace 2 engine
hudtargetbox.cpp File Reference
#include "asteroid/asteroid.h"
#include "cmdline/cmdline.h"
#include "debris/debris.h"
#include "freespace2/freespace.h"
#include "gamesnd/gamesnd.h"
#include "graphics/gropenglshader.h"
#include "hud/hudbrackets.h"
#include "hud/hudtargetbox.h"
#include "iff_defs/iff_defs.h"
#include "io/timer.h"
#include "jumpnode/jumpnode.h"
#include "localization/localize.h"
#include "mission/missionparse.h"
#include "model/model.h"
#include "network/multi.h"
#include "object/object.h"
#include "object/objectdock.h"
#include "parse/parselo.h"
#include "playerman/player.h"
#include "ship/ship.h"
#include "ship/subsysdamage.h"
#include "species_defs/species_defs.h"
#include "weapon/emp.h"
#include "weapon/weapon.h"
#include "hud/hudets.h"

Go to the source code of this file.


#define NUM_TBOX_COORDS   11
#define TBOX_NAME   1
#define TBOX_CLASS   2
#define TBOX_DIST   3
#define TBOX_SPEED   4
#define TBOX_CARGO   5
#define TBOX_HULL   6
#define TBOX_EXTRA   7
#define TBOX_EXTRA_TIME   9
#define TBOX_EXTRA_DOCK   10
#define TS_DIS   0
#define TS_OK   1
#define TS_DMG   2
#define TS_CRT   3


void hud_targetbox_truncate_subsys_name (char *outstr)
void hud_targetbox_switch_wireframe_mode ()
void hud_targetbox_init_flash_timer (int index)
void hud_targetbox_init_flash ()
void hud_get_target_strength (object *objp, float *shields, float *integrity)
int turret_weapon_aggregate_flags (ship_weapon *swp)
int turret_weapon_aggregate_flags2 (ship_weapon *swp)
bool turret_weapon_has_subtype (ship_weapon *swp, int subtype)
void get_turret_subsys_name (ship_weapon *swp, char *outstr)
int hud_targetbox_subsystem_in_view (object *target_objp, int *sx, int *sy)
void hud_cargo_scan_update (object *targetp, float frametime)
void hud_update_cargo_scan_sound ()
void hud_init_target_static ()
void hud_update_target_static ()
void hud_update_ship_status (object *targetp)
void hud_targetbox_start_flash (int index, int duration)
void hud_targetbox_end_flash (int index)


float View_zoom
int Target_window_coords [GR_NUM_RESOLUTIONS][4]
objectEnemy_attacker = NULL
int Target_static_looping
int Target_display_cargo
char Cargo_string [256] = ""
int Show_target_debug_info
int Show_target_weapons
char * modifiers []
int Cargo_scan_coords [GR_NUM_RESOLUTIONS][4]
int Targetbox_flash_timers [NUM_TBOX_FLASH_TIMERS]
int Targetbox_wire = 0
int Targetbox_shader_effect = -1
bool Lock_targetbox_mode = false
bool Interp_desaturate

Macro Definition Documentation

#define NUM_TBOX_COORDS   11

Definition at line 77 of file hudtargetbox.cpp.


Definition at line 78 of file hudtargetbox.cpp.

#define TBOX_CARGO   5

Definition at line 83 of file hudtargetbox.cpp.

#define TBOX_CLASS   2

Definition at line 80 of file hudtargetbox.cpp.

#define TBOX_DIST   3

Definition at line 81 of file hudtargetbox.cpp.

#define TBOX_EXTRA   7

Definition at line 85 of file hudtargetbox.cpp.

#define TBOX_EXTRA_DOCK   10

Definition at line 88 of file hudtargetbox.cpp.


Definition at line 86 of file hudtargetbox.cpp.

#define TBOX_EXTRA_TIME   9

Definition at line 87 of file hudtargetbox.cpp.

#define TBOX_HULL   6

Definition at line 84 of file hudtargetbox.cpp.

#define TBOX_NAME   1

Definition at line 79 of file hudtargetbox.cpp.

#define TBOX_SPEED   4

Definition at line 82 of file hudtargetbox.cpp.

#define TS_CRT   3

Definition at line 111 of file hudtargetbox.cpp.

#define TS_DIS   0

Definition at line 108 of file hudtargetbox.cpp.

#define TS_DMG   2

Definition at line 110 of file hudtargetbox.cpp.

#define TS_OK   1

Definition at line 109 of file hudtargetbox.cpp.

Function Documentation

void get_turret_subsys_name ( ship_weapon swp,
char *  outstr 

Definition at line 1557 of file hudtargetbox.cpp.

void hud_cargo_scan_update ( object targetp,
float  frametime 

Definition at line 1842 of file hudtargetbox.cpp.

void hud_get_target_strength ( object objp,
float shields,
float integrity 

Get the shield and hull percentages for a given ship object

objpPointer to ship object that you want strength values for
shieldsOUTPUT parameter: percentage value of shields (0->1.0)
integrityOUTPUT parameter: percentage value of integrity (0->1.0)

Definition at line 1347 of file hudtargetbox.cpp.

void hud_init_target_static ( )

Called at the start of each level

Definition at line 2193 of file hudtargetbox.cpp.

void hud_targetbox_end_flash ( int  index)

Stop flashing a specific targetbox item

Definition at line 2295 of file hudtargetbox.cpp.

void hud_targetbox_init_flash ( )

Init the timers used to flash different parts of the targetbox.

This needs to get called whenever the current target changes.
Need to call initFlashTimers for any TargetBox gauges and call initDockFlashTimer() for Extra Target Info gauges (Switfty)

Definition at line 1292 of file hudtargetbox.cpp.

void hud_targetbox_init_flash_timer ( int  index)

Init a specific targetbox timer

Definition at line 1281 of file hudtargetbox.cpp.

void hud_targetbox_start_flash ( int  index,
int  duration 

Start the targetbox item flashing for duration ms

indexTBOX_FLASH_ define
durationoptional param (default value TBOX_FLASH_DURATION), how long to flash in ms

Definition at line 2287 of file hudtargetbox.cpp.

int hud_targetbox_subsystem_in_view ( object target_objp,
int sx,
int sy 

Determine if the subsystem is in line-of sight, without taking into account whether the player ship is facing the subsystem

Definition at line 1802 of file hudtargetbox.cpp.

void hud_targetbox_switch_wireframe_mode ( )

Toggle through the valid targetbox modes

1==wireframe only
2==standard with lighting

Definition at line 1270 of file hudtargetbox.cpp.

void hud_targetbox_truncate_subsys_name ( char *  outstr)
Cut down long subsystem names to a more manageable length

Definition at line 119 of file hudtargetbox.cpp.

void hud_update_cargo_scan_sound ( )

Definition at line 1856 of file hudtargetbox.cpp.

void hud_update_ship_status ( object targetp)

Updates the HUD status description of a particular ship

Checks for disabled or ships with disrupted engines, as well as damage levels of the target ship. If status has changed, then the HUD will flash

targetpInstance of the ship target – note the targetp->instance cannot be negative

Definition at line 2254 of file hudtargetbox.cpp.

void hud_update_target_static ( )

Determine if we should draw static on top of the target box

Definition at line 2202 of file hudtargetbox.cpp.

int turret_weapon_aggregate_flags ( ship_weapon swp)

Just gloms all the flags from all the weapons into one variable. More efficient if all you need to do is test for the existence of a flag.

Definition at line 360 of file aiturret.cpp.

int turret_weapon_aggregate_flags2 ( ship_weapon swp)

Just gloms all the flags from all the weapons into one variable. More efficient if all you need to do is test for the existence of a flag.

Definition at line 384 of file aiturret.cpp.

bool turret_weapon_has_subtype ( ship_weapon swp,
int  subtype 

Returns true if any of the weapons in swp have the subtype specified

It might be a little faster to optimize based on WP_LASER should only appear in primaries and WP_MISSILE in secondaries. but in the interest of future coding I leave it like this.

Definition at line 411 of file aiturret.cpp.

Variable Documentation

int Cargo_scan_coords[GR_NUM_RESOLUTIONS][4]
Initial value:
= {
7, 364, 130, 109
7, 635, 130, 109

Definition at line 91 of file hudtargetbox.cpp.

char Cargo_string[256] = ""

Definition at line 61 of file hudtargetbox.cpp.

object* Enemy_attacker = NULL

Definition at line 54 of file hudtargetbox.cpp.

bool Interp_desaturate

Definition at line 157 of file modelinterp.cpp.

bool Lock_targetbox_mode = false

Definition at line 105 of file hudtargetbox.cpp.

char* modifiers[]
Initial value:
= {

Definition at line 69 of file hudtargetbox.cpp.

int Show_target_debug_info

Definition at line 200 of file fredstubs.cpp.

int Show_target_weapons

Definition at line 199 of file fredstubs.cpp.

int Target_display_cargo

Definition at line 60 of file hudtargetbox.cpp.

int Target_static_looping

Definition at line 58 of file hudtargetbox.cpp.

int Target_window_coords[GR_NUM_RESOLUTIONS][4]
Initial value:
8, 362, 131, 112
8, 629, 131, 112

Definition at line 44 of file hudtargetbox.cpp.

int Targetbox_flash_timers[NUM_TBOX_FLASH_TIMERS]

Definition at line 101 of file hudtargetbox.cpp.

int Targetbox_shader_effect = -1

Definition at line 104 of file hudtargetbox.cpp.

int Targetbox_wire = 0

Definition at line 103 of file hudtargetbox.cpp.

float View_zoom

Definition at line 30 of file 3dsetup.cpp.