ACE3/addons/medical_feedback/functions/fnc_initEffects.sqf
10Dozen b30f023c04
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())
2020-02-22 14:42:59 -06:00

125 lines
3.2 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: BaerMitUmlaut
* Initializes visual effects of medical.
*
* Arguments:
* 0: Update pain and low blood volume effects only <BOOL>
*
* Return Value:
* None
*
* Example:
* [false] call ace_medical_feedback_fnc_initEffects
*
* Public: No
*/
params [["_updateOnly", false]];
TRACE_1("initEffects",_updateOnly);
private _fnc_createEffect = {
params ["_type", "_layer", "_default"];
private _effect = ppEffectCreate [_type, _layer];
_effect ppEffectForceInNVG true;
_effect ppEffectAdjust _default;
_effect ppEffectCommit 0;
_effect
};
// - Pain ---------------------------------------------------------------------
if (!isNil QGVAR(ppPain)) then {
TRACE_1("delete pain",GVAR(ppPain));
ppEffectDestroy GVAR(ppPain)
};
switch (GVAR(painEffectType)) do {
case FX_PAIN_WHITE_FLASH: {
GVAR(ppPain) = [
"ColorCorrections",
13502,
[1, 1, 0, [1, 1, 1, 0], [1, 1, 1, 1], [0.33, 0.33, 0.33, 0], [0.55, 0.5, 0, 0, 0, 0, 4]]
] call _fnc_createEffect;
};
case FX_PAIN_PULSATING_BLUR: {
GVAR(ppPain) = [
"RadialBlur", // "Will not do anything if RADIAL BLUR is disabled in Video Options."
13502,
[0, 0, 0.25, 0.25]
] call _fnc_createEffect;
};
case FX_PAIN_CHROMATIC_ABERRATION: {
GVAR(ppPain) = [
"ChromAberration",
13502,
[0, 0, false]
] call _fnc_createEffect;
};
};
// Base blur on high pain
if (isNil QGVAR(ppPainBlur)) then {
GVAR(ppPainBlur) = [
"DynamicBlur",
813, // 135xx does not work
[0]
] call _fnc_createEffect;
};
TRACE_1("created pain",GVAR(ppPain));
// - 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) = [
"DynamicBlur",
814, // 135xx does not work
[0]
] call _fnc_createEffect;
GVAR(ppUnconsciousBlackout) = [
"ColorCorrections",
13500,
[1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
] call _fnc_createEffect;
// - Incapacitation -----------------------------------------------------------
GVAR(ppIncapacitationGlare) = [
"ColorCorrections",
13504,
[1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 0]]
] call _fnc_createEffect;
GVAR(ppIncapacitationBlur) = [
"DynamicBlur",
815, // 135xx does not work
[0]
] call _fnc_createEffect;