Add goggles setting for level of effects

Can chose between none, tint/colorCC/ and full dust/dirt/rain/rotorwash
This commit is contained in:
PabstMirror 2016-06-25 19:16:26 -05:00
parent 3aebbdd269
commit 5108ffe20c
8 changed files with 160 additions and 137 deletions

View File

@ -1,11 +1,11 @@
class ACE_Settings { class ACE_Settings {
/*class GVAR(enable) { // @todo class GVAR(effects) {
value = 0; displayName = CSTRING(effects_displayName);
typeName = "BOOL"; typeName = "SCALAR";
isClientSettable = 1; value = 2;
displayName = CSTRING(enable); values[] = {ECSTRING(common,Disabled), CSTRING(effects_tintOnly), CSTRING(enabled_tintAndEffects)};
};*/ };
class GVAR(showInThirdPerson) { class GVAR(showInThirdPerson) {
value = 0; value = 0;
typeName = "BOOL"; typeName = "BOOL";

View File

@ -24,11 +24,3 @@ class Extended_Killed_EventHandlers {
}; };
}; };
}; };
class Extended_Explosion_EventHandlers {
class CAManBase {
class ADDON {
clientExplosion = QUOTE(if (local (_this select 0)) then {_this call FUNC(handleExplosion)});
};
};
};

View File

@ -3,6 +3,7 @@
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
["ACE3 Common", QGVAR(wipeGlasses), localize LSTRING(WipeGlasses), { ["ACE3 Common", QGVAR(wipeGlasses), localize LSTRING(WipeGlasses), {
if (GVAR(effects) != 2) exitWith {false}; //Can only wipe if full effects setting is set
if (!(GETVAR(ace_player,ACE_isUnconscious,false))) exitWith { if (!(GETVAR(ace_player,ACE_isUnconscious,false))) exitWith {
call FUNC(clearGlasses); call FUNC(clearGlasses);
true true
@ -12,6 +13,14 @@ if (!hasInterface) exitWith {};
{false}, {false},
[20, [true, true, false]], false] call CBA_fnc_addKeybind; [20, [true, true, false]], false] call CBA_fnc_addKeybind;
["ace_settingsInitialized", {
TRACE_2("ace_settingsInitialized eh",GVAR(effects),GVAR(showInThirdPerson));
if (GVAR(effects) == 0) exitWith {};
// ---Add the TINT Effect---
// make sure to stack effect layers in correct order // make sure to stack effect layers in correct order
GVAR(GogglesEffectsLayer) = QGVAR(GogglesEffectsLayer) call BIS_fnc_RSCLayer; GVAR(GogglesEffectsLayer) = QGVAR(GogglesEffectsLayer) call BIS_fnc_RSCLayer;
GVAR(GogglesLayer) = QGVAR(GogglesLayer) call BIS_fnc_RSCLayer; GVAR(GogglesLayer) = QGVAR(GogglesLayer) call BIS_fnc_RSCLayer;
@ -20,29 +29,8 @@ if (isNil QGVAR(UsePP)) then {
GVAR(UsePP) = true; GVAR(UsePP) = true;
}; };
// init pp effects
GVAR(PostProcess) = ppEffectCreate ["ColorCorrections", 1995];
GVAR(PostProcessEyes) = ppEffectCreate ["ColorCorrections", 1992];
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;
SETGLASSES(ace_player,GLASSESDEFAULT);
GVAR(FrameEvent) = [false, [false, 20]];
GVAR(PostProcessEyes_Enabled) = false;
GVAR(DustHandler) = -1;
GVAR(RainDrops) = objNull;
GVAR(RainActive) = false;
GVAR(RainLastLevel) = 0;
GVAR(surfaceCache) = "";
GVAR(surfaceCacheIsDust) = false;
// init GlassesChanged eventhandler // init GlassesChanged eventhandler
GVAR(OldGlasses) = "<null>"; GVAR(OldGlasses) = "<null>";
["loadout", { ["loadout", {
params ["_unit"]; params ["_unit"];
@ -54,6 +42,30 @@ GVAR(OldGlasses) = "<null>";
}; };
}] call CBA_fnc_addPlayerEventHandler; }] call CBA_fnc_addPlayerEventHandler;
// init pp effects
GVAR(PostProcess) = ppEffectCreate ["ColorCorrections", 1995];
GVAR(EffectsActive) = false;
// check goggles
private _fnc_checkGoggles = {
params ["_unit"];
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);
};
};
};
["cameraView", _fnc_checkGoggles] call CBA_fnc_addPlayerEventHandler;
["ace_activeCameraChanged", _fnc_checkGoggles] call CBA_fnc_addEventHandler;
// add glasses eventhandlers // add glasses eventhandlers
["ace_glassesChanged", { ["ace_glassesChanged", {
params ["_unit", "_glasses"]; params ["_unit", "_glasses"];
@ -69,6 +81,30 @@ GVAR(OldGlasses) = "<null>";
}; };
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;
// // ---Add the Dust/Dirt/Rain Effects---
if (GVAR(effects) == 2) then {
// Register fire event handler
["ace_firedPlayer", DFUNC(handleFired)] call CBA_fnc_addEventHandler;
//Add Explosion XEH
["CAManBase", "explosion", FUNC(handleExplosion)] call CBA_fnc_addClassEventHandler;
GVAR(PostProcessEyes) = ppEffectCreate ["ColorCorrections", 1992];
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(PostProcessEyes_Enabled) = false;
GVAR(FrameEvent) = [false, [false, 20]];
GVAR(DustHandler) = -1;
GVAR(RainDrops) = objNull;
GVAR(RainActive) = false;
GVAR(RainLastLevel) = 0;
GVAR(surfaceCache) = "";
GVAR(surfaceCacheIsDust) = false;
["ace_glassesCracked", { ["ace_glassesCracked", {
params ["_unit"]; params ["_unit"];
@ -95,24 +131,6 @@ GVAR(OldGlasses) = "<null>";
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;
// check goggles
private _fnc_checkGoggles = {
params ["_unit"];
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);
};
};
};
["cameraView", _fnc_checkGoggles] call CBA_fnc_addPlayerEventHandler;
["ace_activeCameraChanged", _fnc_checkGoggles] call CBA_fnc_addEventHandler;
// goggles effects main PFH // goggles effects main PFH
[{ [{
BEGIN_COUNTER(goggles); BEGIN_COUNTER(goggles);
@ -132,6 +150,5 @@ private _fnc_checkGoggles = {
END_COUNTER(goggles); END_COUNTER(goggles);
}, 0.5, []] call CBA_fnc_addPerFrameHandler; }, 0.5, []] call CBA_fnc_addPerFrameHandler;
};
// Register fire event handler }] call CBA_fnc_addEventHandler;
["ace_firedPlayer", DFUNC(handleFired)] call CBA_fnc_addEventHandler;

View File

@ -46,6 +46,7 @@ if (_imagePath != "") then {
(GLASSDISPLAY displayCtrl 10650) ctrlSetText _imagePath; (GLASSDISPLAY displayCtrl 10650) ctrlSetText _imagePath;
}; };
if (GVAR(effects) == 2) then {
if (GETDIRT) then { if (GETDIRT) then {
call FUNC(applyDirtEffect); call FUNC(applyDirtEffect);
}; };
@ -54,5 +55,6 @@ if (GETDUSTT(DACTIVE)) then {
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2)); SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2));
call FUNC(applyDustEffect); call FUNC(applyDustEffect);
}; };
};
GVAR(EffectsActive) = true; GVAR(EffectsActive) = true;

