UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cl_hud.cpp File Reference

HUD related routines. More...

#include "../client.h"
#include "cl_localentity.h"
#include "cl_actor.h"
#include "cl_hud.h"
#include "cl_hud_callbacks.h"
#include "cl_view.h"
#include "../cgame/cl_game.h"
#include "../ui/ui_main.h"
#include "../ui/ui_popup.h"
#include "../ui/ui_nodes.h"
#include "../ui/ui_draw.h"
#include "../ui/ui_render.h"
#include "../ui/ui_tooltip.h"
#include "../renderer/r_mesh_anim.h"
#include "../renderer/r_draw.h"
#include "../../common/grid.h"

Go to the source code of this file.

Data Structures

struct  reserveShot_s
 

Typedefs

typedef struct reserveShot_s reserveShot_t
 

Enumerations

enum  { REMAINING_TU_RELOAD_RIGHT, REMAINING_TU_RELOAD_LEFT, REMAINING_TU_CROUCH, REMAINING_TU_MAX }
 
enum  buttonTypes_t {
  BT_RIGHT_FIRE, BT_REACTION, BT_LEFT_FIRE, BT_RIGHT_RELOAD,
  BT_LEFT_RELOAD, BT_STAND, BT_CROUCH, BT_HEADGEAR,
  BT_NUM_TYPES
}
 
enum  actionType_t { FIRE_RIGHT, FIRE_LEFT, RELOAD_RIGHT, RELOAD_LEFT }
 
enum  weaponButtonState_t { BT_STATE_UNINITIALZED, BT_STATE_DISABLE, BT_STATE_DESELECT, BT_STATE_SELECT }
 Defines the various states of a button. More...
 
enum  reserveButtonState_t {
  BUTTON_TURESERVE_UNINITIALIZED, BUTTON_TURESERVE_SHOT_RESERVED, BUTTON_TURESERVE_SHOT_DISABLED, BUTTON_TURESERVE_SHOT_CLEAR,
  BUTTON_TURESERVE_CROUCH_RESERVED, BUTTON_TURESERVE_CROUCH_DISABLED, BUTTON_TURESERVE_CROUCH_CLEAR
}
 

Functions

 CASSERT (lengthof(shootTypeStrings)==BT_NUM_TYPES)
 
 CASSERT (lengthof(moveModeDescriptions)==WALKTYPE_MAX)
 
void HUD_DisplayMessage (const char *text)
 Displays a message on the hud. More...
 
void HUD_UpdateActorStats (const le_t *le)
 
static void HUD_SetWeaponButton (buttonTypes_t button, weaponButtonState_t state)
 Sets the display for a single weapon/reload HUD button. More...
 
static int HUD_UsableReactionTUs (const le_t *le)
 Returns the amount of usable "reaction fire" TUs for this actor (depends on active/inactive RF) More...
 
static bool HUD_CheckFiremodeReservation (void)
 Check if at least one firemode is available for reservation. More...
 
static void HUD_SetShootReservation (const le_t *le, const int tus, const actorHands_t hand, const int fireModeIndex, const objDef_t *weapon)
 Sets TU-reservation and firemode. More...
 
static void HUD_PopupFiremodeReservation (const le_t *le, bool popupReload)
 Creates a (text) list of all firemodes of the currently selected actor. More...
 
static void HUD_PopupFiremodeReservation_f (void)
 Creates a (text) list of all firemodes of the currently selected actor. More...
 
static void HUD_ShotReserve_f (void)
 Get selected firemode in the list of the currently selected actor. More...
 
static void HUD_DisplayFiremodeEntry (const char *callback, const le_t *actor, const objDef_t *ammo, const weaponFireDefIndex_t weapFdsIdx, const actorHands_t hand, const int index)
 Sets the display for a single weapon/reload HUD button. More...
 
static void HUD_DisplayActions (const char *callback, const le_t *actor, actionType_t type)
 List actions from a soldier to a callback confunc. More...
 
static void HUD_DisplayActions_f (void)
 Displays the firemodes for the given hand. More...
 
