diff --git a/addons/goggles/XEH_postInit.sqf b/addons/goggles/XEH_postInit.sqf index 074757f5fc..5861de26aa 100644 --- a/addons/goggles/XEH_postInit.sqf +++ b/addons/goggles/XEH_postInit.sqf @@ -35,7 +35,7 @@ GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [0,0,0,1],[1,1,1,0]]; GVAR(PostProcessEyes) ppEffectCommit 0; GVAR(PostProcessEyes) ppEffectEnable false; GVAR(EffectsActive) = false; -GVAR(Effects) = GLASSESDEFAULT; +SETGLASSES(ace_player,GLASSESDEFAULT); GVAR(Current) = "None"; GVAR(EyesDamageScript) = 0 spawn {}; GVAR(FrameEvent) = [false, [false,20]]; @@ -58,7 +58,9 @@ player addEventHandler ["Explosion", { if (GETBROKEN) exitWith {}; if (((_this select 1) call FUNC(GetExplosionIndex)) < getNumber(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_Resistance")) exitWith {}; if !(ace_player call FUNC(isGogglesVisible)) exitWith {["GlassesCracked",[ace_player]] call EFUNC(common,localEvent);}; - GVAR(Effects) set [BROKEN, true]; + _effects = GETGLASSES(ace_player,GLASSESDEFAULT); + _effects set [BROKEN, true]; + SETGLASSES(ace_player,_effects); if (getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_OverlayCracked") != "" && {cameraOn == ace_player}) then { if (call FUNC(ExternalCamera)) exitWith {}; if (isNull(GLASSDISPLAY)) then { @@ -71,7 +73,7 @@ player addEventHandler ["Explosion", { }]; player addEventHandler ["Killed",{ GVAR(PostProcessEyes) ppEffectEnable false; - GVAR(Effects) = GLASSESDEFAULT; + SETGLASSES(ace_player,GLASSESDEFAULT); call FUNC(removeGlassesEffect); GVAR(EffectsActive)=false; ace_player setVariable ["ACE_EyesDamaged", false]; @@ -84,7 +86,7 @@ player AddEventHandler ["Take",{call FUNC(checkGlasses);}]; player AddEventHandler ["Put", {call FUNC(checkGlasses);}]; ["GlassesChanged",{ - GVAR(Effects) = GLASSESDEFAULT; + SETGLASSES(ace_player,GLASSESDEFAULT); if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)}; diff --git a/addons/goggles/functions/fnc_applyDirtEffect.sqf b/addons/goggles/functions/fnc_applyDirtEffect.sqf index 79e20b66ef..50d7748818 100644 --- a/addons/goggles/functions/fnc_applyDirtEffect.sqf +++ b/addons/goggles/functions/fnc_applyDirtEffect.sqf @@ -19,7 +19,9 @@ if (cameraOn != ace_player || {call FUNC(externalCamera)}) exitWith{false}; private "_dirtImage"; -GVAR(Effects) set [DIRT, true]; +_effects = GETGLASSES(ace_player,GLASSESDEFAULT); +_effects set [DIRT, true]; +SETGLASSES(ace_player,_effects); if (ace_player call FUNC(isGogglesVisible)) then{ _dirtImage = getText(ConfigFile >> "CfgGlasses" >> (goggles ace_player) >> "ACE_OverlayDirt"); diff --git a/addons/goggles/functions/fnc_applyDust.sqf b/addons/goggles/functions/fnc_applyDust.sqf index d8146c0095..62eeed19ab 100644 --- a/addons/goggles/functions/fnc_applyDust.sqf +++ b/addons/goggles/functions/fnc_applyDust.sqf @@ -38,7 +38,6 @@ if (GVAR(DustHandler) != -1) then { // should be fixed in dev CBA }; SETDUST(DBULLETS,0); GVAR(DustHandler) = [{ - EXPLODE_2_PVT(_this select 0,_sleep,_startTime); if (diag_tickTime >= GETDUSTT(DTIME) + 3) then { SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2)); private "_amount"; @@ -48,7 +47,14 @@ GVAR(DustHandler) = [{ GVAR(PostProcessEyes) ppEffectCommit 0.5; }; if (GETDUSTT(DAMOUNT) <= 0) then { - GVAR(PostProcessEyes) ppEffectEnable false; + GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]]; + GVAR(PostProcessEyes) ppEffectCommit 2; + [{ + if (diag_tickTime >= ((_this select 0) select 0)) then { + GVAR(PostProcessEyes) ppEffectEnable false; + [(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler); + }; + },0.5,[diag_tickTime+2]] call CALLSTACK(cba_fnc_addPerFrameHandler); SETDUST(DACTIVE,false); SETDUST(DBULLETS,0); [GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler); diff --git a/addons/goggles/functions/fnc_clearGlasses.sqf b/addons/goggles/functions/fnc_clearGlasses.sqf index 502d0452e7..6d1c77e580 100644 --- a/addons/goggles/functions/fnc_clearGlasses.sqf +++ b/addons/goggles/functions/fnc_clearGlasses.sqf @@ -20,8 +20,9 @@ private "_broken"; _broken = GETBROKEN; -GVAR(Effects) = GLASSESDEFAULT; -GVAR(Effects) set [BROKEN, _broken]; +_effects = GLASSESDEFAULT; +_effects set [BROKEN, _broken]; +SETGLASSES(ace_player,_effects); if ((stance ace_player) != "PRONE") then { ace_player playActionNow "gestureWipeFace"; diff --git a/addons/goggles/script_component.hpp b/addons/goggles/script_component.hpp index 825d6ec63f..711a314160 100644 --- a/addons/goggles/script_component.hpp +++ b/addons/goggles/script_component.hpp @@ -13,16 +13,19 @@ // MACROS #define GLASSESDEFAULT [false,[false,0,0,0],false] +#define GETGLASSES(unit) GETVAR(unit,GVAR(Condition),GLASSESDEFAULT) +#define SETGLASSES(unit,value) SETVAR(unit,GVAR(Condition),value) + #define DIRT 0 #define DUST 1 #define BROKEN 2 -#define GETDIRT (GVAR(Effects) select DIRT) -#define GETDUST (GVAR(Effects) select DUST) -#define GETBROKEN (GVAR(Effects) select BROKEN) -#define GETDUSTT(type) ((GVAR(Effects) select DUST) select type) +#define GETDIRT (GETGLASSES(ace_player) select DIRT) +#define GETDUST (GETGLASSES(ace_player) select DUST) +#define GETBROKEN (GETGLASSES(ace_player) select BROKEN) +#define GETDUSTT(type) ((GETGLASSES(ace_player) select DUST) select type) -#define SETDUST(type,value) (GVAR(Effects) select DUST) set [type,value] +#define SETDUST(type,value) (GETGLASSES(ace_player) select DUST) set [type,value] #define DACTIVE 0 #define DTIME 1