UFO: Alien Invasion
|
Go to the source code of this file.
Functions | |
Item * | HUD_GetLeftHandWeapon (const 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 nullptr if no two handed weapon is in the right hand and the left hand is empty. More... | |
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. More... | |
static bool | HUD_CheckShooting (const le_t *le, Item *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. More... | |
static void | HUD_FireWeapon_f (void) |
Starts aiming/target mode for selected left/right firemode. More... | |
static void | HUD_SetMoveMode_f (void) |
static void | HUD_ToggleCrouchReservation_f (void) |
Toggles if the current actor reserves TUs for crouching. More... | |
static void | HUD_ToggleReaction_f (void) |
Toggles reaction fire states for the current selected actor. More... | |
int | HUD_CalcReloadTime (const le_t *le, const objDef_t *weapon, containerIndex_t toContainer) |
Calculate total reload time for selected actor. More... | |
static bool | HUD_CheckReload (const le_t *le, const Item *weapon, containerIndex_t container) |
Check if reload is possible. More... | |
static void | HUD_ReloadLeft_f (void) |
Reload left weapon. More... | |
static void | HUD_ReloadRight_f (void) |
Reload right weapon. More... | |
static void | HUD_ExecuteAction_f (void) |
void | HUD_InitCallbacks (void) |
int HUD_CalcReloadTime | ( | const le_t * | le, |
const objDef_t * | weapon, | ||
containerIndex_t | toContainer | ||
) |
Calculate total reload time for selected actor.
[in] | le | Pointer to local entity handling the weapon. |
[in] | weapon | Item in (currently only right) hand. |
[in] | toContainer | The container index to get the ammo from (used to calculate the TUs that are needed to move the item out of this container) |
-1
if no suitable ammo found. Definition at line 217 of file cl_hud_callbacks.cpp.
References CL_ActorGetContainerForReload(), objDef_s::getReloadTime(), le_s::inv, INVDEF, and NONE.
Referenced by HUD_CheckReload(), HUD_DisplayActions(), HUD_UpdateActor(), and HUD_WeaponCanBeReloaded().
|
static |
Check if reload is possible.
[in] | le | Pointer to local entity for which we handle an action on hud menu. |
[in] | weapon | An item in hands. |
[in] | container | The container to get the ammo from |
Definition at line 244 of file cl_hud_callbacks.cpp.
References _, Item::def(), HUD_CalcReloadTime(), HUD_DisplayMessage(), Item::isReloadable(), and le_s::TU.
Referenced by HUD_ReloadLeft_f(), and HUD_ReloadRight_f().
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.
Definition at line 77 of file cl_hud_callbacks.cpp.
References _, Item::def(), objDef_s::fireTwoHanded, le_s::getLeftHandItem(), HUD_DisplayMessage(), and Item::mustReload().
Referenced by HUD_FireWeapon_f().
Ask the current selected soldier to execute an action
Definition at line 310 of file cl_hud_callbacks.cpp.
References Cmd_Argc(), Cmd_Argv(), Cmd_ExecuteString(), Com_Printf(), HUD_ReloadLeft_f(), HUD_ReloadRight_f(), index, Q_streq, Q_strstart(), and selActor.
Referenced by HUD_InitCallbacks().
Starts aiming/target mode for selected left/right firemode.
Definition at line 106 of file cl_hud_callbacks.cpp.
References _, ACTOR_GET_HAND_INDEX, ACTOR_HAND_RIGHT, CL_ActorSetMode(), CL_ActorTimeForFireDef(), CL_ActorUsableTUs(), Cmd_Argc(), Cmd_Argv(), Com_Printf(), le_s::currentSelectedFiremode, objDef_s::fd, le_s::getHandItem(), HUD_CheckShooting(), HUD_DisplayMessage(), HUD_GetFireDefinitionForHand(), M_FIRE_L, M_FIRE_R, MAX_FIREDEFS_PER_WEAPON, fireDef_s::obj, selActor, 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.
[in] | actor | The pointer to the actor we want to get the data from. |
[in] | hand | Which hand to use |
fireDef_t
Definition at line 57 of file cl_hud_callbacks.cpp.
References Item::def(), Item::getFiredefs(), and le_s::getHandItem().
Referenced by HUD_CheckFiremodeReservation(), HUD_DisplayActions(), HUD_FireWeapon_f(), HUD_PopupFiremodeReservation(), and HUD_UpdateReactionFiremodes().
Item* HUD_GetLeftHandWeapon | ( | const 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 nullptr
if no two handed weapon is in the right hand and the left hand is empty.
Definition at line 36 of file cl_hud_callbacks.cpp.
References CID_RIGHT, le_s::getLeftHandItem(), le_s::getRightHandItem(), and Item::isHeldTwoHanded().
Referenced by HUD_ReloadLeft_f(), HUD_UpdateActor(), HUD_UpdateActorCvar(), and HUD_UpdateActorFireMode().
Definition at line 342 of file cl_hud_callbacks.cpp.
References Cmd_AddCommand(), HUD_ExecuteAction_f(), HUD_FireWeapon_f(), HUD_ReloadLeft_f(), HUD_ReloadRight_f(), HUD_SetMoveMode_f(), HUD_ToggleCrouchReservation_f(), HUD_ToggleReaction_f(), and N_.
Referenced by HUD_InitStartup().
Reload left weapon.
Definition at line 279 of file cl_hud_callbacks.cpp.
References _, CID_LEFT, CL_ActorReload(), HUD_CheckReload(), HUD_DisplayMessage(), HUD_GetLeftHandWeapon(), and selActor.
Referenced by HUD_ExecuteAction_f(), and HUD_InitCallbacks().
Reload right weapon.
Definition at line 296 of file cl_hud_callbacks.cpp.
References _, CID_RIGHT, CL_ActorReload(), le_s::getRightHandItem(), HUD_CheckReload(), HUD_DisplayMessage(), and selActor.
Referenced by HUD_ExecuteAction_f(), and HUD_InitCallbacks().
Definition at line 147 of file cl_hud_callbacks.cpp.
References CL_ActorSetMode(), M_MOVE, and selActor.
Referenced by HUD_InitCallbacks().
Toggles if the current actor reserves TUs for crouching.
Definition at line 160 of file cl_hud_callbacks.cpp.
References _, CL_ActorCheckAction(), CL_ActorReservedTUs(), CL_ActorReserveTUs(), HUD_DisplayMessage(), RES_CROUCH, selActor, TU_CROUCH, and va().
Referenced by HUD_InitCallbacks().
Toggles reaction fire states for the current selected actor.
Definition at line 181 of file cl_hud_callbacks.cpp.
References _, CL_ActorCheckAction(), CL_ActorUsableTUs(), le_s::entnum, Inventory::holdsReactionFireWeapon(), HUD_DisplayMessage(), HUD_ReactionFireGetTUs(), le_s::inv, MSG_Write_PA(), PA_STATE, selActor, le_s::state, and STATE_REACTION.
Referenced by HUD_InitCallbacks().