Skip to content

Commit

Permalink
Adds Icon option for Low blood volume at Medical Feedback (#7507)
Browse files Browse the repository at this point in the history
* 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())
  • Loading branch information
10Dozen authored Feb 22, 2020
1 parent bd040ca commit b30f023
Show file tree
Hide file tree
Showing 16 changed files with 155 additions and 14 deletions.
13 changes: 13 additions & 0 deletions addons/medical_feedback/RscInGameUI.hpp
Original file line number Diff line number Diff line change
@@ -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;
};
};
};
1 change: 1 addition & 0 deletions addons/medical_feedback/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PREP(effectBleeding);
PREP(effectBloodVolume);
PREP(effectBloodVolumeIcon);
PREP(effectHeartBeat);
PREP(effectIncapacitated);
PREP(effectPain);
Expand Down
1 change: 1 addition & 0 deletions addons/medical_feedback/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ class CfgPatches {
#include "CfgSounds.hpp"
#include "CfgVehicles.hpp"
#include "RscTitles.hpp"
#include "RscInGameUI.hpp"
Binary file added addons/medical_feedback/data/bloodVolume_1.paa
Binary file not shown.
Binary file added addons/medical_feedback/data/bloodVolume_2.paa
Binary file not shown.
Binary file added addons/medical_feedback/data/bloodVolume_3.paa
Binary file not shown.
Binary file added addons/medical_feedback/data/bloodVolume_4.paa
Binary file not shown.
Binary file added addons/medical_feedback/data/bloodVolume_5.paa
Binary file not shown.
Binary file added addons/medical_feedback/data/bloodVolume_6.paa
Binary file not shown.
2 changes: 2 additions & 0 deletions addons/medical_feedback/functions/fnc_effectBloodVolume.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
41 changes: 41 additions & 0 deletions addons/medical_feedback/functions/fnc_effectBloodVolumeIcon.sqf
Original file line number Diff line number Diff line change
@@ -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;
12 changes: 11 additions & 1 deletion addons/medical_feedback/functions/fnc_handleEffects.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand All @@ -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);
Expand Down
43 changes: 31 additions & 12 deletions addons/medical_feedback/functions/fnc_initEffects.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Initializes visual effects of medical.
*
* Arguments:
* 0: Just Pain Effects <BOOL>
* 0: Update pain and low blood volume effects only <BOOL>
*
* Return Value:
* None
Expand All @@ -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"];
Expand Down Expand Up @@ -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) = [
Expand All @@ -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",
Expand Down
23 changes: 22 additions & 1 deletion addons/medical_feedback/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
13 changes: 13 additions & 0 deletions addons/medical_feedback/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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]
20 changes: 20 additions & 0 deletions addons/medical_feedback/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,26 @@
<Turkish>Sadece yüksek ağrı etkisi</Turkish>
<German>Nur bei starken Schmerzen</German>
</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">
<Key ID="STR_ACE_Medical_Feedback_enableScreams_DisplayName">
<English>Enable Screams</English>
Expand Down

0 comments on commit b30f023

Please sign in to comment.