static void HUD_DisplayFiremodes_f (void)
 Displays the firemodes for the given hand. More...
 
static void HUD_UpdateReactionFiremodes (const le_t *actor, const actorHands_t hand, fireDefIndex_t firemodeActive)
 Updates the information in RFmode for the selected actor with the given data from the parameters. More...
 
static void HUD_SelectReactionFiremode_f (void)
 Checks if the selected firemode checkbox is ok as a reaction firemode and updates data+display. More...
 
static void HUD_RemainingTUs_f (void)
 Remember if we hover over a button that would cost some TUs when pressed. More...
 
static int HUD_GetMinimumTUsForUsage (const Item *item)
 
static int HUD_WeaponCanBeReloaded (const le_t *le, containerIndex_t containerID, const char **reason)
 Checks every case for reload buttons on the HUD. More...
 
static bool HUD_DisplayImpossibleReaction (const le_t *actor)
 Display 'impossible' (red) reaction buttons. More...
 
static void HUD_DisplayPossibleReaction (const le_t *actor)
 Display 'usable' (blue) reaction buttons. More...
 
int HUD_ReactionFireGetTUs (const le_t *actor)
 Get the weapon firing TUs for reaction fire. More...
 
static void HUD_UpdateButtons (const le_t *le)
 Refreshes the weapon/reload buttons on the HUD. More...
 
static void HUD_DrawMouseCursorText (int xOffset, int yOffset, int textId)
 Draw the mouse cursor tooltips in battlescape. More...
 
void HUD_UpdateCursor (void)
 Updates the cursor texts when in battlescape. More...
 
static void HUD_MapDebugCursor (const le_t *le)
 Shows map pathfinding debugging parameters (if activated) More...
 
static int HUD_UpdateActorFireMode (le_t *actor)
 
static int HUD_UpdateActorMove (const le_t *actor)
 
static void HUD_UpdateActorCvar (const le_t *actor)
 
static const char * HUD_GetPenaltyString (const int type)
 
static void HUD_ActorWoundData_f (void)
 
static void HUD_UpdateActorLoad_f (void)
 Update the equipment weight for the selected actor. More...
 
static void HUD_UpdateActor (le_t *actor)
 Updates the hud for one actor. More...
 
void HUD_Update (void)
 Updates console vars for an actor. More...
 
static void HUD_ActorSelectionChangeListener (const char *cvarName, const char *oldValue, const char *newValue, void *data)
 Callback that is called when the cl_selected cvar was changed. More...
 
static void HUD_RightHandChangeListener (const char *cvarName, const char *oldValue, const char *newValue, void *data)
 Callback that is called when the right hand weapon of the current selected actor changed. More...
 
static void HUD_LeftHandChangeListener (const char *cvarName, const char *oldValue, const char *newValue, void *data)
 Callback that is called when the left hand weapon of the current selected actor changed. More...
 
static void HUD_TUChangeListener (const char *cvarName, const char *oldValue, const char *newValue, void *data)
 Callback that is called when the remaining TUs for the current selected actor changed. More...
 
static bool CL_CvarWorldLevel (cvar_t *cvar)
 
static bool HUD_CheckCLHud (cvar_t *cvar)
 Checks that the given cvar is a valid hud cvar. More...
 
void HUD_InitUI (const char *optionWindowName)
 Display the user interface. More...
 
static bool HUD_CvarCheckMNHud (cvar_t *cvar)
 Checks that the given cvar is a valid hud cvar. More...
 
void HUD_InitStartup (void)
 

Variables

static cvar_tcl_hud_message_timeout
 
static cvar_tcl_show_cursor_tooltips
 
static cvar_tcl_hud
 
cvar_tcl_worldlevel
 
static bool displayRemainingTus [REMAINING_TU_MAX]
 
static char const *const shootTypeStrings []
 a cbuf string for each button_types_t More...
 
static char const *const moveModeDescriptions []
 
static weaponButtonState_t buttonStates [BT_NUM_TYPES]
 
static reserveButtonState_t shotReserveButtonState
 
