cl_hud_callbacks.c File Reference

#include "../client.h"
#include "cl_hud_callbacks.h"
#include "cl_hud.h"
#include "cl_actor.h"
Include dependency graph for cl_hud_callbacks.c:

Go to the source code of this file.

Functions

invList_tHUD_GetLeftHandWeapon (le_t *actor, containerIndex_t *container)
 returns the weapon the actor's left hand is touching. In case the actor holds a two handed weapon in his right hand, this weapon is returned here. This function only returns NULL if no two handed weapon is in the right hand and the left hand is empty.
const fireDef_tHUD_GetFireDefinitionForHand (const le_t *actor, const actorHands_t hand)
 Returns the fire definition of the item the actor has in the given hand.
static qboolean HUD_CheckShooting (const le_t *le, invList_t *weapon)
 Check if shooting is possible. i.e. The weapon has ammo and can be fired with the 'available' hands. TUs (i.e. "time") are are _not_ checked here, this needs to be done elsewhere for the correct firemode.
static void HUD_FireWeapon_f (void)
 Starts aiming/target mode for selected left/right firemode.
static void HUD_ToggleCrouchReservation_f (void)
 Toggles if the current actor reserves Tus for crouching.
static void HUD_ToggleReaction_f (void)
 Toggles reaction fire states for the current selected actor.
int HUD_CalcReloadTime (const le_t *le, const objDef_t *weapon, containerIndex_t toContainer)
 Calculate total reload time for selected actor.
static qboolean HUD_CheckReload (const le_t *le, const invList_t *weapon, containerIndex_t container)
 Check if reload is possible.
static void HUD_ReloadLeft_f (void)
 Reload left weapon.
static void HUD_ReloadRight_f (void)
 Reload right weapon.
void HUD_InitCallbacks (void)

Detailed Description

Definition in file cl_hud_callbacks.c.


Function Documentation

int HUD_CalcReloadTime ( const le_t le,
const objDef_t weapon,
containerIndex_t  toContainer 
)

Calculate total reload time for selected actor.

Parameters:
[in] le Pointer to local entity handling the weapon.
[in] weapon Item in (currently only right) hand.
Returns:
Time needed to reload or -1 if no suitable ammo found.
Note:
This routine assumes the time to reload a weapon
in the right hand is the same as the left hand.
See also:
HUD_RefreshButtons
HUD_CheckReload

Definition at line 203 of file cl_hud_callbacks.c.

References CL_ActorGetContainerForReload(), le_s::i, NONE, and TU_GET_RELOAD.

Referenced by HUD_CheckReload(), HUD_UpdateActor(), and HUD_WeaponCanBeReloaded().

static qboolean HUD_CheckReload ( const le_t le,
const invList_t weapon,
containerIndex_t  container 
) [static]

Check if reload is possible.

Parameters:
[in] le Pointer to local entity for which we handle an action on hud menu.
[in] weapon An item in hands.
Returns:
qfalse when action is not possible, otherwise qtrue
See also:
HUD_ReloadLeft_f
HUD_ReloadRight_f

Definition at line 231 of file cl_hud_callbacks.c.

References _, HUD_CalcReloadTime(), HUD_DisplayMessage(), invList_s::item, qfalse, qtrue, objDef_s::reload, item_s::t, and le_s::TU.

Referenced by HUD_ReloadLeft_f(), and HUD_ReloadRight_f().

static qboolean HUD_CheckShooting ( const le_t le,
invList_t weapon 
) [static]

Check if shooting is possible. i.e. The weapon has ammo and can be fired with the 'available' hands. TUs (i.e. "time") are are _not_ checked here, this needs to be done elsewhere for the correct firemode.

See also:
HUD_FireWeapon_f
Returns:
qfalse when action is not possible, otherwise qtrue

Definition at line 79 of file cl_hud_callbacks.c.

References _, item_s::a, objDef_s::fireTwoHanded, HUD_DisplayMessage(), invList_s::item, LEFT, qfalse, qtrue, objDef_s::reload, and item_s::t.

