Adds Icon option for Low blood volume at Medical Feedback (#7507)

* Adds Icon option for Low blood volume at Medical Feedback

- Adds setting to switch Low blood volume effect with 3 options: Color fading, Icon, Color fading + Icon
- Adds icon to UI on low blood
- Adds icon PAA files

* Review fixes

- Added ACE tags to added controls
- Added defines for GUI position/size
- Added missing newline at EOF
- Updated fnc_effectBloodVolumeIcon (removed usage of uiNamespace and minor changes)
- CBA_fnc_addSetting is now used to init settings
- Icon path macro updated to return formatted path

* Review fixes vol.2

- Removed `disableSerialization` and added default value for indicator control and not null checks to effectBVI function
- Removed defines from RscInGameUI and used a3 defines instead
- Changed formatting of macroses

* Review fixes vol.3

- Fixed exec code of BV setting
- Removed ctrlCommit from eBVI function
- Changed initEffects function to be able to update pain and BV effects only
- Changed control name from `BloodVolumeInfoIndicator` to `bloodVolumeIndicator`
- Various formatting tweaks (spaces/lines/uppercase/periods)

* Review fixed vol.4

- Remove extra checks from eBVI func
- Restores contol's onLoad script using ARR_2(QQGVAR())
This commit is contained in:
10Dozen 2020-02-22 23:42:59 +03:00 committed by GitHub
parent bd040ca19d
commit b30f023c04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 155 additions and 14 deletions

View File

@ -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;
};
};
};

View File

@ -1,5 +1,6 @@
PREP(effectBleeding); PREP(effectBleeding);
PREP(effectBloodVolume); PREP(effectBloodVolume);
PREP(effectBloodVolumeIcon);
PREP(effectHeartBeat); PREP(effectHeartBeat);
PREP(effectIncapacitated); PREP(effectIncapacitated);
PREP(effectPain); PREP(effectPain);

View File

@ -19,3 +19,4 @@ class CfgPatches {
#include "CfgSounds.hpp" #include "CfgSounds.hpp"
#include "CfgVehicles.hpp" #include "CfgVehicles.hpp"
#include "RscTitles.hpp" #include "RscTitles.hpp"
#include "RscInGameUI.hpp"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -18,9 +18,11 @@
params ["_enable", "_intensity"]; params ["_enable", "_intensity"];
if (isNil QGVAR(ppBloodVolume)) exitWith {};
if ((!_enable) || {_intensity == 0}) exitWith { if ((!_enable) || {_intensity == 0}) exitWith {
GVAR(ppBloodVolume) ppEffectEnable false; GVAR(ppBloodVolume) ppEffectEnable false;
}; };
GVAR(ppBloodVolume) ppEffectEnable true; 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) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1 - _intensity], [0.2, 0.2, 0.2, 0]];
GVAR(ppBloodVolume) ppEffectCommit 1; GVAR(ppBloodVolume) ppEffectCommit 1;

View File