static reserveButtonState_t crouchReserveButtonState
 
static linkedList_tpopupListData
 
static uiNode_tpopupListNode
 

Detailed Description

HUD related routines.

Definition in file cl_hud.cpp.

Typedef Documentation

typedef struct reserveShot_s reserveShot_t

Enumeration Type Documentation

anonymous enum
Enumerator
REMAINING_TU_RELOAD_RIGHT 
REMAINING_TU_RELOAD_LEFT 
REMAINING_TU_CROUCH 
REMAINING_TU_MAX 

Definition at line 48 of file cl_hud.cpp.

Enumerator
FIRE_RIGHT 
FIRE_LEFT 
RELOAD_RIGHT 
RELOAD_LEFT 

Definition at line 70 of file cl_hud.cpp.

Enumerator
BT_RIGHT_FIRE 
BT_REACTION 
BT_LEFT_FIRE 
BT_RIGHT_RELOAD 
BT_LEFT_RELOAD 
BT_STAND 
BT_CROUCH 
BT_HEADGEAR 
BT_NUM_TYPES 

Definition at line 57 of file cl_hud.cpp.

Enumerator
BUTTON_TURESERVE_UNINITIALIZED 
BUTTON_TURESERVE_SHOT_RESERVED 
BUTTON_TURESERVE_SHOT_DISABLED 
BUTTON_TURESERVE_SHOT_CLEAR 
BUTTON_TURESERVE_CROUCH_RESERVED 
BUTTON_TURESERVE_CROUCH_DISABLED 
BUTTON_TURESERVE_CROUCH_CLEAR 

Definition at line 117 of file cl_hud.cpp.

Defines the various states of a button.

Note
Not all buttons do have all of these states (e.g. "unusable" is not very common).
Enumerator
BT_STATE_UNINITIALZED 
BT_STATE_DISABLE 

'Disabled' display (grey)

BT_STATE_DESELECT 

Normal display (blue)

BT_STATE_SELECT 

Selected display (blue)

Definition at line 94 of file cl_hud.cpp.

Function Documentation

static bool CL_CvarWorldLevel ( cvar_t cvar)
static

Definition at line 1540 of file cl_hud.cpp.

References cl, Cvar_AssertValue(), clientBattleScape_s::mapMaxLevel, and PATHFINDING_HEIGHT.

Referenced by HUD_InitStartup().

static void HUD_ActorSelectionChangeListener ( const char *  cvarName,
const char *  oldValue,
const char *  newValue,
void data 
)
static

Callback that is called when the cl_selected cvar was changed.

Parameters
cvarNameThe cvar name (cl_selected)
oldValueThe old value of the cvar (a sane actor idx)
newValueThe new value of the cvar (a sane actor idx)
dataUnused here, but required by cvarChangeListenerFunc_t

Definition at line 1473 of file cl_hud.cpp.

References cl, CL_OnBattlescape(), lengthof, clientBattleScape_s::teamList, and UI_ExecuteConfunc().

Referenced by HUD_InitStartup().

static bool HUD_CheckCLHud ( cvar_t cvar)
static

Checks that the given cvar is a valid hud cvar.

Parameters
cvarThe cvar to check
Returns
true if cvar is valid, false otherwise
Todo:
check for multiple base classes

Definition at line 1551 of file cl_hud.cpp.

References uiNode_t::name, Q_streq, cvar_s::string, uiNode_t::super, and UI_GetWindow().

Referenced by HUD_CvarCheckMNHud(), and HUD_InitUI().

static bool HUD_CheckFiremodeReservation ( void  )
static

Check if at least one firemode is available for reservation.

Returns
true if there is at least one firemode - false otherwise.
See also
HUD_UpdateButtons
HUD_PopupFiremodeReservation_f

Definition at line 216 of file cl_hud.cpp.

References CL_ActorReservedTUs(), CL_ActorTimeForFireDef(), CL_ActorUsableTUs(), objDef_s::fd, foreachhand, HUD_GetFireDefinitionForHand(), i, objDef_s::numFiredefs, fireDef_s::obj, RES_SHOT, selActor, and fireDef_s::weapFdsIdx.