Referenced by HUD_FireWeapon_f().

static void HUD_FireWeapon_f ( void   )  [static]

Starts aiming/target mode for selected left/right firemode.

Note:
Previously know as a combination of CL_FireRightPrimary, CL_FireRightSecondary,
CL_FireLeftPrimary and CL_FireLeftSecondary.

Definition at line 109 of file cl_hud_callbacks.c.

References _, ACTOR_GET_HAND_INDEX, ACTOR_GET_INV, ACTOR_HAND_RIGHT, CL_ActorSetMode(), CL_ActorUsableTUs(), Cmd_Argc(), Cmd_Argv(), Com_Printf(), le_s::currentSelectedFiremode, objDef_s::fd, HUD_CheckShooting(), HUD_DisplayMessage(), HUD_GetFireDefinitionForHand(), HUD_HideFiremodes(), M_FIRE_L, M_FIRE_R, MAX_FIREDEFS_PER_WEAPON, fireDef_s::obj, selActor, fireDef_s::time, and fireDef_s::weapFdsIdx.

Referenced by HUD_InitCallbacks().

const fireDef_t* HUD_GetFireDefinitionForHand ( const le_t actor,
const actorHands_t  hand 
)

Returns the fire definition of the item the actor has in the given hand.

Parameters:
[in] actor The pointer to the actor we want to get the data from.
[in] hand Which hand to use
Returns:
the used fireDef_t

Definition at line 57 of file cl_hud_callbacks.c.

References ACTOR_GET_INV, FIRESH_FiredefForWeapon(), invList_s::item, and item_s::t.

Referenced by HUD_CheckFiremodeReservation(), HUD_DisplayFiremodes(), HUD_FireWeapon_f(), HUD_PopupFiremodeReservation(), and HUD_UpdateReactionFiremodes().

invList_t* HUD_GetLeftHandWeapon ( le_t actor,
containerIndex_t container 
)

returns the weapon the actor's left hand is touching. In case the actor holds a two handed weapon in his right hand, this weapon is returned here. This function only returns NULL if no two handed weapon is in the right hand and the left hand is empty.

Todo:
remove me

Definition at line 36 of file cl_hud_callbacks.c.

References csi, objDef_s::holdTwoHanded, csi_s::idRight, invList_s::item, LEFT, RIGHT, and item_s::t.

Referenced by HUD_ReloadLeft_f(), HUD_UpdateActor(), HUD_UpdateActorCvar(), and HUD_UpdateActorFireMode().

void HUD_InitCallbacks ( void   ) 
static void HUD_ReloadLeft_f ( void   )  [static]

Reload left weapon.

Definition at line 268 of file cl_hud_callbacks.c.

References CL_ActorReload(), csi, HUD_CheckReload(), HUD_GetLeftHandWeapon(), csi_s::idLeft, and selActor.

Referenced by HUD_InitCallbacks().

static void HUD_ReloadRight_f ( void   )  [static]

Reload right weapon.

Definition at line 279 of file cl_hud_callbacks.c.

References CL_ActorReload(), csi, HUD_CheckReload(), csi_s::idRight, RIGHT, and selActor.

Referenced by HUD_InitCallbacks().

static void HUD_ToggleCrouchReservation_f ( void   )  [static]

Toggles if the current actor reserves Tus for crouching.

Definition at line 158 of file cl_hud_callbacks.c.

References CL_ActorCheckAction(), CL_ActorReservedTUs(), CL_ActorReserveTUs(), RES_CROUCH, selActor, and TU_CROUCH.

Referenced by HUD_InitCallbacks().

static void HUD_ToggleReaction_f ( void   )  [static]

Toggles reaction fire states for the current selected actor.

Definition at line 175 of file cl_hud_callbacks.c.

References CL_ActorCheckAction(), le_s::entnum, MSG_Write_PA(), PA_STATE, selActor, le_s::state, STATE_REACTION, STATE_REACTION_MANY, and STATE_REACTION_ONCE.

Referenced by HUD_InitCallbacks().


Generated by  doxygen 1.6.2