2018-07-30 09:22:14 +00:00
|
|
|
#include "script_component.hpp"
|
2016-12-01 19:54:03 +00:00
|
|
|
/*
|
|
|
|
* Author: BaerMitUmlaut
|
|
|
|
* Triggers the pain effect (single flash).
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Enable <BOOL>
|
|
|
|
* 1: Intensity <NUMBER>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
2019-03-30 16:07:54 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [true, 0.5] call ace_medical_feedback_fnc_effectPain
|
|
|
|
*
|
|
|
|
* Public: No
|
2016-12-01 19:54:03 +00:00
|
|
|
*/
|
2018-08-02 14:02:10 +00:00
|
|
|
|
2016-12-01 19:54:03 +00:00
|
|
|
params ["_enable", "_intensity"];
|
|
|
|
|
2017-02-19 04:11:40 +00:00
|
|
|
if (!_enable || {_intensity == 0}) exitWith {
|
2016-12-01 19:54:03 +00:00
|
|
|
GVAR(ppPain) ppEffectEnable false;
|
2019-10-11 20:00:53 +00:00
|
|
|
GVAR(ppPainBlur) ppEffectEnable false;
|
2016-12-01 19:54:03 +00:00
|
|
|
};
|
|
|
|
GVAR(ppPain) ppEffectEnable true;
|
2019-10-11 20:00:53 +00:00
|
|
|
GVAR(ppPainBlur) ppEffectEnable true;
|
2016-12-01 19:54:03 +00:00
|
|
|
|
2016-12-09 18:15:44 +00:00
|
|
|
// Trigger effect every 2s
|
2017-01-17 20:35:12 +00:00
|
|
|
private _showNextTick = missionNamespace getVariable [QGVAR(showPainNextTick), true];
|
|
|
|
GVAR(showPainNextTick) = !_showNextTick;
|
2016-12-09 18:15:44 +00:00
|
|
|
if (_showNextTick) exitWith {};
|
|
|
|
|
2019-10-11 20:00:53 +00:00
|
|
|
private _blurIntensity = linearConversion [0.8, 1, _intensity, 0, 1, true];
|
|
|
|
GVAR(ppPainBlur) ppEffectAdjust [_blurIntensity];
|
|
|
|
GVAR(ppPainBlur) ppEffectCommit 0.1;
|
|
|
|
|
|
|
|
if (GVAR(painEffectType) == FX_PAIN_ONLY_BASE) exitWith {};
|
|
|
|
|
2016-12-01 19:54:03 +00:00
|
|
|
private _initialAdjust = [];
|
|
|
|
private _delayedAdjust = [];
|
|
|
|
|
2019-10-11 20:00:53 +00:00
|
|
|
switch (GVAR(painEffectType)) do {
|
|
|
|
case FX_PAIN_WHITE_FLASH: {
|
|
|
|
_intensity = linearConversion [0, 1, _intensity, 0, 0.6, true];
|
|
|
|
_initialAdjust = [1, 1, 0, [1, 1, 1, _intensity ], [1, 1, 1, 1], [0.33, 0.33, 0.33, 0], [0.55, 0.5, 0, 0, 0, 0, 4]];
|
|
|
|
_delayedAdjust = [1, 1, 0, [1, 1, 1, _intensity * 0.3], [1, 1, 1, 1], [0.33, 0.33, 0.33, 0], [0.55, 0.5, 0, 0, 0, 0, 4]];
|
|
|
|
};
|
|
|
|
case FX_PAIN_PULSATING_BLUR: {
|
|
|
|
_intensity = linearConversion [0, 1, _intensity, 0, 0.008, true];
|
|
|
|
_initialAdjust = [_intensity , _intensity , 0.15, 0.15];
|
|
|
|
_delayedAdjust = [_intensity * 0.2, _intensity * 0.2, 0.25, 0.25];
|
|
|
|
};
|
|
|
|
case FX_PAIN_CHROMATIC_ABERRATION: {
|
|
|
|
_intensity = linearConversion [0, 1, _intensity, 0, 0.06, true];
|
|
|
|
_initialAdjust = [_intensity , _intensity , true];
|
|
|
|
_delayedAdjust = [_intensity * 0.15, _intensity * 0.15, true];
|
|
|
|
};
|
2016-12-01 19:54:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GVAR(ppPain) ppEffectAdjust _initialAdjust;
|
2016-12-09 18:15:44 +00:00
|
|
|
GVAR(ppPain) ppEffectCommit FX_PAIN_FADE_IN;
|
2016-12-01 19:54:03 +00:00
|
|
|
[{
|
2017-02-19 04:11:40 +00:00
|
|
|
params ["_adjust", "_painEffectType"];
|
|
|
|
if (GVAR(painEffectType) != _painEffectType) exitWith {TRACE_1("Effect type changed",_this);};
|
|
|
|
GVAR(ppPain) ppEffectAdjust _adjust;
|
2016-12-09 18:15:44 +00:00
|
|
|
GVAR(ppPain) ppEffectCommit FX_PAIN_FADE_OUT;
|
2017-02-19 04:11:40 +00:00
|
|
|
}, [_delayedAdjust, GVAR(painEffectType)], FX_PAIN_FADE_IN] call CBA_fnc_waitAndExecute;
|