Referenced by HUD_UpdateButtons().

static bool HUD_CvarCheckMNHud ( cvar_t cvar)
static

Checks that the given cvar is a valid hud cvar.

Parameters
cvarThe cvar to check and to modify if the value is invalid
Returns
true if the valid is invalid, false otherwise

Definition at line 1588 of file cl_hud.cpp.

References Cvar_Reset(), and HUD_CheckCLHud().

Referenced by HUD_InitStartup().

static void HUD_DisplayActions ( const char *  callback,
const le_t actor,
actionType_t  type 
)
static
static void HUD_DisplayActions_f ( void  )
static

Displays the firemodes for the given hand.

Todo:
we can extend it with short cut equip action, more reload, action on the map (like open doors)...

Definition at line 533 of file cl_hud.cpp.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), FIRE_LEFT, FIRE_RIGHT, HUD_DisplayActions(), Q_strncpyz(), RELOAD_LEFT, RELOAD_RIGHT, selActor, and type.

Referenced by HUD_InitStartup().

static void HUD_DisplayFiremodeEntry ( const char *  callback,
const le_t actor,
const objDef_t ammo,
const weaponFireDefIndex_t  weapFdsIdx,
const actorHands_t  hand,
const int  index 
)
static

Sets the display for a single weapon/reload HUD button.

Parameters
callbackconfunc callback
actorThe actor local entity
ammoThe ammo used by this firemode
weapFdsIdxthe weapon index in the fire definition array
handWhat list to display
indexIndex of the actual firemode

Definition at line 398 of file cl_hud.cpp.

References _, ACTOR_GET_HAND_CHAR, ACTOR_HAND_LEFT, ACTOR_HAND_RIGHT, fireDef_s::ammo, CL_ActorGetChr(), CL_ActorTimeForFireDef(), CL_ActorUsableTUs(), Com_sprintf(), objDef_s::fd, fireDef_s::fdIdx, HUD_UsableReactionTUs(), index, MAX_VAR, fireDef_s::name, objDef_s::numFiredefs, fireDef_s::reaction, character_s::RFmode, THIS_FIREMODE, and UI_ExecuteConfunc().

Referenced by HUD_DisplayActions().

static void HUD_DisplayFiremodes_f ( void  )
static

Displays the firemodes for the given hand.

Definition at line 564 of file cl_hud.cpp.

References ACTOR_GET_HAND_INDEX, ACTOR_HAND_RIGHT, Cmd_Argc(), Cmd_Argv(), Com_Printf(), FIRE_LEFT, FIRE_RIGHT, HUD_DisplayActions(), le_s::isMoving(), Q_strncpyz(), selActor, and type.

Referenced by HUD_InitStartup().

static bool HUD_DisplayImpossibleReaction ( const le_t actor)
static

Display 'impossible' (red) reaction buttons.

Parameters
[in]actorthe actor to check for his reaction state.
Returns
true if nothing changed message was sent otherwise false.
Note
this is called when reaction is enabled with no suitable weapon.
Todo:
at the moment of writing, this should be impossible: reaction should be disabled whenever the actor loses its reaction weapon.

Definition at line 724 of file cl_hud.cpp.

References BT_REACTION, BT_STATE_UNINITIALZED, Com_Printf(), LE_IsSelected, le_s::state, STATE_REACTION, and UI_ExecuteConfunc().

Referenced by HUD_UpdateButtons().

static void HUD_DisplayPossibleReaction ( const le_t actor)
static

Display 'usable' (blue) reaction buttons.

Parameters
[in]actorthe actor to check for his reaction state.

Definition at line 751 of file cl_hud.cpp.

References BT_REACTION, BT_STATE_SELECT, LE_IsSelected, le_s::state, STATE_REACTION, and UI_ExecuteConfunc().

Referenced by HUD_UpdateButtons().

static void HUD_DrawMouseCursorText ( int  xOffset,
int  yOffset,
int  textId 
)
static