@ -0,0 +1,41 @@
#include "script_component.hpp"
/*
* Author: 10Dozen
* Handles the blood volume icon.
*
* Arguments:
* 0: Enable <BOOL>
* 1: Intensity 0...6 <NUMBER>
*
* 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;

View File

@ -21,6 +21,7 @@ if (EGVAR(common,OldIsCamera) || {!alive ACE_player}) exitWith {
[false, 0] call FUNC(effectUnconscious); [false, 0] call FUNC(effectUnconscious);
[false] call FUNC(effectPain); [false] call FUNC(effectPain);
[false] call FUNC(effectBloodVolume); [false] call FUNC(effectBloodVolume);
[false] call FUNC(effectBloodVolumeIcon);
[false] call FUNC(effectBleeding); [false] call FUNC(effectBleeding);
}; };
@ -42,8 +43,17 @@ if ((!GVAR(heartBeatEffectRunning)) && {_heartRate != 0} && {(_heartRate > 160)
// - Visual effects ----------------------------------------------------------- // - Visual effects -----------------------------------------------------------
[_unconscious, 2] call FUNC(effectUnconscious); [_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); ] 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, _pain] call FUNC(effectPain);
[!_unconscious, _bleedingStrength, _manualUpdate] call FUNC(effectBleeding); [!_unconscious, _bleedingStrength, _manualUpdate] call FUNC(effectBleeding);

View File

@ -4,7 +4,7 @@
* Initializes visual effects of medical. * Initializes visual effects of medical.
* *
* Arguments: * Arguments:
* 0: Just Pain Effects <BOOL> * 0: Update pain and low blood volume effects only <BOOL>
* *
* Return Value: * Return Value:
* None * None
@ -15,9 +15,9 @@
* Public: No * Public: No
*/ */
params [["_justPain", false]]; params [["_updateOnly", false]];
TRACE_1("initEffects",_justPain); TRACE_1("initEffects",_updateOnly);
private _fnc_createEffect = { private _fnc_createEffect = {
params ["_type", "_layer", "_default"]; params ["_type", "_layer", "_default"];
@ -68,7 +68,34 @@ if (isNil QGVAR(ppPainBlur)) then {
}; };
TRACE_1("created pain",GVAR(ppPain)); 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 -------------------------------------------------------------- // - Unconscious --------------------------------------------------------------
GVAR(ppUnconsciousBlur) = [ GVAR(ppUnconsciousBlur) = [
@ -83,14 +110,6 @@ GVAR(ppUnconsciousBlackout) = [
[1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
] call _fnc_createEffect; ] 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 ----------------------------------------------------------- // - Incapacitation -----------------------------------------------------------
GVAR(ppIncapacitationGlare) = [ GVAR(ppIncapacitationGlare) = [
"ColorCorrections", "ColorCorrections",

View File

@ -17,4 +17,25 @@
TRACE_1("painEffectType setting - resetting effect",_this); TRACE_1("painEffectType setting - resetting effect",_this);
[true] call FUNC(initEffects); [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;

View File

@ -14,6 +14,7 @@
#define DEBUG_SETTINGS DEBUG_SETTINGS_MEDICAL_FEEDBACK #define DEBUG_SETTINGS DEBUG_SETTINGS_MEDICAL_FEEDBACK
#endif #endif
#include "\a3\ui_f\hpp\defineCommonGrids.inc"
#include "\z\ace\addons\medical_engine\script_macros_medical.hpp" #include "\z\ace\addons\medical_engine\script_macros_medical.hpp"
#include "\z\ace\addons\main\script_macros.hpp" #include "\z\ace\addons\main\script_macros.hpp"
@ -42,3 +43,15 @@
#define FX_PAIN_PULSATING_BLUR 1 #define FX_PAIN_PULSATING_BLUR 1
#define FX_PAIN_CHROMATIC_ABERRATION 2 #define FX_PAIN_CHROMATIC_ABERRATION 2
#define FX_PAIN_ONLY_BASE 3 #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]

View File

@ -103,6 +103,26 @@
<Turkish>Sadece yüksek ağrı etkisi</Turkish> <Turkish>Sadece yüksek ağrı etkisi</Turkish>
<German>Nur bei starken Schmerzen</German> <German>Nur bei starken Schmerzen</German>
</Key> </Key>
<Key ID="STR_ACE_Medical_Feedback_BloodVolumeEffectType_DisplayName">
<English>Low Blood Volume Effect Type</English>
<Russian>Визуальный эффект низкого объема крови</Russian>
</Key>
<Key ID="STR_ACE_Medical_Feedback_BloodVolumeEffectType_Description">
<English>Selects the used low blood volume effect type.</English>
<Russian>Выбирает тип визуализации эффекта низкого объема крови.</Russian>
</Key>
<Key ID="STR_ACE_Medical_Feedback_BloodVolumeEffectType_colorCorrection">
<English>Color Fading</English>
<Russian>Потеря цветности</Russian>
</Key>
<Key ID="STR_ACE_Medical_Feedback_BloodVolumeEffectType_icon">
<English>Icon</English>
<Russian>Иконка</Russian>
</Key>
<Key ID="STR_ACE_Medical_Feedback_BloodVolumeEffectType_both">
<English>Icon + Color Fading</English>
<Russian>Иконка + Потеря цветности</Russian>
</Key>
<Container name="Settings"> <Container name="Settings">
<Key ID="STR_ACE_Medical_Feedback_enableScreams_DisplayName"> <Key ID="STR_ACE_Medical_Feedback_enableScreams_DisplayName">
<English>Enable Screams</English> <English>Enable Screams</English>