UFO: Alien Invasion
Loading...
Searching...
No Matches
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"
Include dependency graph for cl_hud.cpp:

Go to the source code of this file.

Data Structures

struct  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.
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.
static int HUD_UsableReactionTUs (const le_t *le)
 Returns the amount of usable "reaction fire" TUs for this actor (depends on active/inactive RF).
static bool HUD_CheckFiremodeReservation (void)
 Check if at least one firemode is available for reservation.
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.
static void HUD_PopupFiremodeReservation (const le_t *le, bool popupReload)
 Creates a (text) list of all firemodes of the currently selected actor.
static void HUD_PopupFiremodeReservation_f (void)
 Creates a (text) list of all firemodes of the currently selected actor.
static void HUD_ShotReserve_f (void)
 Get selected firemode in the list of the currently selected actor.
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.
static void HUD_DisplayActions (const char *callback, const le_t *actor, actionType_t type)
 List actions from a soldier to a callback confunc.
static void HUD_DisplayActions_f (void)
 Displays the firemodes for the given hand.
static void HUD_DisplayFiremodes_f (void)
 Displays the firemodes for the given hand.
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.
static void HUD_SelectReactionFiremode_f (void)
 Checks if the selected firemode checkbox is ok as a reaction firemode and updates data+display.
static void HUD_RemainingTUs_f (void)
 Remember if we hover over a button that would cost some TUs when pressed.
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.
static bool HUD_DisplayImpossibleReaction (const le_t *actor)
 Display 'impossible' (red) reaction buttons.
static void HUD_DisplayPossibleReaction (const le_t *actor)
 Display 'usable' (blue) reaction buttons.
int HUD_ReactionFireGetTUs (const le_t *actor)
 Get the weapon firing TUs for reaction fire.
static void HUD_UpdateButtons (const le_t *le)
 Refreshes the weapon/reload buttons on the HUD.
static void HUD_DrawMouseCursorText (int xOffset, int yOffset, int textId)
 Draw the mouse cursor tooltips in battlescape.
void HUD_UpdateCursor (void)
 Updates the cursor texts when in battlescape.
static void HUD_MapDebugCursor (const le_t *le)
 Shows map pathfinding debugging parameters (if activated).
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.
static void HUD_UpdateActor (le_t *actor)
 Updates the hud for one actor.
void HUD_Update (void)
 Updates console vars for an actor.
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.
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.
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.
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.
static bool CL_CvarWorldLevel (cvar_t *cvar)
static bool HUD_CheckCLHud (cvar_t *cvar)
 Checks that the given cvar is a valid hud cvar.
void HUD_InitUI (const char *optionWindowName)
 Display the user interface.
static bool HUD_CvarCheckMNHud (cvar_t *cvar)
 Checks that the given cvar is a valid hud cvar.
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
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.

Enumeration Type Documentation

◆ anonymous enum

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.

◆ actionType_t

Enumerator
FIRE_RIGHT 
FIRE_LEFT 
RELOAD_RIGHT 
RELOAD_LEFT 

Definition at line 70 of file cl_hud.cpp.

◆ buttonTypes_t

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.

◆ reserveButtonState_t

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.

◆ weaponButtonState_t

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

◆ CASSERT() [1/2]

◆ CASSERT() [2/2]

◆ CL_CvarWorldLevel()

bool CL_CvarWorldLevel ( cvar_t * cvar)
static

Definition at line 1540 of file cl_hud.cpp.

References cl, Cvar_AssertValue(), and PATHFINDING_HEIGHT.

Referenced by HUD_InitStartup().

◆ HUD_ActorSelectionChangeListener()

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(), data, lengthof, and UI_ExecuteConfunc().

Referenced by HUD_InitStartup().

◆ HUD_ActorWoundData_f()

◆ HUD_CheckCLHud()

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_t::string, uiNode_t::super, and UI_GetWindow().

Referenced by HUD_CvarCheckMNHud(), and HUD_InitUI().

◆ HUD_CheckFiremodeReservation()

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_t::fd, foreachhand, HUD_GetFireDefinitionForHand(), i, objDef_t::numFiredefs, fireDef_t::obj, RES_SHOT, selActor, and fireDef_t::weapFdsIdx.

