2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-09-29 17:51:41 +00:00
|
|
|
/*
|
|
|
|
* Author: Garth 'L-H' de Wet
|
|
|
|
* Applies dust to screen.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* call ace_goggles_fnc_applyDustEffect
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (call FUNC(ExternalCamera)) exitWith {};
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _unit = ACE_player;
|
2015-09-29 17:51:41 +00:00
|
|
|
|
|
|
|
if ([_unit] call FUNC(isGogglesVisible)) exitWith {
|
2015-09-29 20:24:25 +00:00
|
|
|
GVAR(GogglesEffectsLayer) cutRsc ["RscACE_GogglesEffects", "PLAIN", 2, false];
|
2015-09-29 17:51:41 +00:00
|
|
|
|
2015-09-29 20:01:40 +00:00
|
|
|
((GETUVAR(GVAR(DisplayEffects),displayNull)) displayCtrl 10662) ctrlSetText format [getText (configFile >> "CfgGlasses" >> goggles _unit >> "ACE_DustPath"), GETDUSTT(DAMOUNT) + 1];
|
2015-09-29 17:51:41 +00:00
|
|
|
|
2016-06-26 00:02:07 +00:00
|
|
|
private _effectBrightness = linearConversion [0,1,([] call EFUNC(common,ambientBrightness)),0.25,1];
|
|
|
|
((GETUVAR(GVAR(DisplayEffects),displayNull)) displayCtrl 10662) ctrlSetTextColor [_effectBrightness, _effectBrightness, _effectBrightness, 1];
|
|
|
|
TRACE_1("dust",_effectBrightness);
|
|
|
|
|
2015-09-29 17:51:41 +00:00
|
|
|
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT) + 1,0,1));
|
|
|
|
SETDUST(DBULLETS,0);
|
|
|
|
};
|
|
|
|
|
|
|
|
if (GETVAR(_unit,ACE_EyesDamaged,false)) exitWith {
|
|
|
|
SETDUST(DACTIVE,false);
|
|
|
|
SETDUST(DBULLETS,0);
|
|
|
|
SETDUST(DAMOUNT,0);
|
|
|
|
};
|
|
|
|
|
|
|
|
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT) + 1,0,2));
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _amount = 1 - (GETDUSTT(DAMOUNT) * 0.125);
|
2015-09-29 17:51:41 +00:00
|
|
|
|
|
|
|
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [_amount, _amount, _amount, _amount], [1, 1, 1, 0]];
|
|
|
|
GVAR(PostProcessEyes) ppEffectCommit 1;
|
|
|
|
GVAR(PostProcessEyes) ppEffectEnable true;
|
|
|
|
|
|
|
|
SETDUST(DBULLETS,0);
|
|
|
|
|
|
|
|
[GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler;
|
|
|
|
GVAR(DustHandler) = -1;
|
|
|
|
|
|
|
|
GVAR(DustHandler) = [{
|
2016-03-02 10:01:39 +00:00
|
|
|
if (diag_tickTime >= GETDUSTT(DTIME) + 3) then {
|
2015-09-29 17:51:41 +00:00
|
|
|
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2));
|
|
|
|
|
2015-11-17 16:43:07 +00:00
|
|
|
private _amount = 1 - (GETDUSTT(DAMOUNT) * 0.125);
|
2015-09-29 17:51:41 +00:00
|
|
|
|
|
|
|
if !(_unit getVariable ["ACE_EyesDamaged", false]) then {
|
|
|
|
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [_amount, _amount, _amount, _amount], [1, 1, 1, 0]];
|
|
|
|
GVAR(PostProcessEyes) ppEffectCommit 0.5;
|
|
|
|
};
|
|
|
|
|
|
|
|
if (GETDUSTT(DAMOUNT) <= 0) then {
|
2015-09-29 23:26:08 +00:00
|
|
|
SETDUST(DACTIVE,false);
|
|
|
|
SETDUST(DBULLETS,0);
|
|
|
|
|
2015-09-29 17:51:41 +00:00
|
|
|
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [1, 1, 1, 0]];
|
|
|
|
GVAR(PostProcessEyes) ppEffectCommit 2;
|
|
|
|
|
2015-09-29 23:26:08 +00:00
|
|
|
[{
|
|
|
|
if (GVAR(DustHandler) == -1) then {
|
|
|
|
GVAR(PostProcessEyes) ppEffectEnable false
|
|
|
|
};
|
2016-05-22 13:27:24 +00:00
|
|
|
}, [], 2] call CBA_fnc_waitAndExecute;
|
2015-09-29 17:51:41 +00:00
|
|
|
|
|
|
|
[GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler;
|
|
|
|
GVAR(DustHandler) = -1;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}, 0, []] call CBA_fnc_addPerFrameHandler;
|