Draw the mouse cursor tooltips in battlescape.

Parameters
xOffset
yOffset
textIdThe text id to get the tooltip string from.

Definition at line 966 of file cl_hud.cpp.

References cvar_s::integer, mousePosX, mousePosY, UI_DrawTooltip(), UI_GetText(), viddef, and viddef_t::virtualWidth.

Referenced by HUD_UpdateCursor().

static int HUD_GetMinimumTUsForUsage ( const Item item)
static
Returns
The minimum time needed to fire the weapon

Definition at line 658 of file cl_hud.cpp.

References Item::def(), Item::getFastestFireDef(), and fireDef_s::time.

Referenced by HUD_UpdateButtons().

static const char* HUD_GetPenaltyString ( const int  type)
static
void HUD_InitUI ( const char *  optionWindowName)

Display the user interface.

Parameters
optionWindowNameName of the window used to display options, else nullptr if nothing

Definition at line 1572 of file cl_hud.cpp.

References Cvar_Set(), HUD_CheckCLHud(), OBJZERO, cvar_s::string, UI_ExecuteConfunc(), and UI_InitStack().

Referenced by GAME_GetImportData(), and GAME_StartBattlescape().

static void HUD_LeftHandChangeListener ( const char *  cvarName,
const char *  oldValue,
const char *  newValue,
void data 
)
static

Callback that is called when the left hand weapon of the current selected actor changed.

Parameters
cvarNameThe cvar name
oldValueThe old value of the cvar
newValueThe new value of the cvar
dataUnused here, but required by cvarChangeListenerFunc_t

Definition at line 1511 of file cl_hud.cpp.

References CL_OnBattlescape(), HUD_UpdateButtons(), Q_streq, and selActor.

Referenced by HUD_InitStartup().

static void HUD_MapDebugCursor ( const le_t le)
static
static void HUD_PopupFiremodeReservation_f ( void  )
static

Creates a (text) list of all firemodes of the currently selected actor.

See also
HUD_PopupFiremodeReservation

Definition at line 335 of file cl_hud.cpp.

References ACTOR_HAND_NOT_SET, Cmd_Argc(), HUD_PopupFiremodeReservation(), HUD_SetShootReservation(), and selActor.

Referenced by HUD_InitStartup().

int HUD_ReactionFireGetTUs ( const le_t actor)

Get the weapon firing TUs for reaction fire.

Parameters
[in]actorthe actor to check for his reaction TUs.
Returns
The TUs needed for the reaction fireDef for this actor or -1 if no valid reaction settings

Definition at line 774 of file cl_hud.cpp.

References Item::ammoDef(), CL_ActorGetChr(), CL_ActorTimeForFireDef(), Item::getFiredefs(), FiremodeSettings::getFmIdx(), FiremodeSettings::getHand(), le_s::getHandItem(), le_s::getLeftHandItem(), le_s::getRightHandItem(), Item::isWeapon(), MAX_FIREDEFS_PER_WEAPON, and character_s::RFmode.

Referenced by HUD_ToggleReaction_f(), and HUD_UpdateButtons().

static void HUD_RemainingTUs_f ( void  )
static

Remember if we hover over a button that would cost some TUs when pressed.

Note
this is used in HUD_Update to update the "remaining TUs" bar correctly.

Definition at line 634 of file cl_hud.cpp.

References Cmd_Argc(), Cmd_Argv(), Com_ParseBoolean(), Com_Printf(), displayRemainingTus, OBJZERO, Q_streq, REMAINING_TU_CROUCH, REMAINING_TU_RELOAD_LEFT, REMAINING_TU_RELOAD_RIGHT, and type.

Referenced by HUD_InitStartup().

static void HUD_RightHandChangeListener ( const char *  cvarName,
const char *  oldValue,
const char *  newValue,
void data 
)
static

Callback that is called when the right hand weapon of the current selected actor changed.

Parameters
cvarNameThe cvar name
oldValueThe old value of the cvar
newValueThe new value of the cvar
dataUnused here, but required by cvarChangeListenerFunc_t

