110typedef struct reserveShot_s {
155 const char* tooltip =
va(
_(
"%s\nHP: %i/%i TU: %i\n%s"),
160 UI_ExecuteConfunc(
"updateactorvalues %i \"%s\" \"%i\" \"%i\" \"%i\" \"%i\" \"%i\" \"%i\" \"%i\" \"%i\" \"%i\" \"%s\"",
161 idx, le->
model2->
name, le->
headSkin, le->
HP, le->
maxHP, le->
TU, le->
maxTU, le->
morale, le->
maxMorale, le->
STUN, reservedTUs, tooltip);
177 prefix =
"deselect_";
282 int selectedEntry = 0;
305 reserveShotData.
hand = hand;
308 reserveShotData.
TUs = time;
323 popupListNode =
UI_PopupList(
_(
"Shot Reservation"),
_(
"Reserve TUs for firing/using."), popupListText,
"hud_shotreserve <lineselected>");
364 const int selectedPopupIndex = atoi(
Cmd_Argv(1));
369 if (!reserveShotData)
413 if (usableTusForRF > time) {
414 Com_sprintf(tuString,
sizeof(tuString),
_(
"Remaining TUs: %i"), usableTusForRF - time);
417 tooltip =
_(
"No remaining TUs left after shot.");
448 if (!
cls.isOurRound()) {
482 const char* actionId =
"reload_handr";
484 const bool noAmmo = tus == -1;
485 const bool noTU = actor->
TU < tus;
486 UI_ExecuteConfunc(
"%s reload %s %c %i %i %i", callback, actionId,
'r', tus, !noAmmo, !noTU);
518 const char* actionId =
"reload_handl";
520 const bool noAmmo = tus == -1;
521 const bool noTU = actor->
TU < tus;
522 UI_ExecuteConfunc(
"%s reload %s %c %i %i %i", callback, actionId,
'l', tus, !noAmmo, !noTU);
544 if (strchr(
Cmd_Argv(2),
'r') !=
nullptr) {
546 }
else if (strchr(
Cmd_Argv(2),
'l') !=
nullptr) {
548 }
else if (strchr(
Cmd_Argv(2),
'R') !=
nullptr) {
550 }
else if (strchr(
Cmd_Argv(2),
'L') !=
nullptr) {
622 Com_Printf(
"HUD_SelectReactionFiremode_f: Firemode out of bounds (%i).\n", firemode);
664 return fd ? fd->
time : 900;
680 *reason =
_(
"No weapon.");
689 *reason =
_(
"Weapon cannot be reloaded.");
695 *reason =
_(
"No reload possible, already fully loaded.");
706 *reason =
_(
"Not enough TUs for reloading weapon.");
709 *reason =
_(
"No reload possible, you don't have backup ammo.");
738 Com_Printf(
"HUD_DisplayImpossibleReaction: Warning! Reaction fire enabled but no suitable weapon found!\n");
789 if (fdArray ==
nullptr)
815 Cvar_Set(
"mn_crouchstand_tt",
_(
"Not enough TUs for standing up."));
824 Cvar_Set(
"mn_crouchstand_tt",
_(
"Not enough TUs for crouching."));
836 Cvar_Set(
"mn_crouch_reservation_tt",
_(
"%i TUs reserved for crouching/standing up.\nClick to clear."),
843 Cvar_Set(
"mn_crouch_reservation_tt",
_(
"Reserve %i TUs for crouching/standing up."),
TU_CROUCH);
849 Cvar_Set(
"mn_crouch_reservation_tt",
_(
"Not enough TUs left to reserve for crouching/standing up."));
858 Cvar_Set(
"mn_shot_reservation_tt",
_(
"%i TUs reserved for shooting.\nClick to change.\nRight-Click to clear."),
865 Cvar_Set(
"mn_shot_reservation_tt",
_(
"Reserve TUs for shooting."));
871 Cvar_Set(
"mn_shot_reservation_tt",
_(
"Reserving TUs for shooting not possible."));
894 if (rightCanBeReloaded != -1) {
896 Cvar_Set(
"mn_reloadright_tt",
_(
"Reload weapon (%i TU)."), rightCanBeReloaded);
898 Cvar_Set(
"mn_reloadright_tt",
"%s", reason);
903 if (leftCanBeReloaded != -1) {
905 Cvar_Set(
"mn_reloadleft_tt",
_(
"Reload weapon (%i TU)."), leftCanBeReloaded);
907 Cvar_Set(
"mn_reloadleft_tt",
"%s", reason);
916 if (time < minheadgeartime)
928 if (time < minweaponrtime)
936 const Item* weaponL =
nullptr;
942 if (time < minweaponltime)
979 const int iconOffsetX = 16;
983 int iconOffsetY = 16;
985 const int iconSpacing = 2;
988 const int iconW = 16;
990 const int iconH = 16;
992 int bgX =
mousePosX + iconOffsetX / 2 - 2;
1016 iconOffsetY += iconH;
1017 iconOffsetY += iconSpacing;
1088 const Item* selWeapon;
1121 if (fdArray !=
nullptr) {
1130 if (fdArray !=
nullptr) {
1139 HUD_DisplayMessage(
_(
"You cannot use this unknown item.\nYou need to research it first."));
1141 }
else if (actor->
fd) {
1146 "%s\n%s (%i) [%i%%] %i\n",
_(def->
name),
_(actor->
fd->
name),
1159 }
else if (selWeapon) {
1177 if (reservedTUs > 0)
1184 if (reservedTUs > 0)
1185 Com_sprintf(infoText,
lengthof(infoText),
_(
"Morale %i | Reserved TUs: %i\n%s %i (%i|%i TUs left)\n"),
1216 Cvar_Set(
"mn_tu_tooltips",
_(
"Time Units\n- Available: %i (of %i)\n- Reserved: %i\n- Remaining: %i\n"),
1222 Cvar_Set(
"mn_anim",
"%s", animName);
1229 Cvar_Set(
"mn_rweapon_item",
"%s",
"");
1237 Cvar_Set(
"mn_lweapon_item",
"%s",
"");
1245 Cvar_Set(
"mn_ammoright",
"%s",
"");
1258 return _(
"- Reduced accuracy");
1260 return _(
"- Reduced shooting speed");
1262 return _(
"- Reduced movement speed");
1264 return _(
"- Reduced sight range");
1266 return _(
"- Reduced reaction speed");
1268 return _(
"- Reduced TUs");
1286 for (
int bodyPart = 0; bodyPart < bodyData->
numBodyParts(); ++bodyPart) {
1290 const int bleeding = wounds->
woundLevel[bodyPart] * (wounds->
woundLevel[bodyPart] > woundThreshold
1297 label =
va(isRobot ?
_(
"%s: deteriorating (%i)\n") :
_(
"%s: bleeding (%i)\n"),
_(bodyData->
name(bodyPart)), bleeding);
1299 label =
va(bleeding ?
_(
"%s: damaged\n") :
_(
"%s: wounded\n"),
_(bodyData->
name(bodyPart)));
1308 UI_ExecuteConfunc(
"actor_wounds %s %i \"%s\" \"%s\"", bodyData->
id(bodyPart), bleeding, label, text);
1326 const int invWeight =
selActor->inv.getWeight();
1331 const int tuPenalty = tus - normalTU;
1336 Item* item =
nullptr;
1339 if (fireDef ==
nullptr)
1343 if (fd.
time > 0 && fd.
time > tus) {
1359 Com_sprintf(tooltip,
sizeof(tooltip),
"%s %i (%+i)",
_(
"TU:"), tus, tuPenalty);
1412 time = std::max(0, actor->
TU - time);
1413 Cvar_Set(
"mn_turemain",
"%i", time);
1439 else if (
i <
cl.mapMaxLevel)
1453 }
else if (!
cl.numTeamList) {
1478 if (newValue[0] !=
'\0') {
1479 const int actorIdx = atoi(newValue);
1481 if (actorIdx >= 0 && actorIdx <
size)
1498 if (
Q_streq(oldValue, newValue))
1516 if (
Q_streq(oldValue, newValue))
1534 if (
Q_streq(oldValue, newValue))
1554 if (window ==
nullptr) {
1558 if (window->
super ==
nullptr) {
1618 Cvar_Get(
"mn_ammoleft",
"", 0,
"The remaining amount of ammunition in the left hand weapon.");
1619 Cvar_Get(
"mn_lweapon",
"", 0,
"The left hand weapon model of the current selected actor - empty if no weapon.");
1623 Cvar_Get(
"mn_ammoright",
"", 0,
"The remaining amount of ammunition in the right hand weapon.");
1624 Cvar_Get(
"mn_rweapon",
"", 0,
"The right hand weapon model of the current selected actor - empty if no weapon.");
1628 Cvar_Get(
"mn_turemain",
"", 0,
"Remaining TUs for the current selected actor.");
bool CHRSH_IsTeamDefRobot(const teamDef_t *const td)
Check if a team definition is a robot.
void CL_ActorReserveTUs(const le_t *le, const reservation_types_t type, const int tus)
Replace the reserved TUs for a certain type.
int CL_ActorGetNumber(const le_t *le)
Returns the number of the actor in the teamlist.
int CL_ActorUsableTUs(const le_t *le)
Returns the amount of usable (overall-reserved) TUs for an actor.
void CL_ActorSetMode(le_t *actor, actorModes_t actorMode)
int CL_ActorReservedTUs(const le_t *le, const reservation_types_t type)
Returns the amount of reserved TUs for a certain type.
void CL_ActorSetFireDef(le_t *actor, const fireDef_t *fd)
void MSG_Write_PA(player_action_t playerAction, int entnum,...)
Writes player action with its data.
int CL_ActorMoveMode(const le_t *le)
Decide how the actor will walk, taking into account autostanding.
bool CL_ActorFireModeActivated(const actorModes_t mode)
Checks whether we are in fire mode or node.
int CL_ActorTimeForFireDef(const le_t *le, const fireDef_t *fd, bool reaction)
Find the TUs needed for the given fireDef taking into account the actor wound penalties.
character_t * CL_ActorGetChr(const le_t *le)
Returns the character information for an actor in the teamlist.
float CL_ActorInjuryModifier(const le_t *le, const modifier_types_t type)
Returns the actor injury modifier of the specified type.
#define ACTOR_GET_FIELDSIZE(actor)
int CL_GetHitProbability(const le_t *actor)
Calculates chance to hit if the actor has a fire mode activated.
bool CL_OnBattlescape(void)
Check whether we are in a tactical mission as server or as client. But this only means that we are ab...
bool CL_BattlescapeRunning(void)
Check whether we already have actors spawned on the battlefield.
bool GAME_ItemIsUseable(const objDef_t *od)
int GAME_GetChrMaxLoad(const character_t *chr)
Returns the max weight the given character can carry.
Shared game type headers.
CGAME_HARD_LINKED_FUNCTIONS linkedList_t * LIST_Add(linkedList_t **listDest, void const *data, size_t length)
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 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_UpdateActorLoad_f(void)
Update the equipment weight for the 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 weaponButtonState_t buttonStates[BT_NUM_TYPES]
static int HUD_UpdateActorFireMode(le_t *actor)
static reserveButtonState_t crouchReserveButtonState
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.
void HUD_InitStartup(void)
static bool HUD_DisplayImpossibleReaction(const le_t *actor)
Display 'impossible' (red) reaction buttons.
static void HUD_PopupFiremodeReservation_f(void)
Creates a (text) list of all firemodes of the currently selected actor.
static reserveButtonState_t shotReserveButtonState
static int HUD_GetMinimumTUsForUsage(const Item *item)
static bool CL_CvarWorldLevel(cvar_t *cvar)
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 char const *const moveModeDescriptions[]
static const char * HUD_GetPenaltyString(const int type)
static void HUD_DisplayPossibleReaction(const le_t *actor)
Display 'usable' (blue) reaction buttons.
static void HUD_UpdateButtons(const le_t *le)
Refreshes the weapon/reload buttons on the HUD.
static bool HUD_CheckCLHud(cvar_t *cvar)
Checks that the given cvar is a valid hud cvar.
weaponButtonState_t
Defines the various states of a button.
static bool HUD_CvarCheckMNHud(cvar_t *cvar)
Checks that the given cvar is a valid hud cvar.
@ BUTTON_TURESERVE_CROUCH_CLEAR
@ BUTTON_TURESERVE_SHOT_CLEAR
@ BUTTON_TURESERVE_SHOT_DISABLED
@ BUTTON_TURESERVE_CROUCH_RESERVED
@ BUTTON_TURESERVE_CROUCH_DISABLED
@ BUTTON_TURESERVE_SHOT_RESERVED
@ BUTTON_TURESERVE_UNINITIALIZED
void HUD_UpdateCursor(void)
Updates the cursor texts when in battlescape.
static char const *const shootTypeStrings[]
a cbuf string for each button_types_t
@ REMAINING_TU_RELOAD_RIGHT
@ REMAINING_TU_RELOAD_LEFT
static void HUD_DisplayActions(const char *callback, const le_t *actor, actionType_t type)
List actions from a soldier to a callback confunc.
static cvar_t * cl_show_cursor_tooltips
void HUD_InitUI(const char *optionWindowName)
Display the user interface.
static void HUD_MapDebugCursor(const le_t *le)
Shows map pathfinding debugging parameters (if activated).
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_UpdateActorCvar(const le_t *actor)
void HUD_DisplayMessage(const char *text)
Displays a message on the hud.
static cvar_t * cl_hud_message_timeout
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 void HUD_UpdateActor(le_t *actor)
Updates the hud for one actor.
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 linkedList_t * popupListData
static int HUD_WeaponCanBeReloaded(const le_t *le, containerIndex_t containerID, const char **reason)
Checks every case for reload buttons on the HUD.
static void HUD_RemainingTUs_f(void)
Remember if we hover over a button that would cost some TUs when pressed.
static uiNode_t * popupListNode
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_PopupFiremodeReservation(const le_t *le, bool popupReload)
Creates a (text) list of all firemodes of the currently selected actor.
static int HUD_UpdateActorMove(const le_t *actor)
static void HUD_DisplayActions_f(void)
Displays the firemodes for the given hand.
void HUD_Update(void)
Updates console vars for an actor.
static bool displayRemainingTus[REMAINING_TU_MAX]
int HUD_ReactionFireGetTUs(const le_t *actor)
Get the weapon firing TUs for reaction fire.
static void HUD_ActorWoundData_f(void)
static void HUD_DrawMouseCursorText(int xOffset, int yOffset, int textId)
Draw the mouse cursor tooltips in battlescape.
static void HUD_ShotReserve_f(void)
Get selected firemode in the list of the currently selected actor.
void HUD_UpdateActorStats(const le_t *le)
static void HUD_DisplayFiremodes_f(void)
Displays the firemodes for the given hand.
static bool HUD_CheckFiremodeReservation(void)
Check if at least one firemode is available for reservation.
static void HUD_SetWeaponButton(buttonTypes_t button, weaponButtonState_t state)
Sets the display for a single weapon/reload HUD button.
#define ACTOR_GET_HAND_INDEX(hand)
#define ACTOR_GET_HAND_CHAR(hand)
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 ...
int HUD_CalcReloadTime(const le_t *le, const objDef_t *weapon, containerIndex_t toContainer)
Calculate total reload time for selected actor.
void HUD_InitCallbacks(void)
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.
#define LE_IsPanicked(le)
#define IS_MODE_FIRE_HEADGEAR(x)
#define IS_MODE_FIRE_LEFT(x)
#define LE_IsCrouched(le)
#define LE_IsSelected(le)
void R_FontTextSize(const char *fontId, const char *text, int maxWidth, longlines_t method, int *width, int *height, int *lines, bool *isTruncated)
Supply information about the size of the text when it is linewrapped and rendered,...
#define MAPDEBUG_TEXT
cvar debug_map options: debug_map is a bit mask, like the developer cvar. There is no ALL bit....
float woundThreshold(const short bodyPart) const
const char * name(const short bodyPart) const
short numBodyParts(void) const
float penalty(const short bodyPart, const modifier_types_t type) const
const char * id(void) const
float bleedingFactor(const short bodyPart) const
Item * getNextItem(const Item *prev) const
void set(const actorHands_t hand, const fireDefIndex_t fmIdx, const objDef_t *weapon)
actorHands_t getHand() const
const objDef_t * getWeapon() const
bool holdsReactionFireWeapon() const
Checks if there is a weapon in the hands that can be used for reaction fire.
Item * getHeadgear() const
Item * getContainer2(const containerIndex_t idx) const
const Container * getNextCont(const Container *prev, bool inclTemp=false) const
item instance data, with linked list capability
const objDef_t * ammoDef(void) const
const fireDef_t * getFastestFireDef() const
const objDef_t * def(void) const
const fireDef_t * getFiredefs() const
Returns the firedefinitions for a given weapon/ammo.
bool isReloadable() const
bool isHeldTwoHanded() const
Primary header for client.
const char * Cmd_Argv(int arg)
Returns a given argument.
int Cmd_Argc(void)
Return the number of arguments of the current command. "command parameter" will result in a argc of 2...
void Cmd_AddCommand(const char *cmdName, xcommand_t function, const char *desc)
Add a new command to the script interface.
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
void Com_Printf(const char *const fmt,...)
cvarChangeListener_t * Cvar_RegisterChangeListener(const char *varName, cvarChangeListenerFunc_t listenerFunc)
Registers a listener that is executed each time a cvar changed its value.
void Cvar_SetValue(const char *varName, float value)
Expands value to a string and calls Cvar_Set.
cvar_t * Cvar_Set(const char *varName, const char *value,...)
Sets a cvar value.
bool Cvar_SetCheckFunction(const char *varName, bool(*check)(cvar_t *cvar))
Set a checker function for cvar values.
bool Cvar_AssertValue(cvar_t *cvar, float minVal, float maxVal, bool shouldBeIntegral)
Checks cvar values.
void Cvar_Reset(cvar_t *cvar)
Sets the cvar value back to the old value.
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags, const char *desc)
Init or return a cvar.
#define ROUTING_NOT_REACHABLE
#define PATHFINDING_HEIGHT
15 max, adjusting above 8 will require a rewrite to the DV code
int Grid_MoveNext(const pathing_t *path, const pos3_t toPos, byte crouchingState)
Get the direction to use to move to a position (used to reconstruct the path).
unsigned int Grid_Ceiling(const Routing &routing, const actorSizeEnum_t actorSize, const pos3_t pos)
Returns the height of the floor in a cell.
int Grid_Floor(const Routing &routing, const actorSizeEnum_t actorSize, const pos3_t pos)
Returns the height of the floor in a cell.
Battlescape grid functions.
const objDef_t * INVSH_GetItemByIDX(int index)
Returns the item that belongs to the given index or nullptr if the index is invalid.
const fireDef_t * FIRESH_GetFiredef(const objDef_t *obj, const weaponFireDefIndex_t weapFdsIdx, const fireDefIndex_t fdIdx)
Get the fire definitions for a given object.
int32_t weaponFireDefIndex_t
#define MAX_FIREDEFS_PER_WEAPON
#define foreachhand(hand)
#define THIS_FIREMODE(fm, HAND, fdIdx)
void LIST_AddString(linkedList_t **listDest, const char *data)
Adds an string to a new or to an already existing linked list. The string is copied here.
void LIST_Delete(linkedList_t **list)
void * LIST_GetByIdx(linkedList_t *list, int index)
Get an entry of a linked list by its index in the list.
int LIST_Count(const linkedList_t *list)
void LIST_AddPointer(linkedList_t **listDest, void *data)
Adds just a pointer to a new or to an already existing linked list.
#define WEIGHT_NORMAL_PENALTY
#define GET_ENCUMBRANCE_PENALTY(weight, max)
void R_DrawImage(float x, float y, const image_t *image)
Draws an image or parts of it.
QGL_EXTERN GLsizei const GLvoid * data
QGL_EXTERN GLint GLenum type
image_t * R_FindImage(const char *pname, imagetype_t type)
Finds or loads the given image.
const char * R_AnimGetName(const animState_t *as, const model_t *mod)
Get the current running animation for a model.
bool Com_ParseBoolean(const char *token)
Parses a boolean from a string.
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
void Q_strcat(char *dest, size_t destsize, const char *format,...)
Safely (without overflowing the destination buffer) concatenates two strings.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
Describes a character with all its attributes.
chrReservations_t reservedTus
FiremodeSettings shotSettings
int skills[SKILL_NUM_TYPES]
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
this is a fire definition for our weapons/ammo
const struct objDef_s * obj
weaponFireDefIndex_t weapFdsIdx
Item * getLeftHandItem() const
fireDefIndex_t currentSelectedFiremode
Item * getRightHandItem() const
byte actorMoveLength
The TUs that the current selected actor needs to walk to the current grid position marked by the mous...
Item * getHandItem(actorHands_t hand) const
Defines all attributes of objects used in the inventory.
fireDef_t fd[MAX_WEAPONS_PER_OBJDEF][MAX_FIREDEFS_PER_WEAPON]
fireDefIndex_t numFiredefs[MAX_WEAPONS_PER_OBJDEF]
bool isReloadable() const
const struct objDef_s * weapons[MAX_WEAPONS_PER_OBJDEF]
Atomic structure used to define most of the UI.
int woundLevel[BODYPART_MAXTYPE]
int treatmentLevel[BODYPART_MAXTYPE]
void UI_ResetData(int dataId)
Reset a shared data. Type became NONE and value became nullptr.
void UI_RegisterText(int dataId, const char *text)
share a text with a data id
const char * UI_GetText(int textId)
@ TEXT_MOUSECURSOR_BOTTOM
@ TEXT_MOUSECURSOR_PLAYERNAMES
void UI_DisplayNotice(const char *text, int time, const char *windowName)
Displays a message over all windows.
void UI_ExecuteConfunc(const char *fmt,...)
Executes confunc - just to identify those confuncs in the code - in this frame.
void UI_TextNodeSelectLine(uiNode_t *node, int num)
Change the selected line.
uiNode_t * UI_GetWindow(const char *name)
Searches all windows for the specified one.
void UI_PopWindow(bool all)
Pops a window from the window stack.
void UI_InitStack(const char *activeWindow, const char *mainWindow)
Init the stack to start with a window, and have an alternative window with ESC.
const char * UI_GetActiveWindowName(void)
Returns the name of the current window.
#define VectorSet(v, x, y, z)