Referenced by HUD_UpdateButtons().

◆ HUD_CvarCheckMNHud()

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 cl_hud, Cvar_Reset(), and HUD_CheckCLHud().

Referenced by HUD_InitStartup().

◆ HUD_DisplayActions()

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

◆ HUD_DisplayActions_f()

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().

◆ HUD_DisplayFiremodeEntry()

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_t::ammo, CL_ActorGetChr(), CL_ActorTimeForFireDef(), CL_ActorUsableTUs(), Com_sprintf(), objDef_t::fd, fireDef_t::fdIdx, HUD_UsableReactionTUs(), index, MAX_VAR, fireDef_t::name, objDef_t::numFiredefs, fireDef_t::reaction, character_t::RFmode, THIS_FIREMODE, and UI_ExecuteConfunc().

Referenced by HUD_DisplayActions().

◆ HUD_DisplayFiremodes_f()

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(), Q_strncpyz(), selActor, and type.

Referenced by HUD_InitStartup().

◆ HUD_DisplayImpossibleReaction()

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, buttonStates, Com_Printf(), LE_IsSelected, le_t::state, STATE_REACTION, and UI_ExecuteConfunc().

Referenced by HUD_UpdateButtons().

◆ HUD_DisplayMessage()

◆ HUD_DisplayPossibleReaction()

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, buttonStates, LE_IsSelected, le_t::state, STATE_REACTION, and UI_ExecuteConfunc().

Referenced by HUD_UpdateButtons().

◆ HUD_DrawMouseCursorText()

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 cl_show_cursor_tooltips, mousePosX, mousePosY, UI_DrawTooltip(), UI_GetText(), and viddef.

Referenced by HUD_UpdateCursor().

◆ HUD_GetMinimumTUsForUsage()

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_t::time.

Referenced by HUD_UpdateButtons().

◆ HUD_GetPenaltyString()

const char * HUD_GetPenaltyString ( const int type)
static

◆ HUD_InitStartup()

◆ HUD_InitUI()

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 buttonStates, cl_hud, Cvar_Set(), HUD_CheckCLHud(), OBJZERO, UI_ExecuteConfunc(), and UI_InitStack().

Referenced by GAME_GetImportData(), GAME_StartBattlescape(), and cgame_import_t::void().

◆ HUD_LeftHandChangeListener()

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(), data, HUD_UpdateButtons(), Q_streq, and selActor.

Referenced by HUD_InitStartup().

◆ HUD_MapDebugCursor()

void HUD_MapDebugCursor ( const le_t * le)
static

Shows map pathfinding debugging parameters (if activated).

Parameters
[in]leThe current selected actors entity

Definition at line 1055 of file cl_hud.cpp.

References ACTOR_GET_FIELDSIZE, cl, cl_map_debug, Com_sprintf(), getDVdir, getDVz, Grid_Ceiling(), Grid_Floor(), Grid_MoveNext(), lengthof, MAPDEBUG_TEXT, mousePos, TEXT_MOUSECURSOR_BOTTOM, TEXT_MOUSECURSOR_LEFT, TEXT_MOUSECURSOR_TOP, truePos, UI_MAX_SMALLTEXTLEN, and UI_RegisterText().

Referenced by HUD_UpdateActor().

◆ HUD_PopupFiremodeReservation()

◆ HUD_PopupFiremodeReservation_f()

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().

◆ HUD_ReactionFireGetTUs()

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_t::getHandItem(), le_t::getLeftHandItem(), le_t::getRightHandItem(), Item::isWeapon(), MAX_FIREDEFS_PER_WEAPON, and character_t::RFmode.

Referenced by HUD_ToggleReaction_f(), and HUD_UpdateButtons().

◆ HUD_RemainingTUs_f()

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().

◆ HUD_RightHandChangeListener()

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(), data, HUD_UpdateButtons(), Q_streq, and selActor.

Referenced by HUD_InitStartup().

◆ HUD_SelectReactionFiremode_f()

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().

◆ HUD_SetShootReservation()

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(), fireModeIndex, RES_SHOT, character_t::reservedTus, FiremodeSettings::set(), and chrReservations_t::shotSettings.