View File

@ -16,7 +16,7 @@
#include "script_component.hpp" #include "script_component.hpp"
// Handle the ThreeDen Editor Camera // Handle the ThreeDen Editor Camera
if ((!isNil {is3DEN}) && {is3DEN}) exitWith {true}; if (is3DEN) exitWith {true};
if (GVAR(showInThirdPerson)) then { if (GVAR(showInThirdPerson)) then {
cameraView in ["GROUP"] || EFUNC(common,isFeatureCameraActive) cameraView in ["GROUP"] || EFUNC(common,isFeatureCameraActive)

View File

@ -15,14 +15,14 @@
params ["_unit"]; params ["_unit"];
if (_unit != ACE_player) exitWith {true}; if (_unit != ACE_player) exitWith {true};
if (GVAR(effects) == 0) exitWith {true};
GVAR(PostProcessEyes) ppEffectEnable false;
SETGLASSES(_unit,GLASSESDEFAULT);
call FUNC(removeGlassesEffect); call FUNC(removeGlassesEffect);
GVAR(EffectsActive) = false; if (GVAR(effects) == 2) then {
GVAR(PostProcessEyes) ppEffectEnable false;
SETGLASSES(_unit,GLASSESDEFAULT);
_unit setVariable ["ACE_EyesDamaged", false]; _unit setVariable ["ACE_EyesDamaged", false];
@ -30,5 +30,6 @@ if (GVAR(DustHandler) != -1) then {
[GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler; [GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler;
}; };
GVAR(DustHandler) = -1; GVAR(DustHandler) = -1;
};
true true

View File

@ -22,6 +22,8 @@ if (!isNull (GLASSDISPLAY)) then {
GLASSDISPLAY closeDisplay 0; GLASSDISPLAY closeDisplay 0;
}; };
if (GVAR(effects) == 2) then {
call FUNC(removeDirtEffect); call FUNC(removeDirtEffect);
call FUNC(removeRainEffect); call FUNC(removeRainEffect);
call FUNC(removeDustEffect); call FUNC(removeDustEffect);
};

View File

@ -25,5 +25,14 @@
<Portuguese>Limpar Óculos</Portuguese> <Portuguese>Limpar Óculos</Portuguese>
<Italian>Pulisci gli occhiali</Italian> <Italian>Pulisci gli occhiali</Italian>
</Key> </Key>
<Key ID="STR_ACE_Goggles_effects_displayName">
<English>Goggle Effects</English>
</Key>
<Key ID="STR_ACE_Goggles_effects_tintOnly">
<English>Tint</English>
</Key>
<Key ID="STR_ACE_Goggles_enabled_tintAndEffects">
<English>Tint + Effects</English>
</Key>
</Package> </Package>
</Project> </Project>