Definition at line 1493 of file cl_hud.cpp.

References CL_OnBattlescape(), HUD_UpdateButtons(), Q_streq, and selActor.

Referenced by HUD_InitStartup().

static void HUD_SelectReactionFiremode_f ( void  )
static

Checks if the selected firemode checkbox is ok as a reaction firemode and updates data+display.

Definition at line 610 of file cl_hud.cpp.

References ACTOR_GET_HAND_INDEX, Cmd_Argc(), Cmd_Argv(), Com_Printf(), HUD_UpdateReactionFiremodes(), MAX_FIREDEFS_PER_WEAPON, and selActor.

Referenced by HUD_InitStartup().

static void HUD_SetShootReservation ( const le_t le,
const int  tus,
const actorHands_t  hand,
const int  fireModeIndex,
const objDef_t weapon 
)
static

Sets TU-reservation and firemode.

Parameters
[in]leThe local entity of the actor to change the tu reservation for.
[in]tusHow many TUs to set.
[in]handStore the given hand.
[in]fireModeIndexStore the given firemode for this hand.
[in]weaponPointer to weapon in the hand.

Definition at line 249 of file cl_hud.cpp.

References CL_ActorGetChr(), CL_ActorReserveTUs(), RES_SHOT, character_s::reservedTus, FiremodeSettings::set(), and chrReservations_s::shotSettings.

Referenced by HUD_PopupFiremodeReservation_f(), and HUD_ShotReserve_f().

static void HUD_SetWeaponButton ( buttonTypes_t  button,
weaponButtonState_t  state 
)
static

Sets the display for a single weapon/reload HUD button.

Todo:
This should be a confunc which also sets the tooltips

Definition at line 168 of file cl_hud.cpp.

References BT_STATE_DESELECT, BT_STATE_DISABLE, shootTypeStrings, and UI_ExecuteConfunc().

Referenced by HUD_UpdateButtons().

static void HUD_TUChangeListener ( const char *  cvarName,
const char *  oldValue,
const char *  newValue,
void data 
)
static

Callback that is called when the remaining TUs for the current selected actor changed.

Parameters
cvarNameThe cvar name
oldValueThe old value of the cvar
newValueThe new value of the cvar
dataUnused here, but required by cvarChangeListenerFunc_t

Definition at line 1529 of file cl_hud.cpp.

References CL_OnBattlescape(), HUD_UpdateButtons(), Q_streq, and selActor.

Referenced by HUD_InitStartup().

void HUD_Update ( void  )

Updates console vars for an actor.

This function updates the cvars for the hud (battlefield) unlike CL_ActorCvars and CL_UGVCvars which updates them for displaying the data in the menu system

See also
CL_ActorCvars
CL_UGVCvars

Definition at line 1428 of file cl_hud.cpp.

References ca_active, cl, cls, Cvar_Set(), Cvar_SetValue(), HUD_UpdateActor(), i, cvar_s::integer, clientBattleScape_s::mapMaxLevel, cvar_s::modified, clientBattleScape_s::numTeamList, PATHFINDING_HEIGHT, selActor, client_static_s::state, and UI_ExecuteConfunc().

Referenced by CL_SlowFrame().

static int HUD_UpdateActorMove ( const le_t actor)
static
Parameters
[in]actorThe actor to update the hud for
Returns
The amount of TUs needed for the current pending action

Definition at line 1171 of file cl_hud.cpp.

References _, le_s::actorMoveLength, CL_ActorMoveMode(), CL_ActorReservedTUs(), CL_ActorUsableTUs(), Com_sprintf(), lengthof, le_s::morale, RES_ALL_ACTIVE, ROUTING_NOT_REACHABLE, TEXT_MOUSECURSOR_RIGHT, TEXT_STANDARD, le_s::TU, UI_MAX_SMALLTEXTLEN, UI_RegisterText(), and UI_ResetData().

Referenced by HUD_UpdateActor().

