Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medical Feedback - Add indication of Fractures and applied CATs/Splints #8321

Merged
merged 11 commits into from
Oct 12, 2021
23 changes: 22 additions & 1 deletion addons/medical_feedback/RscInGameUI.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
class RscPictureKeepAspect;
class RscInGameUI {
class RscStanceInfo {
controls[] += {QGVAR(bloodVolumeIndicator)};
controls[] += {
QGVAR(bloodVolumeIndicator),
QGVAR(stateIndicator1),
QGVAR(stateIndicator2),
QGVAR(stateIndicator3)
};
class GVAR(bloodVolumeIndicator): RscPictureKeepAspect {
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(bloodVolumeIndicator),_this select 0)]);
x = IGUI_GRID_STANCE_X;
y = IGUI_GRID_STANCE_Y;
w = IGUI_GRID_STANCE_WAbs / 4;
h = IGUI_GRID_STANCE_HAbs / 4;
};

class GVAR(stateIndicator1): RscPictureKeepAspect {
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(stateIndicator1), _this select 0)]);
x = IGUI_GRID_STANCE_X + IGUI_GRID_STANCE_WAbs * 3 / 4;
y = IGUI_GRID_STANCE_Y;
w = IGUI_GRID_STANCE_WAbs / 4;
h = IGUI_GRID_STANCE_HAbs / 4;
};
class GVAR(stateIndicator2): GVAR(stateIndicator1) {
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(stateIndicator2), _this select 0)]);
y = IGUI_GRID_STANCE_Y + IGUI_GRID_STANCE_HAbs / 4;
};
class GVAR(stateIndicator3): GVAR(stateIndicator1) {
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(stateIndicator3), _this select 0)]);
y = IGUI_GRID_STANCE_Y + IGUI_GRID_STANCE_HAbs * 2 / 4;
};
};
};
1 change: 1 addition & 0 deletions addons/medical_feedback/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ PREP(effectHeartBeat);
PREP(effectIncapacitated);
PREP(effectPain);
PREP(effectUnconscious);
PREP(handleHUDIndicators);
PREP(handleEffects);
PREP(initEffects);
PREP(playInjuredSound);
Binary file added addons/medical_feedback/data/fracture.paa
Binary file not shown.
Binary file added addons/medical_feedback/data/splint.paa
Binary file not shown.
Binary file added addons/medical_feedback/data/tourniquet.paa
Binary file not shown.
5 changes: 5 additions & 0 deletions addons/medical_feedback/functions/fnc_handleEffects.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,9 @@ if ((!GVAR(heartBeatEffectRunning)) && {_heartRate != 0} && {(_heartRate > 160)
[!_unconscious, _pain] call FUNC(effectPain);
[!_unconscious, _bleedingStrength, _manualUpdate] call FUNC(effectBleeding);

// - Tourniquets, fractures and splints indication ---------------------------------------
if (GVAR(enableHUDIndicators)) then {
[] call FUNC(handleHUDIndicators);
};

END_COUNTER(handleEffects);
64 changes: 64 additions & 0 deletions addons/medical_feedback/functions/fnc_handleHUDIndicators.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#include "script_component.hpp"
/*
* Author: 10Dozen
* Handles indication of the fractures, applied tourniquets and splints over Stance indicator.
* Draws an icon if there is at least 1 fracture/splint/tourniquet applied.
*
* Arguments:
* 0: Flag to drop all indicators (optional) <BOOL>
*
* Return Value:
* None
*
* Example:
* [false] call ace_medical_feedback_fnc_handleHUDIndicators
*
* Public: No
*/
params [["_dropAllIndicators", false]];

private _indicatorSlots = [
uiNamespace getVariable [QGVAR(stateIndicator1), controlNull],
uiNamespace getVariable [QGVAR(stateIndicator2), controlNull],
uiNamespace getVariable [QGVAR(stateIndicator3), controlNull]
];

// --- Removes any indication and exit
if (_dropAllIndicators) exitWith {
{
_x ctrlSetText "";
} forEach _indicatorSlots;
};

// --- Tourniquets
private _hasTourniquets = GET_TOURNIQUETS(ACE_player) findIf {_x > 0} > -1;
private _tourniquetIcon = ["", ICON_TOURNIQUET_PATH] select _hasTourniquets;

// --- Fractures and Splints
private _fractureSettings = EGVAR(medical,fractures);
private _fractureIcon = "";
private _splintIcon = "";

if (_fractureSettings > 0) then {
// --- Fractures enabled: check for fracture indication
private _hasFractures = GET_FRACTURES(ACE_player) findIf {_x > 0} > -1;
_fractureIcon = ["", ICON_FRACTURE_PATH] select _hasFractures;

if (_fractureSettings > 1) then {
// --- Fractures can not be fully healed: check for splint indication
private _hasSplints = GET_FRACTURES(ACE_player) findIf {_x == -1} > -1;
_splintIcon = ["", ICON_SPLINT_PATH] select _hasSplints;
};
};

// --- Get prioritized list of icons to apply
private _icons = [
_fractureIcon,
_tourniquetIcon,
_splintIcon
] select {_x isNotEqualTo ""};

// --- Apply icons to indicator slots, if no icon for slot - remove slot's text
{
_x ctrlSetText (_icons param [_forEachIndex, ""]);
} forEach _indicatorSlots;
15 changes: 15 additions & 0 deletions addons/medical_feedback/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,18 @@
[true] call FUNC(initEffects);
}
] call CBA_fnc_addSetting;

[
QGVAR(enableHUDIndicators),
"CHECKBOX",
[LSTRING(EnableHUDIndicators_DisplayName), LSTRING(EnableHUDIndicators_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory)],
true,
false,
{
// --- Drop indication on disabling
if (!_this) exitWith {
[true] call FUNC(handleHUDIndicators);
};
}
] call CBA_fnc_addSetting;
4 changes: 4 additions & 0 deletions addons/medical_feedback/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@
#define ICON_BLOODVOLUME_COLOR_WHITE [1, 1, 1, 1]
#define ICON_BLOODVOLUME_COLOR_ORANGE [1, 0.6, 0, 1]
#define ICON_BLOODVOLUME_COLOR_RED [0.8, 0.2, 0, 1]

#define ICON_TOURNIQUET_PATH QPATHTOF(data\tourniquet.paa)
#define ICON_SPLINT_PATH QPATHTOF(data\splint.paa)
#define ICON_FRACTURE_PATH QPATHTOF(data\fracture.paa)
8 changes: 8 additions & 0 deletions addons/medical_feedback/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@
<Chinese>啟用傷者的尖叫聲</Chinese>
<Turkish>Yaralı birimler tarafından çığlık atmayı etkinleştir</Turkish>
</Key>
<Key ID="STR_ACE_Medical_Feedback_EnableHUDIndicators_DisplayName">
<English>Enable Fracture/Tourniquet/Splint Indicators</English>
<Russian>Включить индикаторы переломов/жгутов/шин</Russian>
</Key>
<Key ID="STR_ACE_Medical_Feedback_EnableHUDIndicators_Description">
<English>Enables indicators for the fractures, applied tourniquets and splints over the Stance Indicator.</English>
jonpas marked this conversation as resolved.
Show resolved Hide resolved
<Russian>Включает индикацию переломов, наложенных шин и жгутов поверх индикатора положения тела.</Russian>
</Key>
</Container>
</Package>
</Project>