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
25 changes: 24 additions & 1 deletion addons/medical_feedback/RscInGameUI.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
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)]);
x = IGUI_GRID_STANCE_X + IGUI_GRID_STANCE_WAbs * 3 / 4;
10Dozen marked this conversation as resolved.
Show resolved Hide resolved
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)]);
x = IGUI_GRID_STANCE_X + IGUI_GRID_STANCE_WAbs * 3 / 4;
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(handleGUIIndication);
PREP(handleEffects);
PREP(initEffects);
PREP(playInjuredSound);
Binary file added addons/medical_feedback/data/cat.paa
Binary file not shown.
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.
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(GUIIndication)) then {
10Dozen marked this conversation as resolved.
Show resolved Hide resolved
[] call FUNC(handleGUIIndication);
};

END_COUNTER(handleEffects);
63 changes: 63 additions & 0 deletions addons/medical_feedback/functions/fnc_handleGUIIndication.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#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: Drop indicator <BOOL>
*
* Return Value:
* None
*
* Example:
* [false] call ace_medical_feedback_fnc_handleGUIIndication
*
* Public: No
*/
params [["_dropIndicator", false]];
private _indicatorSlots = [
uiNamespace getVariable [QGVAR(stateIndicator1), controlNull],
uiNamespace getVariable [QGVAR(stateIndicator2), controlNull],
uiNamespace getVariable [QGVAR(stateIndicator3), controlNull]
];

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

// --- Tourniquets
private _hasTourniquets = {_x > 0} count GET_TOURNIQUETS(ACE_player) > 0;
10Dozen marked this conversation as resolved.
Show resolved Hide resolved
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 = {_x > 0} count GET_FRACTURES(ACE_player) > 0;
10Dozen marked this conversation as resolved.
Show resolved Hide resolved
_fractureIcon = ["",ICON_FRACTURE_PATH] select _hasFractures;

if (_fractureSettings > 1) then {
// --- Fractures can not be fully healed: check for splint indication
private _hasSplints = {_x isEqualTo -1} count GET_FRACTURES(ACE_player) > 0;
10Dozen marked this conversation as resolved.
Show resolved Hide resolved
_splintIcon = ["",ICON_SPLINT_PATH] select _hasSplints;
};
};

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

// --- Applying 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(GUIIndication),
"CHECKBOX",
[LSTRING(GUIIndication_DisplayName), LSTRING(GUIIndication_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory)],
true,
false,
{
// --- Drop indication on disabling
if (!_this) exitWith {
[true] call FUNC(handleGUIIndication);
};
}
] 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\cat.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_GUIIndication_DisplayName">
<English>Enable Fractures/CATs Indication</English>
<Russian>Включить индикацию переломов/жгутов</Russian>
</Key>
<Key ID="STR_ACE_Medical_Feedback_GUIIndication_Description">
<English>Enables the indication of the fractures, applied CATs and splints over the Stance indicator.</English>
<Russian>Включает индикацию переломов, а также наложенных жгутов и шин поверх индикатора положения тела.</Russian>
</Key>
</Container>
</Package>
</Project>