diff --git a/addons/medical_feedback/RscInGameUI.hpp b/addons/medical_feedback/RscInGameUI.hpp new file mode 100644 index 0000000000..275117ca8e --- /dev/null +++ b/addons/medical_feedback/RscInGameUI.hpp @@ -0,0 +1,13 @@ +class RscPictureKeepAspect; +class RscInGameUI { + class RscStanceInfo { + controls[] += {QGVAR(bloodVolumeIndicator)}; + 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; + }; + }; +}; diff --git a/addons/medical_feedback/XEH_PREP.hpp b/addons/medical_feedback/XEH_PREP.hpp index ee4b453bbe..e6c48d6506 100644 --- a/addons/medical_feedback/XEH_PREP.hpp +++ b/addons/medical_feedback/XEH_PREP.hpp @@ -1,5 +1,6 @@ PREP(effectBleeding); PREP(effectBloodVolume); +PREP(effectBloodVolumeIcon); PREP(effectHeartBeat); PREP(effectIncapacitated); PREP(effectPain); diff --git a/addons/medical_feedback/config.cpp b/addons/medical_feedback/config.cpp index 493d41cf8c..50eb2bbab3 100644 --- a/addons/medical_feedback/config.cpp +++ b/addons/medical_feedback/config.cpp @@ -19,3 +19,4 @@ class CfgPatches { #include "CfgSounds.hpp" #include "CfgVehicles.hpp" #include "RscTitles.hpp" +#include "RscInGameUI.hpp" diff --git a/addons/medical_feedback/data/bloodVolume_1.paa b/addons/medical_feedback/data/bloodVolume_1.paa new file mode 100644 index 0000000000..04ddeaae2c Binary files /dev/null and b/addons/medical_feedback/data/bloodVolume_1.paa differ diff --git a/addons/medical_feedback/data/bloodVolume_2.paa b/addons/medical_feedback/data/bloodVolume_2.paa new file mode 100644 index 0000000000..550d510271 Binary files /dev/null and b/addons/medical_feedback/data/bloodVolume_2.paa differ diff --git a/addons/medical_feedback/data/bloodVolume_3.paa b/addons/medical_feedback/data/bloodVolume_3.paa new file mode 100644 index 0000000000..8a24a5692a Binary files /dev/null and b/addons/medical_feedback/data/bloodVolume_3.paa differ diff --git a/addons/medical_feedback/data/bloodVolume_4.paa b/addons/medical_feedback/data/bloodVolume_4.paa new file mode 100644 index 0000000000..c859576881 Binary files /dev/null and b/addons/medical_feedback/data/bloodVolume_4.paa differ diff --git a/addons/medical_feedback/data/bloodVolume_5.paa b/addons/medical_feedback/data/bloodVolume_5.paa new file mode 100644 index 0000000000..7f2061a31a Binary files /dev/null and b/addons/medical_feedback/data/bloodVolume_5.paa differ diff --git a/addons/medical_feedback/data/bloodVolume_6.paa b/addons/medical_feedback/data/bloodVolume_6.paa new file mode 100644 index 0000000000..22e3b0c304 Binary files /dev/null and b/addons/medical_feedback/data/bloodVolume_6.paa differ diff --git a/addons/medical_feedback/functions/fnc_effectBloodVolume.sqf b/addons/medical_feedback/functions/fnc_effectBloodVolume.sqf index e4a8e27053..ae2dcc1e74 100644 --- a/addons/medical_feedback/functions/fnc_effectBloodVolume.sqf +++ b/addons/medical_feedback/functions/fnc_effectBloodVolume.sqf @@ -18,9 +18,11 @@ params ["_enable", "_intensity"]; +if (isNil QGVAR(ppBloodVolume)) exitWith {}; if ((!_enable) || {_intensity == 0}) exitWith { GVAR(ppBloodVolume) ppEffectEnable false; }; + GVAR(ppBloodVolume) ppEffectEnable true; GVAR(ppBloodVolume) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1 - _intensity], [0.2, 0.2, 0.2, 0]]; GVAR(ppBloodVolume) ppEffectCommit 1; diff --git a/addons/medical_feedback/functions/fnc_effectBloodVolumeIcon.sqf b/addons/medical_feedback/functions/fnc_effectBloodVolumeIcon.sqf new file mode 100644 index 0000000000..2ba1e5b665 --- /dev/null +++ b/addons/medical_feedback/functions/fnc_effectBloodVolumeIcon.sqf @@ -0,0 +1,41 @@ +#include "script_component.hpp" +/* + * Author: 10Dozen + * Handles the blood volume icon. + * + * Arguments: + * 0: Enable + * 1: Intensity 0...6 + * + * Return Value: + * None + * + * Example: + * [true, 4] call ace_medical_feedback_fnc_effectBloodVolumeIcon + * + * Public: No + */ + +params ["_enable", "_intensity"]; + +private _indicatorCtrl = uiNamespace getVariable [QGVAR(bloodVolumeIndicator), controlNull]; + +if (!_enable || !GVAR(showBloodVolumeIcon)) exitWith { + _indicatorCtrl ctrlSetText ""; +}; + +private _text = ""; +private _color = ICON_BLOODVOLUME_COLOR_NONE; + +if (_intensity > 0) then { + _text = ICON_BLOODVOLUME_PATH(_intensity); + if (_intensity > 2) then { + _color = [ICON_BLOODVOLUME_COLOR_ORANGE, ICON_BLOODVOLUME_COLOR_RED] select (_intensity > 4); + } else { + _color = ICON_BLOODVOLUME_COLOR_WHITE; + }; +}; + +// --- Affecting UI icon with proper image and color +_indicatorCtrl ctrlSetText _text; +_indicatorCtrl ctrlSetTextColor _color; diff --git a/addons/medical_feedback/functions/fnc_handleEffects.sqf b/addons/medical_feedback/functions/fnc_handleEffects.sqf index b065d42646..77c8d9f1ae 100644 --- a/addons/medical_feedback/functions/fnc_handleEffects.sqf +++ b/addons/medical_feedback/functions/fnc_handleEffects.sqf @@ -21,6 +21,7 @@ if (EGVAR(common,OldIsCamera) || {!alive ACE_player}) exitWith { [false, 0] call FUNC(effectUnconscious); [false] call FUNC(effectPain); [false] call FUNC(effectBloodVolume); + [false] call FUNC(effectBloodVolumeIcon); [false] call FUNC(effectBleeding); }; @@ -42,8 +43,17 @@ if ((!GVAR(heartBeatEffectRunning)) && {_heartRate != 0} && {(_heartRate > 160) // - Visual effects ----------------------------------------------------------- [_unconscious, 2] call FUNC(effectUnconscious); [ - true, linearConversion [BLOOD_VOLUME_CLASS_2_HEMORRHAGE, BLOOD_VOLUME_CLASS_4_HEMORRHAGE, _bloodVolume, 0, 1, true] + true, + linearConversion [BLOOD_VOLUME_CLASS_2_HEMORRHAGE, BLOOD_VOLUME_CLASS_4_HEMORRHAGE, _bloodVolume, 0, 1, true] ] call FUNC(effectBloodVolume); +[ + true, + ceil linearConversion [ + BLOOD_VOLUME_CLASS_2_HEMORRHAGE, BLOOD_VOLUME_CLASS_4_HEMORRHAGE, + _bloodVolume, + ICON_BLOODVOLUME_IDX_MIN, ICON_BLOODVOLUME_IDX_MAX, true + ] +] call FUNC(effectBloodVolumeIcon); [!_unconscious, _pain] call FUNC(effectPain); [!_unconscious, _bleedingStrength, _manualUpdate] call FUNC(effectBleeding); diff --git a/addons/medical_feedback/functions/fnc_initEffects.sqf b/addons/medical_feedback/functions/fnc_initEffects.sqf index 11bee29651..1d908c529d 100644 --- a/addons/medical_feedback/functions/fnc_initEffects.sqf +++ b/addons/medical_feedback/functions/fnc_initEffects.sqf @@ -4,7 +4,7 @@ * Initializes visual effects of medical. * * Arguments: - * 0: Just Pain Effects + * 0: Update pain and low blood volume effects only * * Return Value: * None @@ -15,9 +15,9 @@ * Public: No */ -params [["_justPain", false]]; +params [["_updateOnly", false]]; -TRACE_1("initEffects",_justPain); +TRACE_1("initEffects",_updateOnly); private _fnc_createEffect = { params ["_type", "_layer", "_default"]; @@ -68,7 +68,34 @@ if (isNil QGVAR(ppPainBlur)) then { }; TRACE_1("created pain",GVAR(ppPain)); -if (_justPain) exitWith {}; + +// - Blood volume ------------------------------------------------------------- +private _ppBloodVolumeSettings = [ + "ColorCorrections", + 13503, + [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [0.2, 0.2, 0.2, 0]] +]; +GVAR(showBloodVolumeIcon) = false; + +if (!isNil QGVAR(ppBloodVolume)) then { + TRACE_1("delete blood volume",GVAR(ppBloodVolume)); + ppEffectDestroy GVAR(ppBloodVolume); + GVAR(ppBloodVolume) = nil; +}; +switch (GVAR(bloodVolumeEffectType)) do { + case FX_BLOODVOLUME_COLOR_CORRECTION: { + GVAR(ppBloodVolume) = _ppBloodVolumeSettings call _fnc_createEffect; + }; + case FX_BLOODVOLUME_ICON: { + GVAR(showBloodVolumeIcon) = true; + }; + case FX_BLOODVOLUME_BOTH: { + GVAR(showBloodVolumeIcon) = true; + GVAR(ppBloodVolume) = _ppBloodVolumeSettings call _fnc_createEffect; + }; +}; + +if (_updateOnly) exitWith {}; // - Unconscious -------------------------------------------------------------- GVAR(ppUnconsciousBlur) = [ @@ -83,14 +110,6 @@ GVAR(ppUnconsciousBlackout) = [ [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] ] call _fnc_createEffect; - -// - Blood volume ------------------------------------------------------------- -GVAR(ppBloodVolume) = [ - "ColorCorrections", - 13503, - [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [0.2, 0.2, 0.2, 0]] -] call _fnc_createEffect; - // - Incapacitation ----------------------------------------------------------- GVAR(ppIncapacitationGlare) = [ "ColorCorrections", diff --git a/addons/medical_feedback/initSettings.sqf b/addons/medical_feedback/initSettings.sqf index 6d0965fe9f..128f1f6b91 100644 --- a/addons/medical_feedback/initSettings.sqf +++ b/addons/medical_feedback/initSettings.sqf @@ -17,4 +17,25 @@ TRACE_1("painEffectType setting - resetting effect",_this); [true] call FUNC(initEffects); } -] call CBA_Settings_fnc_init; +] call CBA_fnc_addSetting; + +[ + QGVAR(bloodVolumeEffectType), + "LIST", + [LSTRING(BloodVolumeEffectType_DisplayName), LSTRING(BloodVolumeEffectType_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory)], + [ + [FX_BLOODVOLUME_COLOR_CORRECTION, FX_BLOODVOLUME_ICON, FX_BLOODVOLUME_BOTH], + [LSTRING(BloodVolumeEffectType_colorCorrection), LSTRING(BloodVolumeEffectType_icon), LSTRING(BloodVolumeEffectType_both)], + 0 + ], + false, + { + if (isNil QGVAR(showBloodVolumeIcon)) exitWith { + TRACE_1("bloodVolumeEffect setting - before postInit",_this); + }; + + TRACE_1("bloodVolumeEffect setting - resetting effect",_this); + [true] call FUNC(initEffects); + } +] call CBA_fnc_addSetting; diff --git a/addons/medical_feedback/script_component.hpp b/addons/medical_feedback/script_component.hpp index 78d72ed3da..54127b6619 100644 --- a/addons/medical_feedback/script_component.hpp +++ b/addons/medical_feedback/script_component.hpp @@ -14,6 +14,7 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_MEDICAL_FEEDBACK #endif +#include "\a3\ui_f\hpp\defineCommonGrids.inc" #include "\z\ace\addons\medical_engine\script_macros_medical.hpp" #include "\z\ace\addons\main\script_macros.hpp" @@ -42,3 +43,15 @@ #define FX_PAIN_PULSATING_BLUR 1 #define FX_PAIN_CHROMATIC_ABERRATION 2 #define FX_PAIN_ONLY_BASE 3 + +#define FX_BLOODVOLUME_COLOR_CORRECTION 0 +#define FX_BLOODVOLUME_ICON 1 +#define FX_BLOODVOLUME_BOTH 2 + +#define ICON_BLOODVOLUME_IDX_MIN 0 +#define ICON_BLOODVOLUME_IDX_MAX 6 +#define ICON_BLOODVOLUME_PATH(num) format [QPATHTOF(data\bloodVolume_%1.paa), num] +#define ICON_BLOODVOLUME_COLOR_NONE [0, 0, 0, 0] +#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] diff --git a/addons/medical_feedback/stringtable.xml b/addons/medical_feedback/stringtable.xml index d5177eb699..6947bb7d6b 100644 --- a/addons/medical_feedback/stringtable.xml +++ b/addons/medical_feedback/stringtable.xml @@ -103,6 +103,26 @@ Sadece yüksek ağrı etkisi Nur bei starken Schmerzen + + Low Blood Volume Effect Type + Визуальный эффект низкого объема крови + + + Selects the used low blood volume effect type. + Выбирает тип визуализации эффекта низкого объема крови. + + + Color Fading + Потеря цветности + + + Icon + Иконка + + + Icon + Color Fading + Иконка + Потеря цветности + Enable Screams