Referenced by HUD_PopupFiremodeReservation_f(), and HUD_ShotReserve_f().

◆ HUD_SetWeaponButton()

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, buttonStates, shootTypeStrings, and UI_ExecuteConfunc().

Referenced by HUD_UpdateButtons().

◆ HUD_ShotReserve_f()

◆ HUD_TUChangeListener()

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(), data, HUD_UpdateButtons(), Q_streq, and selActor.

Referenced by HUD_InitStartup().

◆ HUD_Update()

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, cl_worldlevel, cls, Cvar_Set(), Cvar_SetValue(), HUD_UpdateActor(), i, PATHFINDING_HEIGHT, selActor, and UI_ExecuteConfunc().

Referenced by CL_SlowFrame().

◆ HUD_UpdateActor()

◆ HUD_UpdateActorCvar()

◆ HUD_UpdateActorFireMode()

◆ HUD_UpdateActorLoad_f()

◆ HUD_UpdateActorMove()

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_t::actorMoveLength, CL_ActorMoveMode(), CL_ActorReservedTUs(), CL_ActorUsableTUs(), Com_sprintf(), lengthof, le_t::morale, moveModeDescriptions, RES_ALL_ACTIVE, ROUTING_NOT_REACHABLE, TEXT_MOUSECURSOR_RIGHT, TEXT_STANDARD, le_t::TU, UI_MAX_SMALLTEXTLEN, UI_RegisterText(), and UI_ResetData().

Referenced by HUD_UpdateActor().

◆ HUD_UpdateActorStats()

◆ HUD_UpdateButtons()

◆ HUD_UpdateCursor()

◆ HUD_UpdateReactionFiremodes()

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_t::entnum, GAME_ItemIsUseable(), HUD_GetFireDefinitionForHand(), objDef_t::idx, MSG_Write_PA(), NONE, fireDef_t::obj, PA_REACT_SELECT, fireDef_t::weapFdsIdx, and objDef_t::weapons.

Referenced by HUD_SelectReactionFiremode_f().

◆ HUD_UsableReactionTUs()

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_t::state, and STATE_REACTION.

Referenced by HUD_DisplayFiremodeEntry().

◆ HUD_WeaponCanBeReloaded()

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_t::ammo, Item::ammoDef(), CL_ActorUsableTUs(), Item::def(), Item::getAmmoLeft(), Inventory::getContainer2(), HUD_CalcReloadTime(), le_t::inv, and objDef_t::isReloadable().

Referenced by HUD_UpdateButtons().

Variable Documentation

◆ buttonStates

◆ cl_hud

cvar_t* cl_hud
static

Definition at line 45 of file cl_hud.cpp.

Referenced by HUD_CvarCheckMNHud(), HUD_DisplayMessage(), HUD_InitStartup(), and HUD_InitUI().

◆ cl_hud_message_timeout

cvar_t* cl_hud_message_timeout
static

Definition at line 43 of file cl_hud.cpp.

Referenced by HUD_DisplayMessage(), and HUD_InitStartup().

◆ cl_show_cursor_tooltips

cvar_t* cl_show_cursor_tooltips
static

Definition at line 44 of file cl_hud.cpp.

Referenced by HUD_DrawMouseCursorText(), and HUD_InitStartup().

◆ cl_worldlevel

◆ crouchReserveButtonState

reserveButtonState_t crouchReserveButtonState
static

Definition at line 131 of file cl_hud.cpp.

Referenced by HUD_UpdateButtons().

◆ displayRemainingTus

bool displayRemainingTus[REMAINING_TU_MAX]
static

Definition at line 55 of file cl_hud.cpp.

Referenced by HUD_RemainingTUs_f(), and HUD_UpdateActor().

◆ moveModeDescriptions

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

Definition at line 102 of file cl_hud.cpp.

Referenced by CASSERT(), and HUD_UpdateActorMove().

◆ popupListData

◆ popupListNode

uiNode_t* popupListNode
static

◆ shootTypeStrings

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 CASSERT(), and HUD_SetWeaponButton().

◆ shotReserveButtonState

reserveButtonState_t shotReserveButtonState
static

Definition at line 130 of file cl_hud.cpp.

Referenced by HUD_UpdateButtons().