2015-01-18 21:50:45 +00:00
|
|
|
#include "script_component.hpp"
|
2015-09-29 14:22:57 +00:00
|
|
|
|
2015-01-18 21:50:45 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
2015-09-29 14:22:57 +00:00
|
|
|
["ACE3 Common", QGVAR(wipeGlasses), localize LSTRING(WipeGlasses), {
|
2015-03-05 07:32:26 +00:00
|
|
|
if (!(GETVAR(ace_player,ACE_isUnconscious,false))) exitWith {
|
|
|
|
call FUNC(clearGlasses);
|
|
|
|
true
|
|
|
|
};
|
|
|
|
false
|
|
|
|
},
|
2015-03-05 08:51:24 +00:00
|
|
|
{false},
|
2015-09-29 14:22:57 +00:00
|
|
|
[20, [true, true, false]], false] call CBA_fnc_addKeybind;
|
|
|
|
|
2015-09-29 20:01:40 +00:00
|
|
|
// make sure to stack effect layers in correct order
|
2015-09-29 20:24:25 +00:00
|
|
|
GVAR(GogglesEffectsLayer) = QGVAR(GogglesEffectsLayer) call BIS_fnc_RSCLayer;
|
|
|
|
GVAR(GogglesLayer) = QGVAR(GogglesLayer) call BIS_fnc_RSCLayer;
|
2015-09-29 14:22:57 +00:00
|
|
|
|
2015-09-29 20:01:40 +00:00
|
|
|
if (isNil QGVAR(UsePP)) then {
|
2015-03-05 07:32:26 +00:00
|
|
|
GVAR(UsePP) = true;
|
2015-01-18 21:50:45 +00:00
|
|
|
};
|
|
|
|
|
2015-09-29 20:01:40 +00:00
|
|
|
// init pp effects
|
|
|
|
GVAR(PostProcess) = ppEffectCreate ["ColorCorrections", 1995];
|
2015-01-18 21:50:45 +00:00
|
|
|
GVAR(PostProcessEyes) = ppEffectCreate ["ColorCorrections", 1992];
|
2015-09-29 20:01:40 +00:00
|
|
|
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [1, 1, 1, 0]];
|
2015-01-18 21:50:45 +00:00
|
|
|
GVAR(PostProcessEyes) ppEffectCommit 0;
|
|
|
|
GVAR(PostProcessEyes) ppEffectEnable false;
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2015-01-18 21:50:45 +00:00
|
|
|
GVAR(EffectsActive) = false;
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2015-01-18 23:38:54 +00:00
|
|
|
SETGLASSES(ace_player,GLASSESDEFAULT);
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2015-01-19 08:34:49 +00:00
|
|
|
GVAR(EyesDamageScript) = -1;
|
2015-09-29 23:26:08 +00:00
|
|
|
GVAR(FrameEvent) = [false, [false, 20]];
|
2015-01-18 21:50:45 +00:00
|
|
|
GVAR(PostProcessEyes_Enabled) = false;
|
2015-01-18 22:57:39 +00:00
|
|
|
GVAR(DustHandler) = -1;
|
2015-01-18 21:50:45 +00:00
|
|
|
GVAR(RainDrops) = objNull;
|
2015-01-18 22:57:39 +00:00
|
|
|
GVAR(RainActive) = false;
|
|
|
|
GVAR(RainLastLevel) = 0;
|
2015-05-28 05:18:45 +00:00
|
|
|
GVAR(surfaceCache) = "";
|
|
|
|
GVAR(surfaceCacheIsDust) = false;
|
2015-01-18 21:50:45 +00:00
|
|
|
|
2015-09-29 20:01:40 +00:00
|
|
|
// init GlassesChanged eventhandler
|
|
|
|
GVAR(OldGlasses) = "#NULLSTRING";
|
|
|
|
|
|
|
|
["playerInventoryChanged", {
|
|
|
|
(_this select 1) params ["", "_currentGlasses"];
|
|
|
|
|
|
|
|
if (GVAR(OldGlasses) != _currentGlasses) then {
|
|
|
|
["GlassesChanged", [ACE_player, _currentGlasses]] call EFUNC(common,localEvent);
|
|
|
|
GVAR(OldGlasses) = _currentGlasses;
|
2015-03-05 07:32:26 +00:00
|
|
|
};
|
2015-09-29 20:01:40 +00:00
|
|
|
}] call EFUNC(common,addEventHandler);
|
|
|
|
|
|
|
|
// add glasses eventhandlers
|
|
|
|
["GlassesChanged", {
|
|
|
|
params ["_unit", "_glasses"];
|
2015-01-18 21:50:45 +00:00
|
|
|
|
2015-09-29 20:01:40 +00:00
|
|
|
SETGLASSES(_unit,GLASSESDEFAULT);
|
2015-01-18 21:50:45 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)};
|
2015-01-18 21:50:45 +00:00
|
|
|
|
2015-09-29 20:01:40 +00:00
|
|
|
if ([_unit] call FUNC(isGogglesVisible)) then {
|
|
|
|
_glasses call FUNC(applyGlassesEffect);
|
2015-03-05 07:32:26 +00:00
|
|
|
} else {
|
|
|
|
call FUNC(removeGlassesEffect);
|
|
|
|
};
|
2015-01-18 22:57:39 +00:00
|
|
|
}] call EFUNC(common,addEventHandler);
|
2015-09-29 20:01:40 +00:00
|
|
|
|
|
|
|
["GlassesCracked", {
|
|
|
|
params ["_unit"];
|
|
|
|
|
|
|
|
_unit setVariable ["ACE_EyesDamaged", true];
|
|
|
|
|
|
|
|
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0.5, 0.5, 0.5, 0.5], [1, 1, 1, 0]];
|
2015-03-05 07:32:26 +00:00
|
|
|
GVAR(PostProcessEyes) ppEffectCommit 0;
|
|
|
|
GVAR(PostProcessEyes) ppEffectEnable true;
|
2015-09-29 20:01:40 +00:00
|
|
|
|
|
|
|
[{
|
|
|
|
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [1, 1, 1, 0]];
|
2015-03-05 07:32:26 +00:00
|
|
|
GVAR(PostProcessEyes) ppEffectCommit 5;
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
GVAR(EyesDamageScript) = [{
|
2015-09-29 20:01:40 +00:00
|
|
|
params ["_unit"];
|
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
GVAR(PostProcessEyes) ppEffectEnable false;
|
2015-09-29 20:01:40 +00:00
|
|
|
|
|
|
|
_unit setVariable ["ACE_EyesDamaged", false];
|
|
|
|
|
|
|
|
}, _this, 5] call EFUNC(common,waitAndExecute);
|
|
|
|
|
|
|
|
}, _unit, 25] call EFUNC(common,waitAndExecute);
|
|
|
|
|
2015-01-18 22:57:39 +00:00
|
|
|
}] call EFUNC(common,addEventHandler);
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2015-09-29 23:26:08 +00:00
|
|
|
// check goggles
|
2015-11-17 16:43:07 +00:00
|
|
|
private _fnc_checkGoggles = {
|
2015-09-29 23:26:08 +00:00
|
|
|
params ["_unit"];
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2015-09-29 23:26:08 +00:00
|
|
|
if (GVAR(EffectsActive)) then {
|
|
|
|
if (call FUNC(externalCamera) || {!([_unit] call FUNC(isGogglesVisible))}) then {
|
|
|
|
call FUNC(removeGlassesEffect);
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
if (!(call FUNC(externalCamera)) && {[_unit] call FUNC(isGogglesVisible)}) then {
|
|
|
|
[goggles _unit] call FUNC(applyGlassesEffect);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2015-09-29 23:26:08 +00:00
|
|
|
["cameraViewChanged", _fnc_checkGoggles] call EFUNC(common,addEventHandler);
|
|
|
|
["activeCameraChanged", _fnc_checkGoggles] call EFUNC(common,addEventHandler);
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2015-09-29 23:26:08 +00:00
|
|
|
// goggles effects main PFH
|
|
|
|
[{
|
2015-12-27 05:31:49 +00:00
|
|
|
BEGIN_COUNTER(goggles);
|
|
|
|
|
2015-09-29 23:26:08 +00:00
|
|
|
// rain
|
|
|
|
call FUNC(applyRainEffect);
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2015-09-29 23:26:08 +00:00
|
|
|
// auto remove effects under water
|
2015-12-27 05:31:49 +00:00
|
|
|
if (GVAR(EffectsActive) && {underwater ACE_player} && {[goggles ACE_player] call FUNC(isDivingGoggles)}) then {
|
2015-09-29 23:26:08 +00:00
|
|
|
call FUNC(removeRainEffect);
|
|
|
|
call FUNC(removeDirtEffect);
|
|
|
|
call FUNC(removeDustEffect);
|
|
|
|
};
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2015-09-29 23:26:08 +00:00
|
|
|
// rotor wash effect
|
2015-12-27 05:31:49 +00:00
|
|
|
call FUNC(applyRotorWashEffect);
|
|
|
|
|
|
|
|
END_COUNTER(goggles);
|
|
|
|
}, 0.5, []] call CBA_fnc_addPerFrameHandler;
|