2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2017-01-17 20:35:53 +00:00
|
|
|
/*
|
|
|
|
* Author: BaerMitUmlaut
|
|
|
|
* Handles the bleeding effect.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Enable effect <BOOL>
|
|
|
|
* 1: Current bloodloss (in l/s) <NUMBER>
|
2019-10-11 20:00:53 +00:00
|
|
|
* 2: Instant change (optional, default false) <BOOL>
|
2017-01-17 20:35:53 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
2019-03-30 16:07:54 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [false, 0.5] call ace_medical_feedback_fnc_effectBleeding
|
|
|
|
*
|
|
|
|
* Public: No
|
2017-01-17 20:35:53 +00:00
|
|
|
*/
|
2018-08-02 14:02:10 +00:00
|
|
|
|
2019-10-11 20:00:53 +00:00
|
|
|
params ["_enable", "_bloodloss", ["_instant", false]];
|
2017-01-17 20:35:53 +00:00
|
|
|
if (isNull findDisplay 46) exitWith {};
|
|
|
|
|
|
|
|
private _controls = uiNamespace getVariable [QGVAR(bloodControls), [controlNull, controlNull]];
|
|
|
|
_controls params ["_blood1", "_blood2"];
|
|
|
|
|
|
|
|
if (!_enable) exitWith {
|
|
|
|
_blood1 ctrlSetFade 1;
|
|
|
|
_blood2 ctrlSetFade 1;
|
|
|
|
|
|
|
|
_blood1 ctrlCommit 0;
|
|
|
|
_blood2 ctrlCommit 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Initialize controls
|
|
|
|
if (isNull _blood1) then {
|
2017-03-18 16:53:57 +00:00
|
|
|
TRACE_1("Creating Blood Controls",_controls);
|
2017-01-17 20:35:53 +00:00
|
|
|
_blood1 = findDisplay 46 ctrlCreate ["RscPicture", -1];
|
|
|
|
_blood2 = findDisplay 46 ctrlCreate ["RscPicture", -1];
|
|
|
|
|
|
|
|
_blood1 ctrlSetText QPATHTOF(data\blood1.paa);
|
|
|
|
_blood2 ctrlSetText QPATHTOF(data\blood2.paa);
|
|
|
|
|
|
|
|
private _pos = [safeZoneXAbs, safeZoneY, safeZoneWAbs, safeZoneH];
|
|
|
|
_blood1 ctrlSetPosition _pos;
|
|
|
|
_blood2 ctrlSetPosition _pos;
|
|
|
|
|
|
|
|
_blood1 ctrlSetFade 1;
|
|
|
|
_blood2 ctrlSetFade 1;
|
|
|
|
|
|
|
|
_blood1 ctrlCommit 0;
|
|
|
|
_blood2 ctrlCommit 0;
|
|
|
|
|
|
|
|
uiNamespace setVariable [QGVAR(bloodControls), [_blood1, _blood2]];
|
|
|
|
};
|
|
|
|
|
|
|
|
private _fade = linearConversion [0, 0.002, _bloodloss, 1, 0, true];
|
|
|
|
|
2019-10-11 20:00:53 +00:00
|
|
|
if (GVAR(bloodTickCounter) == 2 || _instant) then {
|
2017-01-17 20:35:53 +00:00
|
|
|
if (ctrlFade _blood1 > ctrlFade _blood2) then {
|
|
|
|
_blood1 ctrlSetFade _fade;
|
|
|
|
_blood2 ctrlSetFade 1;
|
|
|
|
} else {
|
|
|
|
_blood1 ctrlSetFade 1;
|
|
|
|
_blood2 ctrlSetFade _fade;
|
|
|
|
};
|
|
|
|
|
2019-10-11 20:00:53 +00:00
|
|
|
if (_instant) then {
|
|
|
|
_blood1 ctrlCommit 0.3;
|
|
|
|
_blood2 ctrlCommit 0.3;
|
|
|
|
} else {
|
|
|
|
_blood1 ctrlCommit 3;
|
|
|
|
_blood2 ctrlCommit 3;
|
|
|
|
};
|
2017-01-17 20:35:53 +00:00
|
|
|
|
2019-10-11 20:00:53 +00:00
|
|
|
GVAR(bloodTickCounter) = 0;
|
2017-01-17 20:35:53 +00:00
|
|
|
} else {
|
2019-10-11 20:00:53 +00:00
|
|
|
GVAR(bloodTickCounter) = GVAR(bloodTickCounter) + 1;
|
2017-01-17 20:35:53 +00:00
|
|
|
};
|