static void HUD_UpdateReactionFiremodes ( const le_t actor,
const actorHands_t  hand,
fireDefIndex_t  firemodeActive 
)
static

Updates the information in RFmode for the selected actor with the given data from the parameters.

Parameters
[in]actorThe actor we want to update the reaction-fire firemode for.
[in]handWhich weapon(-hand) to use.
[in]firemodeActiveSet this to the firemode index you want to activate or set it to -1 if the default one (currently the first one found) should be used.

Definition at line 590 of file cl_hud.cpp.

References le_s::entnum, GAME_ItemIsUseable(), HUD_GetFireDefinitionForHand(), objDef_s::idx, MSG_Write_PA(), NONE, fireDef_s::obj, PA_REACT_SELECT, fireDef_s::weapFdsIdx, and objDef_s::weapons.

Referenced by HUD_SelectReactionFiremode_f().

static int HUD_UsableReactionTUs ( const le_t le)
static

Returns the amount of usable "reaction fire" TUs for this actor (depends on active/inactive RF)

Parameters
[in]leThe actor to check.
Returns
The remaining/usable TUs for this actor
-1 on error (this includes bad [very large] numbers stored in the struct).
Todo:
Maybe only return "reaction" value if reaction-state is active? The value should be 0, but one never knows :)

Definition at line 199 of file cl_hud.cpp.

References CL_ActorReservedTUs(), CL_ActorUsableTUs(), RES_REACTION, le_s::state, and STATE_REACTION.

Referenced by HUD_DisplayFiremodeEntry().

static int HUD_WeaponCanBeReloaded ( const le_t le,
containerIndex_t  containerID,
const char **  reason 
)
static

Checks every case for reload buttons on the HUD.

Parameters
[in]lePointer of local entity being an actor.
[in]containerIDof the container to reload the weapon in. Used to get the movement TUs for moving something into the container.
[out]reasonThe reason why the reload didn't work - only set if -1 is the return value
Returns
TU units needed for reloading or -1 if weapon cannot be reloaded.

Definition at line 674 of file cl_hud.cpp.

References _, objDef_s::ammo, Item::ammoDef(), CL_ActorUsableTUs(), Item::def(), Item::getAmmoLeft(), Inventory::getContainer2(), HUD_CalcReloadTime(), le_s::inv, and objDef_s::isReloadable().

Referenced by HUD_UpdateButtons().

Variable Documentation

weaponButtonState_t buttonStates[BT_NUM_TYPES]
static

Definition at line 129 of file cl_hud.cpp.

cvar_t* cl_hud
static

Definition at line 45 of file cl_hud.cpp.

cvar_t* cl_hud_message_timeout
static

Definition at line 43 of file cl_hud.cpp.

cvar_t* cl_show_cursor_tooltips
static

Definition at line 44 of file cl_hud.cpp.

reserveButtonState_t crouchReserveButtonState
static

Definition at line 131 of file cl_hud.cpp.

bool displayRemainingTus[REMAINING_TU_MAX]
static

Definition at line 55 of file cl_hud.cpp.

Referenced by HUD_RemainingTUs_f(), and HUD_UpdateActor().

char const* const moveModeDescriptions[]
static
Initial value:
= {
N_("Crouch walk"),
N_("Autostand"),
N_("Walk"),
}
#define N_(String)
Definition: cl_shared.h:45
Note
Order of elements here must correspond to order of elements in walkType_t.

Definition at line 102 of file cl_hud.cpp.

linkedList_t* popupListData
static

Definition at line 258 of file cl_hud.cpp.

uiNode_t* popupListNode
static

Definition at line 259 of file cl_hud.cpp.

char const* const shootTypeStrings[]
static
Initial value:
= {
"primaryright",
"reaction",
"primaryleft",
"reloadright",
"reloadleft",
"stand",
"crouch",
"headgear"
}

a cbuf string for each button_types_t

Definition at line 78 of file cl_hud.cpp.

Referenced by HUD_SetWeaponButton().

reserveButtonState_t shotReserveButtonState
static

Definition at line 130 of file cl_hud.cpp.