diff --git a/TO_MERGE/agm/Goggles/CfgFunctions.hpp b/TO_MERGE/agm/Goggles/CfgFunctions.hpp deleted file mode 100644 index 4ff3eb37cd..0000000000 --- a/TO_MERGE/agm/Goggles/CfgFunctions.hpp +++ /dev/null @@ -1,25 +0,0 @@ -class CfgFunctions{ - class AGM_Goggles{ - class AGM_Goggles{ - file="AGM_Goggles\functions"; - class Init{postInit = 1;}; - class ApplyGlassesEffect; - class RemoveGlassesEffect; - class ApplyDirtEffect; - class RemoveDirtEffect; - class isGogglesVisible; - class isDivingGoggles; - class ClearGlasses; - class CheckGoggles; - class GetExplosionIndex; - class RainEffect; - class RemoveRainEffect; - class DustHandler; - class ExternalCamera; - class isInRotorWash; - class OnEachFrame; - class ApplyDust; - class RemoveDustEffect; - }; - }; -}; \ No newline at end of file diff --git a/TO_MERGE/agm/Goggles/config.cpp b/TO_MERGE/agm/Goggles/config.cpp deleted file mode 100644 index 8bc8ffa9b5..0000000000 --- a/TO_MERGE/agm/Goggles/config.cpp +++ /dev/null @@ -1,295 +0,0 @@ -#define COLOUR 8.0 -class CfgPatches { - class AGM_Goggles { - units[] = {}; - weapons[] = {}; - requiredVersion = 0.60; - requiredAddons[] = {AGM_Core}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; - author[] = {"Garth 'L-H' de Wet"}; - authorUrl = "https://github.com/CorruptedHeart"; - }; -}; - -#include "CfgFunctions.hpp" -#define COMBAT_GOGGLES AGM_Overlay="AGM_Goggles\textures\HUD\CombatGoggles.paa"; \ - AGM_OverlayCracked = "AGM_Goggles\textures\HUD\CombatGogglesCracked.paa"; \ - AGM_Resistance = 2; \ - AGM_Protection = 1; - -class CfgGlasses { - class None { - AGM_Color[] = {0,0,0}; - AGM_TintAmount=0; - AGM_Overlay = ""; - AGM_OverlayDirt = "A3\Ui_f\data\igui\rsctitles\HealthTextures\dust_upper_ca.paa"; - AGM_OverlayCracked = "AGM_Goggles\textures\HUD\Cracked.paa"; - AGM_Resistance = 0; - AGM_Protection = 0; - AGM_DustPath = "AGM_Goggles\textures\fx\dust\%1.paa"; - }; - - class G_Combat:None { - COMBAT_GOGGLES - }; - - class G_Diving { - AGM_Overlay="AGM_Goggles\textures\HUD\DivingGoggles.paa"; - AGM_OverlayCracked = "AGM_Goggles\textures\HUD\DivingGogglesCracked.paa"; - AGM_Resistance = 2; - AGM_Protection = 1; - }; - - class G_Lowprofile:None { - AGM_TintAmount=COLOUR*2; - AGM_Resistance = 2; - AGM_Protection = 1; - }; - - class G_Shades_Black:None { - AGM_TintAmount=COLOUR*2; - AGM_Resistance = 1; - }; - - class G_Shades_Blue:None{ - AGM_Color[] = {0,0,1}; - AGM_TintAmount=COLOUR; - AGM_Resistance = 1; - }; - - class G_Shades_Green:None{ - AGM_Color[] = {0,1,0}; - AGM_TintAmount=COLOUR; - AGM_Resistance = 1; - }; - - class G_Shades_Red:None{ - AGM_Color[] = {1,0,0}; - AGM_TintAmount=COLOUR; - AGM_Resistance = 1; - }; - - class G_Spectacles:None{ - AGM_TintAmount=COLOUR; - AGM_Resistance = 1; - }; - - class G_Spectacles_Tinted:None{ - AGM_TintAmount=COLOUR*2; - AGM_Resistance = 1; - }; - - class G_Sport_Blackred:None{ - AGM_Color[] = {1,0,0}; - AGM_TintAmount=COLOUR; - AGM_Resistance = 1; - }; - - class G_Sport_BlackWhite:None{ - AGM_Color[] = {0,0,1}; - AGM_TintAmount=COLOUR; - AGM_Resistance = 1; - }; - - class G_Sport_Blackyellow:None{ - AGM_TintAmount=COLOUR*2; - AGM_Resistance = 1; - }; - - class G_Sport_Checkered:None{ - AGM_TintAmount=COLOUR*2; - AGM_Resistance = 1; - }; - - class G_Sport_Greenblack:None{ - AGM_TintAmount=COLOUR*2; - AGM_Resistance = 1; - }; - - class G_Sport_Red:None{ - AGM_TintAmount=COLOUR*2; - AGM_Color[] = {0,0,0}; - AGM_Resistance = 1; - }; - - class G_Squares:None{ - AGM_TintAmount=COLOUR; - AGM_Resistance = 1; - }; - - class G_Squares_Tinted:None{ - AGM_TintAmount=COLOUR; - AGM_Resistance = 1; - }; - - class G_Tactical_Black:None{ - AGM_TintAmount=COLOUR; - AGM_Color[] = {0,0,-1.5}; - AGM_Resistance = 1; - }; - - class G_Tactical_Clear:None{ - AGM_TintAmount=COLOUR; - AGM_Color[] = {0,0,-1}; - AGM_Resistance = 1; - }; - - class G_Aviator:None{ - AGM_Color[] = {0,0,-1}; - AGM_TintAmount=COLOUR; - AGM_Resistance = 1; - }; - - class G_Lady_Blue:None{ - AGM_Color[] = {0,0,1}; - AGM_TintAmount=COLOUR; - AGM_Resistance = 1; - }; - - class G_Lady_Red:None{ - AGM_Color[] = {1,0,0}; - AGM_TintAmount=COLOUR; - AGM_Resistance = 1; - }; - - class G_Lady_Dark:None{ - AGM_TintAmount=COLOUR*2; - AGM_Resistance = 1; - }; - - class G_Lady_Mirror:None{ - AGM_TintAmount=COLOUR; - AGM_Resistance = 1; - }; - - class AV_ESS_blk:None{ - COMBAT_GOGGLES - }; - - class G_Balaclava_blk; - - class G_Balaclava_combat:G_Balaclava_blk { - COMBAT_GOGGLES - }; - - class G_Balaclava_lowprofile:G_Balaclava_blk { - AGM_TintAmount=COLOUR*2; - AGM_Resistance = 2; - AGM_Protection = 1; - }; - - class G_Bandanna_blk; - class G_Bandanna_shades:G_Bandanna_blk { - AGM_TintAmount=COLOUR*2; - AGM_Resistance = 1; - AGM_Protection = 1; - }; - class G_Bandanna_sport:G_Bandanna_blk { - AGM_Color[] = {1,0,0}; - AGM_TintAmount=COLOUR; - AGM_Resistance = 1; - AGM_Protection = 1; - }; - class G_Bandanna_aviator:G_Bandanna_blk { - AGM_Color[] = {0,0,-1}; - AGM_TintAmount=COLOUR; - AGM_Resistance = 1; - AGM_Protection = 1; - }; -}; - -#include "RscTitles.hpp" - -class CfgMovesBasic -{ - class ManActions - { - GestureWipeFace[] = {"GestureWipeFace", "gesture"}; - }; -}; - -class CfgGesturesMale -{ - class States - { - class GestureFreezeStand; - class GestureWipeFace: GestureFreezeStand - { - file = "\AGM_Goggles\anim\WipeGlasses.rtm"; - canPullTrigger = 0; - }; - }; -}; - -class CfgWeapons{ - class H_HelmetB; - - class H_CrewHelmetHeli_B:H_HelmetB { - AGM_Protection = 1; - }; - class H_PilotHelmetHeli_B:H_HelmetB { - AGM_Protection = 1; - }; - class H_PilotHelmetFighter_B:H_HelmetB { - AGM_Protection = 1; - }; -}; - -class RifleAssaultCloud { - AGM_Goggles_BulletCount = 4; -}; -class MachineGunCloud { - AGM_Goggles_BulletCount = 3; -}; -class SniperCloud { - AGM_Goggles_BulletCount = 1; -}; - -class AGM_Core_Default_Keys { - class wipeGlasses { - displayName = $STR_AGM_Goggles_WipeGlasses; - condition = "!(player getVariable['AGM_isUnconscious', false])"; - statement = "call AGM_Goggles_fnc_ClearGlasses;"; - key = 20; // T - shift = 1; - control = 1; - alt = 0; - }; -}; - -class AGM_Core_Options { - class showInThirdPerson { - displayName = $STR_AGM_Goggles_ShowInThirdPerson; - default = 0; - }; -}; - -class CfgCloudlets { - class Default; - class AGMRainEffect:Default { - interval = 0.001; - particleShape = "\A3\data_f\ParticleEffects\Universal\Refract"; - particleFSNtieth = 1; - particleFSIndex = 0; - particleFSFrameCount = 1; - particleFSLoop = 1; - - particleType = "Billboard"; - lifeTime = 0.5; - rotationVelocity = 1; - weight = 100; - volume = 0.000; - rubbing = 1.7; - size[] = {0.1}; - color[] = {{1,1,1,1}}; - animationSpeed[] = {0,1}; - randomDirectionPeriod = 0.2; - randomDirectionIntensity = 1.2; - positionVar[] = {2, 2, 2.5}; - sizeVar = 0.01; - colorVar[] = {0, 0, 0, 0.1}; - destroyOnWaterSurface = 1; - }; -}; diff --git a/TO_MERGE/agm/Goggles/define.hpp b/TO_MERGE/agm/Goggles/define.hpp deleted file mode 100644 index 3e7666bfaa..0000000000 --- a/TO_MERGE/agm/Goggles/define.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// Control types -#define CT_STATIC 0 -#define ST_PICTURE 0x30 - -//////////////// -//Base Classes// -//////////////// - -class RscPicture -{ - access = 0; - idc = -1; - type = CT_STATIC; - style = ST_PICTURE; - colorBackground[] = {0,0,0,0}; - colorText[] = {1,1,1,1}; - font = "puristaMedium"; - sizeEx = 0; - lineSpacing = 0; - fixedWidth = 0; - shadow = 0; - text = ""; - x = safezoneX; - y = safezoneY; - w = safezoneW; - h = safezoneH; -}; diff --git a/TO_MERGE/agm/Goggles/functions/fn_ApplyDirtEffect.sqf b/TO_MERGE/agm/Goggles/functions/fn_ApplyDirtEffect.sqf deleted file mode 100644 index eea86c295e..0000000000 --- a/TO_MERGE/agm/Goggles/functions/fn_ApplyDirtEffect.sqf +++ /dev/null @@ -1,32 +0,0 @@ -/* - Name: AGM_Goggles_fnc_ApplyDirtEffect - - Author: Garth de Wet (LH) - - Description: - Adds dirt effect to the glasses. - - Parameters: - Nothing - - Returns: - BOOLEAN - True if succeeded false if not - - Example: - call AGM_Goggles_fnc_ApplyDirtEffect; -*/ -#include "\AGM_Goggles\script.sqf" - -if (cameraOn != player || call AGM_Goggles_fnc_ExternalCamera) exitWith{false}; -private "_dirtImage"; -AGM_Goggles_Effects set [DIRT, true]; - -if (player call AGM_Goggles_fnc_isGogglesVisible) then{ - _dirtImage = getText(ConfigFile >> "CfgGlasses" >> goggles player >> "AGM_OverlayDirt"); - if (_dirtImage != "") then { - 100 cutRsc["RscAGM_GogglesEffects", "PLAIN",0.1, false]; - (uiNamespace getVariable ["AGM_Goggles_DisplayEffects", displayNull] displayCtrl 10660) ctrlSetText _dirtImage; - }; -}; - -true \ No newline at end of file diff --git a/TO_MERGE/agm/Goggles/functions/fn_ApplyDust.sqf b/TO_MERGE/agm/Goggles/functions/fn_ApplyDust.sqf deleted file mode 100644 index b01408ed7b..0000000000 --- a/TO_MERGE/agm/Goggles/functions/fn_ApplyDust.sqf +++ /dev/null @@ -1,69 +0,0 @@ -/* - Name: AGM_Goggles_fnc_ApplyDust - - Author: Garth de Wet (LH) - - Description: - Applies dust to screen. - - Parameters: - Nothing - - Returns: - Nothing - - Example 1: - call AGM_Goggles_fnc_ApplyDust; -*/ -#include "\AGM_Goggles\script.sqf" -if (call AGM_Goggles_fnc_ExternalCamera) exitWith {}; -if (player call AGM_Goggles_fnc_isGogglesVisible) exitWith { - 100 cutRsc["RscAGM_GogglesEffects", "PLAIN",2,false]; - (uiNamespace getVariable ["AGM_Goggles_DisplayEffects", displayNull] displayCtrl 10662) ctrlSetText format[getText(ConfigFile >> "CfgGlasses" >> AGM_Goggles_Current >> "AGM_DustPath"), GETDUSTT(DAMOUNT)+1]; - SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)+1,0,1)); - SETDUST(DBULLETS,0); -}; - -if (player getVariable ["AGM_EyesDamaged", false]) exitWith {SETDUST(DACTIVE,false);SETDUST(DBULLETS,0);SETDUST(DAMOUNT,0);}; -SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)+1,0,2)); - -private "_amount"; -_amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); - -AGM_Goggles_PostProcessEyes ppEffectAdjust[1, 1, 0, [0,0,0,0], [_amount,_amount,_amount,_amount],[1,1,1,0]]; -AGM_Goggles_PostProcessEyes ppEffectCommit 1; -AGM_Goggles_PostProcessEyes ppEffectEnable true; -if !(scriptDone AGM_Goggles_DustHandler) then { - terminate AGM_Goggles_DustHandler; -}; -SETDUST(DBULLETS,0); -AGM_Goggles_DustHandler = [3] spawn { - private ["_loop", "_timeToSleep"]; - _timeToSleep = _this select 0; - _loop = true; - while {_loop} do { - sleep _timeToSleep; - _timeToSleep = GETDUSTT(DTIME); - - if(_timeToSleep >= (time - 2.5)) then { - _timeToSleep = time - _timeToSleep; - } else { - SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2)); - private "_amount"; - _amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); - if !(player getVariable ["AGM_EyesDamaged", false]) then { - AGM_Goggles_PostProcessEyes ppEffectAdjust[1, 1, 0, [0,0,0,0], [_amount,_amount,_amount,_amount],[1,1,1,0]]; - AGM_Goggles_PostProcessEyes ppEffectCommit 1; - sleep 1; - }; - if (GETDUSTT(DAMOUNT) <= 0) then { - AGM_Goggles_PostProcessEyes ppEffectEnable false; - SETDUST(DACTIVE,false); - SETDUST(DBULLETS,0); - _loop = false; - }; - SETDUST(DTIME,time); - _timeToSleep = 3; - }; - }; -}; \ No newline at end of file diff --git a/TO_MERGE/agm/Goggles/functions/fn_CheckGoggles.sqf b/TO_MERGE/agm/Goggles/functions/fn_CheckGoggles.sqf deleted file mode 100644 index e03bbc6069..0000000000 --- a/TO_MERGE/agm/Goggles/functions/fn_CheckGoggles.sqf +++ /dev/null @@ -1,52 +0,0 @@ -/* - Author: Garth de Wet (LH) - - Description: - Performs rain checks and checks to see whether glasses effects have been applied or not. - Checks for external camera and removes effects. - - Parameters: - Nothing - - Returns: - Nothing - - Example: - [] execVM "AGM_Goggles\functions\fn_CheckGoggles.sqf"; -*/ -#include "\AGM_Goggles\script.sqf" -waitUntil {sleep 0.46;alive player}; -call AGM_Goggles_fnc_CheckGlasses; -["AGM_Goggles_RotorWash", "OnEachFrame", {call AGM_Goggles_fnc_OnEachFrame;}] call BIS_fnc_addStackedEventHandler; -[] spawn AGM_Goggles_fnc_RainEffect; -while {alive player} do { - sleep 1; - if (true) then { - // Detect if curator interface is open and disable effects - if (!isNull(findDisplay 312)) exitWith { - if (AGM_Goggles_EffectsActive) then { - call AGM_Goggles_fnc_RemoveGlassesEffect; - }; - }; - call AGM_Goggles_fnc_CheckGlasses; - if !(player call AGM_Goggles_fnc_isGogglesVisible) exitWith { - if (AGM_Goggles_EffectsActive) then { - call AGM_Goggles_fnc_RemoveGlassesEffect; - }; - }; - if (call AGM_Goggles_fnc_ExternalCamera) exitWith { - if (AGM_Goggles_EffectsActive) then { - call AGM_Goggles_fnc_RemoveGlassesEffect; - }; - }; - if !(AGM_Goggles_EffectsActive) then { - (goggles player) call AGM_Goggles_fnc_ApplyGlassesEffect; - } else { - if ((goggles player) call AGM_Goggles_fnc_isDivingGoggles && {underwater player}) then { - call AGM_Goggles_fnc_RemoveRainEffect; - call AGM_Goggles_fnc_RemoveDirtEffect; - call AGM_Goggles_fnc_RemoveDustEffect; - }; - }; - }; -}; \ No newline at end of file diff --git a/TO_MERGE/agm/Goggles/functions/fn_ClearGlasses.sqf b/TO_MERGE/agm/Goggles/functions/fn_ClearGlasses.sqf deleted file mode 100644 index ab85238818..0000000000 --- a/TO_MERGE/agm/Goggles/functions/fn_ClearGlasses.sqf +++ /dev/null @@ -1,39 +0,0 @@ -/* - Name: AGM_Goggles_fnc_ClearGlasses - - Author: Garth de Wet (LH) - - Description: - Clears all dirt, rain, dust from glasses. - Removes glasses effect (PP, overlay) and then puts it back. - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call AGM_Goggles_fnc_ClearGlasses; -*/ -#include "\AGM_Goggles\script.sqf" - -private "_broken"; -_broken = GETBROKEN; -AGM_Goggles_Effects = GLASSESDEFAULT; -AGM_Goggles_Effects set [BROKEN, _broken]; - -if ((stance player) != "PRONE") then { - player playActionNow "gestureWipeFace"; -}; - -null = [] spawn { - sleep 0.3; - if (cameraView == "INTERNAL") then { - addCamShake [5, 1.75, 2]; - }; -}; - -call AGM_Goggles_fnc_RemoveDirtEffect; -call AGM_Goggles_fnc_RemoveRainEffect; -call AGM_Goggles_fnc_RemoveDustEffect; diff --git a/TO_MERGE/agm/Goggles/functions/fn_GetExplosionIndex.sqf b/TO_MERGE/agm/Goggles/functions/fn_GetExplosionIndex.sqf deleted file mode 100644 index e7ac8b04f6..0000000000 --- a/TO_MERGE/agm/Goggles/functions/fn_GetExplosionIndex.sqf +++ /dev/null @@ -1,28 +0,0 @@ -/* - Name: AGM_Goggles_fnc_GetExplosionIndex - - Author: Garth de Wet (LH) - - Description: - Turns 0-1 damage into a rating system of 0-3 - - Parameters: - 0: NUMBER - The amount of damage - - Returns: - NUMBER (the rating) [0-3] - - Example: - _rating = 0.05 call AGM_Goggles_fnc_GetExplosionIndex -*/ -private ["_effect", "_effectIndex"]; -_effect = _this; - -_effectIndex = switch true do { - case (_effect <= 0.04): {0}; - case (_effect <= 0.06): {1}; - case (_effect <= 0.09): {2}; - default {3}; -}; - -_effectIndex diff --git a/TO_MERGE/agm/Goggles/functions/fn_Init.sqf b/TO_MERGE/agm/Goggles/functions/fn_Init.sqf deleted file mode 100644 index 7a8710c7f7..0000000000 --- a/TO_MERGE/agm/Goggles/functions/fn_Init.sqf +++ /dev/null @@ -1,111 +0,0 @@ -/* - Name: AGM_Goggles_fnc_Init - - Author: Garth de Wet (LH) - - Description: - Sets up the glasses mod for usage. Initialises variables and event handlers. - Shouldn't be called by a user/modder ever. Done by the engine. - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call AGM_Goggles_fnc_Init; -*/ -if (!hasInterface) exitWith {}; -#include "\AGM_Goggles\script.sqf" - -if isNil("AGM_Goggles_UsePP") then { - AGM_Goggles_UsePP = true; -}; - -AGM_Goggles_PostProcess = ppEffectCreate ["ColorCorrections", 1995]; -AGM_Goggles_PostProcessEyes = ppEffectCreate ["ColorCorrections", 1992]; -AGM_Goggles_PostProcessEyes ppEffectAdjust[1, 1, 0, [0,0,0,0], [0,0,0,1],[1,1,1,0]]; -AGM_Goggles_PostProcessEyes ppEffectCommit 0; -AGM_Goggles_PostProcessEyes ppEffectEnable false; -AGM_Goggles_EffectsActive = false; -AGM_Goggles_Effects = GLASSESDEFAULT; -AGM_Goggles_Current = "None"; -AGM_Goggles_EyesDamageScript = 0 spawn {}; -AGM_Goggles_FrameEvent = [false, [false,20]]; -AGM_Goggles_PostProcessEyes_Enabled = false; -AGM_Goggles_DustHandler = 0 spawn {}; -AGM_Goggles_RainDrops = objNull; - -AGM_Goggles_fnc_CheckGlasses = { - if (AGM_Goggles_Current != (goggles player)) then { - AGM_Goggles_Current = (goggles player); - ["GlassesChanged",[AGM_Goggles_Current]] call CBA_fnc_localEvent; - }; -}; - -player addEventHandler ["Explosion", { - if (alive player) then { - call AGM_Goggles_fnc_ApplyDirtEffect; - if (GETBROKEN) exitWith {}; - if (((_this select 1) call AGM_Goggles_fnc_GetExplosionIndex) < getNumber(ConfigFile >> "CfgGlasses" >> AGM_Goggles_Current >> "AGM_Resistance")) exitWith {}; - if !(player call AGM_Goggles_fnc_isGogglesVisible) exitWith {["GlassesCracked",[player]] call CBA_fnc_localEvent;}; - AGM_Goggles_Effects set [BROKEN, true]; - if (getText(ConfigFile >> "CfgGlasses" >> AGM_Goggles_Current >> "AGM_OverlayCracked") != "" && {cameraOn == player}) then { - if (call AGM_Goggles_fnc_ExternalCamera) exitWith {}; - if (isNull(GLASSDISPLAY)) then { - 150 cutRsc["RscAGM_Goggles", "PLAIN",1, false]; - }; - (GLASSDISPLAY displayCtrl 10650) ctrlSetText getText(ConfigFile >> "CfgGlasses" >> AGM_Goggles_Current >> "AGM_OverlayCracked"); - }; - ["GlassesCracked",[player]] call CBA_fnc_localEvent; - }; -}]; -player addEventHandler ["Killed",{ - [] spawn { - sleep 2; - AGM_Goggles_PostProcessEyes ppEffectEnable false; - AGM_Goggles_Effects = GLASSESDEFAULT; - call AGM_Goggles_fnc_RemoveGlassesEffect; - AGM_Goggles_EffectsActive=false; - player setVariable ["AGM_EyesDamaged", false]; - terminate AGM_Goggles_EyesDamageScript; - terminate AGM_Goggles_MainLoop; - terminate AGM_Goggles_DustHandler; - AGM_Goggles_MainLoop = [] spawn AGM_Goggles_fnc_CheckGoggles; - }; -}]; -player addEventHandler ["Fired",{[_this select 0, _this select 1] call AGM_Goggles_fnc_DustHandler;}]; -player AddEventHandler ["Take",{call AGM_Goggles_fnc_CheckGlasses;}]; -player AddEventHandler ["Put", {call AGM_Goggles_fnc_CheckGlasses;}]; - -["GlassesChanged",{ - AGM_Goggles_Effects = GLASSESDEFAULT; - - if (call AGM_Goggles_fnc_ExternalCamera) exitWith {call AGM_Goggles_fnc_RemoveGlassesEffect}; - - if (player call AGM_Goggles_fnc_isGogglesVisible) then { - (_this select 0) call AGM_Goggles_fnc_ApplyGlassesEffect; - } else { - call AGM_Goggles_fnc_RemoveGlassesEffect; - }; -}] call CBA_fnc_addEventHandler; -["GlassesCracked",{ - if (_this select 0 != player) exitWith {}; - player setVariable ["AGM_EyesDamaged", true]; - if !(scriptDone AGM_Goggles_EyesDamageScript) then { - terminate AGM_Goggles_EyesDamageScript; - }; - AGM_Goggles_PostProcessEyes ppEffectAdjust[1, 1, 0, [0,0,0,0], [0.5,0.5,0.5,0.5],[1,1,1,0]]; - AGM_Goggles_PostProcessEyes ppEffectCommit 0; - AGM_Goggles_PostProcessEyes ppEffectEnable true; - AGM_Goggles_EyesDamageScript = [] spawn { - sleep 25; - AGM_Goggles_PostProcessEyes ppEffectAdjust[1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]]; - AGM_Goggles_PostProcessEyes ppEffectCommit 5; - sleep 5; - AGM_Goggles_PostProcessEyes ppEffectEnable false; - player setVariable ["AGM_EyesDamaged", false]; - }; -}] call CBA_fnc_addEventHandler; -AGM_Goggles_MainLoop = [] spawn AGM_Goggles_fnc_CheckGoggles; diff --git a/TO_MERGE/agm/Goggles/functions/fn_OnEachFrame.sqf b/TO_MERGE/agm/Goggles/functions/fn_OnEachFrame.sqf deleted file mode 100644 index 660c3d7afa..0000000000 --- a/TO_MERGE/agm/Goggles/functions/fn_OnEachFrame.sqf +++ /dev/null @@ -1,80 +0,0 @@ -/* - Name: AGM_Goggles_fnc_OnEachFrame - - Author: Garth de Wet (LH) - - Description: - Runs every frame checking for helicopters. - - Parameters: - Nothing - - Returns: - Nothing - - Example: - ["AGM_Goggles_RotorWash", "OnEachFrame", "call AGM_Goggles_fnc_OnEachFrame;"] call BIS_fnc_addStackedEventHandler; -*/ -#include "\AGM_Goggles\script.sqf" -if (isNull(player)) then { - ["AGM_Goggles_RotorWash", "OnEachFrame"] call BIS_fnc_removeStackedEventHandler; -}; -AGM_Goggles_FrameEvent set [0, !(AGM_Goggles_FrameEvent select 0)]; -if (AGM_Goggles_FrameEvent select 0) exitWith { - if (vehicle player != player && {!([player] call AGM_Core_fnc_isTurnedOut)}) exitWith {(AGM_Goggles_FrameEvent select 1) set [0, false]; }; - AGM_Goggles_FrameEvent set [1, ([player] call AGM_Goggles_fnc_isInRotorWash)]; -}; -private ["_rotorWash","_safe"]; -_rotorWash = AGM_Goggles_FrameEvent select 1; -_safe = false; -if !(_rotorWash select 0) exitWith { - if (AGM_Goggles_PostProcessEyes_Enabled) then { - AGM_Goggles_PostProcessEyes_Enabled = false; - if (!scriptDone (AGM_Goggles_DustHandler)) then { - terminate AGM_Goggles_DustHandler; - }; - AGM_Goggles_DustHandler = [] spawn { - AGM_Goggles_PostProcessEyes ppEffectAdjust [1, 1, 0, [0,0,0,0], [0,0,0,1],[1,1,1,0]]; - AGM_Goggles_PostProcessEyes ppEffectCommit 2; - sleep 2; - AGM_Goggles_PostProcessEyes ppEffectEnable false; - }; - }; -}; -if ((headgear player) != "") then { - _safe = (getNumber (ConfigFile >> "CfgWeapons" >> (headgear player) >> "AGM_Protection") == 1); -}; -if !(_safe) then { - if !(player call AGM_Goggles_fnc_isGogglesVisible) exitWith{}; - if (GETDUSTT(DAMOUNT) < 2) then { - if (!GETDUSTT(DACTIVE)) then { - SETDUST(DACTIVE,true); - call AGM_Goggles_fnc_ApplyDust; - } else { - if ((_rotorWash select 1) > 0.5) then { - call AGM_Goggles_fnc_ApplyDust; - }; - }; - }; - _safe = (getNumber (ConfigFile >> "CfgGlasses" >> AGM_Goggles_Current >> "AGM_Protection") == 1); -}; -if (_safe) exitWith {}; -if ((_rotorWash select 1) <= 15) then { - private "_scale"; - _scale = 0.7; - if ((_rotorWash select 1) != 0) then { - _scale = CLAMP(0.3*(_rotorWash select 1),0.1,0.3); - } else { - _scale = 0.1; - }; - _scale = 1 - _scale; - if (!scriptDone (AGM_Goggles_DustHandler)) then { - terminate AGM_Goggles_DustHandler; - }; - if !(player getVariable ["AGM_EyesDamaged", false]) then { - AGM_Goggles_PostProcessEyes_Enabled = true; - AGM_Goggles_PostProcessEyes ppEffectAdjust [1, 1, 0, [0,0,0,0], [_scale,_scale,_scale,_scale],[1,1,1,0]]; - AGM_Goggles_PostProcessEyes ppEffectCommit 0.5; - AGM_Goggles_PostProcessEyes ppEffectEnable true; - }; -}; diff --git a/TO_MERGE/agm/Goggles/functions/fn_RainEffect.sqf b/TO_MERGE/agm/Goggles/functions/fn_RainEffect.sqf deleted file mode 100644 index a52862a20e..0000000000 --- a/TO_MERGE/agm/Goggles/functions/fn_RainEffect.sqf +++ /dev/null @@ -1,61 +0,0 @@ -/* - Name: AGM_Goggles_fnc_RainEffect - - Author: Garth de Wet (LH) - - Description: - - - Parameters: - Nothing - - Returns: - Nothing - - Example: - [] spawn AGM_Goggles_fnc_RainEffect; -*/ -#include "\AGM_Goggles\script.sqf" -AGM_Goggles_RainDrops = objNull; -AGM_Goggles_Rain_Active = false; -_fnc_underCover = { - private ["_pos", "_unit"]; - _unit = (_this select 0); - if (vehicle _unit != _unit && {!([_unit] call AGM_Core_fnc_isTurnedOut)}) exitWith {true}; - _pos = eyePos _unit; - ((positionCameraToWorld [0,0,1] select 2) < ((positionCameraToWorld [0,0,0] select 2) - 0.4)) || {(lineIntersects [_pos, _pos vectorAdd [0,0,15], _unit])} -}; -private ["_lastRain"]; -_lastRain = 0; -while {alive player} do { - sleep 0.5; - if (isNull(findDisplay 312)) then { - // Ignore if player is under water - if (!AGM_Goggles_EffectsActive || {underwater player}) exitWith{call AGM_Goggles_fnc_RemoveRainEffect;}; - if (_lastRain != rain) then { - call AGM_Goggles_fnc_RemoveRainEffect; - _lastRain = rain; - // Rain is happening - if (_lastRain > 0.05 && {!([player] call _fnc_underCover)}) then { - AGM_Goggles_Rain_Active = true; - AGM_Goggles_RainDrops = "#particlesource" createVehicleLocal GetPos player; - AGM_Goggles_RainDrops setParticleClass "AGMRainEffect"; - AGM_Goggles_RainDrops setDropInterval (0.07 * (1.1 - _lastRain)); - AGM_Goggles_RainDrops attachTo [vehicle player,[0,0,0]]; - }; - }else{ - if (_lastRain > 0.05) then { - if (AGM_Goggles_Rain_Active && {[player] call _fnc_underCover}) exitWith { - call AGM_Goggles_fnc_RemoveRainEffect; - }; - if (!AGM_Goggles_Rain_Active) then { - _lastRain = -1; - }; - }; - }; - }else{ - if (AGM_Goggles_Rain_Active) then { - call AGM_Goggles_fnc_RemoveRainEffect; - }; - }; -}; \ No newline at end of file diff --git a/TO_MERGE/agm/Goggles/functions/fn_RemoveDirtEffect.sqf b/TO_MERGE/agm/Goggles/functions/fn_RemoveDirtEffect.sqf deleted file mode 100644 index 0d63dec827..0000000000 --- a/TO_MERGE/agm/Goggles/functions/fn_RemoveDirtEffect.sqf +++ /dev/null @@ -1,20 +0,0 @@ -/* - Name: AGM_Goggles_fnc_RemoveDirtEffect - - Author: Garth de Wet (LH) - - Description: - Removes dirt from the glasses. - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call AGM_Goggles_fnc_RemoveDirtEffect; -*/ -if (!isNull(uiNamespace getVariable ["AGM_Goggles_DisplayEffects", displayNull])) then { - (uiNamespace getVariable ["AGM_Goggles_DisplayEffects", displayNull] displayCtrl 10660) ctrlSetText ""; -}; diff --git a/TO_MERGE/agm/Goggles/functions/fn_RemoveDustEffect.sqf b/TO_MERGE/agm/Goggles/functions/fn_RemoveDustEffect.sqf deleted file mode 100644 index a895583e02..0000000000 --- a/TO_MERGE/agm/Goggles/functions/fn_RemoveDustEffect.sqf +++ /dev/null @@ -1,20 +0,0 @@ -/* - Name: AGM_Goggles_fnc_RemoveDustEffect - - Author: Garth de Wet (LH) - - Description: - Removes dust from the glasses. - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call AGM_Goggles_fnc_RemoveDustEffect; -*/ -if (!isNull(uiNamespace getVariable ["AGM_Goggles_DisplayEffects", displayNull])) then { - (uiNamespace getVariable ["AGM_Goggles_DisplayEffects", displayNull] displayCtrl 10662) ctrlSetText ""; -}; diff --git a/TO_MERGE/agm/Goggles/functions/fn_RemoveGlassesEffect.sqf b/TO_MERGE/agm/Goggles/functions/fn_RemoveGlassesEffect.sqf deleted file mode 100644 index b80f79a028..0000000000 --- a/TO_MERGE/agm/Goggles/functions/fn_RemoveGlassesEffect.sqf +++ /dev/null @@ -1,29 +0,0 @@ -/* - Name: AGM_Goggles_fnc_RemoveGlassesEffect - - Author: Garth de Wet (LH) - - Description: - Removes the glasses effect from the screen, removes dirt effect, removes rain effect, - removes dust effect. Does not reset array (glasses will still be broken, dirty, ect.) - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call AGM_Goggles_fnc_RemoveGlassesEffect; -*/ -#include "\AGM_Goggles\script.sqf" -AGM_Goggles_EffectsActive = false; -AGM_Goggles_PostProcess ppEffectEnable false; - -if (!isNull(GLASSDISPLAY)) then { - GLASSDISPLAY closeDisplay 0; -}; - -call AGM_Goggles_fnc_RemoveDirtEffect; -call AGM_Goggles_fnc_RemoveRainEffect; -call AGM_Goggles_fnc_RemoveDustEffect; diff --git a/TO_MERGE/agm/Goggles/functions/fn_RemoveRainEffect.sqf b/TO_MERGE/agm/Goggles/functions/fn_RemoveRainEffect.sqf deleted file mode 100644 index a3e3629bb1..0000000000 --- a/TO_MERGE/agm/Goggles/functions/fn_RemoveRainEffect.sqf +++ /dev/null @@ -1,21 +0,0 @@ -/* - Name: AGM_Goggles_fnc_RemoveRainEffect - - Author: Garth de Wet (LH) - - Description: - Removes rain effects from the screen. Resets the rain array. - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call AGM_Goggles_fnc_RemoveRainEffect; -*/ -if (!isNull (AGM_Goggles_RainDrops)) then { - deleteVehicle (AGM_Goggles_RainDrops); -}; -AGM_Goggles_Rain_Active = false; \ No newline at end of file diff --git a/TO_MERGE/agm/Goggles/script.sqf b/TO_MERGE/agm/Goggles/script.sqf deleted file mode 100644 index 92f681915e..0000000000 --- a/TO_MERGE/agm/Goggles/script.sqf +++ /dev/null @@ -1,21 +0,0 @@ -#define GLASSESDEFAULT [false,[false,0,0,0],false] - -#define DIRT 0 -#define DUST 1 -#define BROKEN 2 - -#define GETDIRT (AGM_Goggles_Effects select DIRT) -#define GETDUST (AGM_Goggles_Effects select DUST) -#define GETBROKEN (AGM_Goggles_Effects select BROKEN) -#define GETDUSTT(type) ((AGM_Goggles_Effects select DUST) select type) - -#define SETDUST(type,value) (AGM_Goggles_Effects select DUST) set [type, value] - -#define DACTIVE 0 -#define DTIME 1 -#define DBULLETS 2 -#define DAMOUNT 3 - -#define GLASSDISPLAY (uiNamespace getVariable ["AGM_Goggles_Display", displayNull]) - -#define CLAMP(x,low,high) (if(x > high)then{high}else{if(x < low)then{low}else{x}}) diff --git a/addons/fcs/XEH_preInit.sqf b/addons/fcs/XEH_preInit.sqf index ce6f5c99dd..18729ca54f 100644 --- a/addons/fcs/XEH_preInit.sqf +++ b/addons/fcs/XEH_preInit.sqf @@ -1,5 +1,7 @@ #include "script_component.hpp" +ADDON = false; + PREP(adjustRange); PREP(canResetFCS); PREP(canUseFCS); @@ -11,3 +13,5 @@ PREP(keyDown); PREP(keyUp); PREP(reset); PREP(vehicleInit); + +ADDON = true; diff --git a/addons/goggles/$PBOPREFIX$ b/addons/goggles/$PBOPREFIX$ new file mode 100644 index 0000000000..877aa261c5 --- /dev/null +++ b/addons/goggles/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\goggles diff --git a/addons/goggles/CfgEventHandlers.hpp b/addons/goggles/CfgEventHandlers.hpp new file mode 100644 index 0000000000..8c7edda20f --- /dev/null +++ b/addons/goggles/CfgEventHandlers.hpp @@ -0,0 +1,10 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; diff --git a/TO_MERGE/agm/Goggles/RscTitles.hpp b/addons/goggles/RscTitles.hpp similarity index 50% rename from TO_MERGE/agm/Goggles/RscTitles.hpp rename to addons/goggles/RscTitles.hpp index 15a83a71ce..57975e052f 100644 --- a/TO_MERGE/agm/Goggles/RscTitles.hpp +++ b/addons/goggles/RscTitles.hpp @@ -1,21 +1,21 @@ class RscTitles{ #include "define.hpp" - class RscAGM_Goggles_BaseTitle{ + class RscACE_Goggles_BaseTitle{ idd = -1; - onLoad = "uiNamespace setVariable ['AGM_Goggles_Display', _this select 0]"; - onUnload = "uiNamespace setVariable ['AGM_Goggles_Display', displayNull]"; + onLoad = "uiNamespace setVariable ['ACE_Goggles_Display', _this select 0]"; + onUnload = "uiNamespace setVariable ['ACE_Goggles_Display', displayNull]"; fadeIn=0.5; fadeOut=0.5; movingEnable = false; duration = 10e10; - name = "RscAGM_Goggles_BaseTitle"; + name = "RscACE_Goggles_BaseTitle"; class controls; }; - class RscAGM_Goggles:RscAGM_Goggles_BaseTitle{ + class RscACE_Goggles:RscACE_Goggles_BaseTitle{ idd = 1044; - name = "RscAGM_Goggles"; + name = "RscACE_Goggles"; class controls{ class gogglesImage: RscPicture{ idc = 10650; @@ -23,11 +23,11 @@ class RscTitles{ }; }; - class RscAGM_GogglesEffects:RscAGM_Goggles_BaseTitle{ + class RscACE_GogglesEffects:RscACE_Goggles_BaseTitle{ idd = 1045; - onLoad = "uiNamespace setVariable ['AGM_Goggles_DisplayEffects', _this select 0]"; - onUnload = "uiNamespace setVariable ['AGM_Goggles_DisplayEffects', displayNull]"; - name = "RscAGM_GogglesEffects"; + onLoad = "uiNamespace setVariable ['ACE_Goggles_DisplayEffects', _this select 0]"; + onUnload = "uiNamespace setVariable ['ACE_Goggles_DisplayEffects', displayNull]"; + name = "RscACE_GogglesEffects"; fadeIn=0; fadeOut=0.5; class controls{ diff --git a/addons/goggles/XEH_postInit.sqf b/addons/goggles/XEH_postInit.sqf new file mode 100644 index 0000000000..a7c40bb4b5 --- /dev/null +++ b/addons/goggles/XEH_postInit.sqf @@ -0,0 +1,125 @@ +/* + Name: XEH_postInit.sqf + + Author: Garth de Wet (LH) + + Description: + Sets up the glasses mod for usage. Initialises variables and event handlers. + Shouldn't be called by a user/modder ever. Done by the engine. + + Parameters: + Nothing + + Returns: + Nothing +*/ +#include "script_component.hpp" +if (!hasInterface) exitWith {}; + +["ACE3", localize "STR_ACE_Goggles_WipeGlasses", +{ + if (!(GETVAR(ace_player,ACE_isUnconscious,false))) exitWith { + call FUNC(clearGlasses); + true + }; + false +}, [20, true, true, false], false, "keydown"] call CALLSTACK(cba_fnc_registerKeybind); + +if isNil(QGVAR(UsePP)) then { + GVAR(UsePP) = true; +}; + +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(Current) = "None"; +GVAR(EyesDamageScript) = -1; +GVAR(FrameEvent) = [false, [false,20]]; +GVAR(PostProcessEyes_Enabled) = false; +GVAR(DustHandler) = -1; +GVAR(RainDrops) = objNull; +GVAR(RainActive) = false; +GVAR(RainLastLevel) = 0; + +FUNC(CheckGlasses) = { + if (GVAR(Current) != (goggles ace_player)) then { + GVAR(Current) = (goggles ace_player); + ["GlassesChanged",[GVAR(Current)]] call EFUNC(common,localEvent); + }; +}; + +player addEventHandler ["Explosion", { + if (alive ace_player) then { + call FUNC(ApplyDirtEffect); + 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);}; + _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 { + 150 cutRsc["RscACE_Goggles", "PLAIN",1, false]; + }; + (GLASSDISPLAY displayCtrl 10650) ctrlSetText getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_OverlayCracked"); + }; + ["GlassesCracked",[ace_player]] call EFUNC(common,localEvent); + }; +}]; +player addEventHandler ["Killed",{ + GVAR(PostProcessEyes) ppEffectEnable false; + SETGLASSES(ace_player,GLASSESDEFAULT); + call FUNC(removeGlassesEffect); + GVAR(EffectsActive)=false; + ace_player setVariable ["ACE_EyesDamaged", false]; + if (GVAR(EyesDamageScript) != -1) then { + [GVAR(EyesDamageScript)] call CALLSTACK(cba_fnc_removePreFrameHandler); + }; + if (GVAR(DustHandler) != -1) then { + [GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler); + GVAR(DustHandler) = -1; + }; +}]; +player addEventHandler ["Fired",{[_this select 0, _this select 1] call FUNC(dustHandler);}]; +player AddEventHandler ["Take",{call FUNC(checkGlasses);}]; +player AddEventHandler ["Put", {call FUNC(checkGlasses);}]; + +["GlassesChanged",{ + SETGLASSES(ace_player,GLASSESDEFAULT); + + if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)}; + + if (ace_player call FUNC(isGogglesVisible)) then { + (_this select 0) call FUNC(applyGlassesEffect); + } else { + call FUNC(removeGlassesEffect); + }; +}] call EFUNC(common,addEventHandler); +["GlassesCracked",{ + if (_this select 0 != ace_player) exitWith {}; + ace_player setVariable ["ACE_EyesDamaged", true]; + if (GVAR(EyesDamageScript) != -1) then { + [GVAR(EyesDamageScript)] call CALLSTACK(cba_fnc_removePreFrameHandler); + }; + GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [0.5,0.5,0.5,0.5],[1,1,1,0]]; + GVAR(PostProcessEyes) ppEffectCommit 0; + GVAR(PostProcessEyes) ppEffectEnable true; + GVAR(EyesDamageScript) = [{ + GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]]; + GVAR(PostProcessEyes) ppEffectCommit 5; + GVAR(EyesDamageScript) = [{ + GVAR(PostProcessEyes) ppEffectEnable false; + ace_player setVariable ["ACE_EyesDamaged", false]; + GVAR(EyesDamageScript) = -1; + }, [], 5, 1] call EFUNC(common,waitAndExecute); + }, [], 25, 5] call EFUNC(common,waitAndExecute); +}] call EFUNC(common,addEventHandler); +call FUNC(checkGlasses); +[FUNC(CheckGoggles), 1, []] call CBA_fnc_addPerFrameHandler; +[FUNC(rainEffect), 0.5, []] call CBA_fnc_addPerFrameHandler; +[FUNC(onEachFrame), 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/goggles/XEH_preInit.sqf b/addons/goggles/XEH_preInit.sqf new file mode 100644 index 0000000000..c2878f3721 --- /dev/null +++ b/addons/goggles/XEH_preInit.sqf @@ -0,0 +1,23 @@ +#include "script_component.hpp" + +PREP(applyDirtEffect); +PREP(applyDust); +PREP(applyGlassesEffect); + +PREP(checkGoggles); +PREP(clearGlasses); +PREP(dustHandler); +PREP(externalCamera); +PREP(getExplosionIndex); + +PREP(isDivingGoggles); +PREP(isGogglesVisible); +PREP(isInRotorWash); + +PREP(onEachFrame); +PREP(rainEffect); + +PREP(removeDirtEffect); +PREP(removeDustEffect); +PREP(removeGlassesEffect); +PREP(removeRainEffect); diff --git a/TO_MERGE/agm/Goggles/anim/WipeGlasses.rtm b/addons/goggles/anim/WipeGlasses.rtm similarity index 100% rename from TO_MERGE/agm/Goggles/anim/WipeGlasses.rtm rename to addons/goggles/anim/WipeGlasses.rtm diff --git a/TO_MERGE/agm/Goggles/anim/model.cfg b/addons/goggles/anim/model.cfg similarity index 100% rename from TO_MERGE/agm/Goggles/anim/model.cfg rename to addons/goggles/anim/model.cfg diff --git a/addons/goggles/config.cpp b/addons/goggles/config.cpp new file mode 100644 index 0000000000..16bb0f9e0f --- /dev/null +++ b/addons/goggles/config.cpp @@ -0,0 +1,279 @@ +#include "script_component.hpp" + +#define COLOUR 8.0 +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"Garth 'L-H' de Wet"}; + authorUrl = "http://garth.snakebiteink.co.za/"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" + +#define COMBAT_GOGGLES ACE_Overlay = QUOTE(PATHTOF(textures\HUD\CombatGoggles.paa)); \ + ACE_OverlayCracked = QUOTE(PATHTOF(textures\HUD\CombatGogglesCracked.paa)); \ + ACE_Resistance = 2; \ + ACE_Protection = 1; + +class CfgGlasses { + class None { + ACE_Color[] = {0,0,0}; + ACE_TintAmount=0; + ACE_Overlay = ""; + ACE_OverlayDirt = "A3\Ui_f\data\igui\rsctitles\HealthTextures\dust_upper_ca.paa"; + ACE_OverlayCracked = QUOTE(PATHTOF(textures\HUD\Cracked.paa)); + ACE_Resistance = 0; + ACE_Protection = 0; + ACE_DustPath = QUOTE(PATHTOF(textures\fx\dust\%1.paa)); + }; + + class G_Combat:None { + COMBAT_GOGGLES + }; + + class G_Diving { + ACE_Overlay = QUOTE(PATHTOF(textures\HUD\DivingGoggles.paa)); + ACE_OverlayCracked = QUOTE(PATHTOF(textures\HUD\DivingGogglesCracked.paa)); + ACE_Resistance = 2; + ACE_Protection = 1; + }; + + class G_Lowprofile:None { + ACE_TintAmount=COLOUR*2; + ACE_Resistance = 2; + ACE_Protection = 1; + }; + + class G_Shades_Black:None { + ACE_TintAmount=COLOUR*2; + ACE_Resistance = 1; + }; + + class G_Shades_Blue:None{ + ACE_Color[] = {0,0,1}; + ACE_TintAmount=COLOUR; + ACE_Resistance = 1; + }; + + class G_Shades_Green:None{ + ACE_Color[] = {0,1,0}; + ACE_TintAmount=COLOUR; + ACE_Resistance = 1; + }; + + class G_Shades_Red:None{ + ACE_Color[] = {1,0,0}; + ACE_TintAmount=COLOUR; + ACE_Resistance = 1; + }; + + class G_Spectacles:None{ + ACE_TintAmount=COLOUR; + ACE_Resistance = 1; + }; + + class G_Spectacles_Tinted:None{ + ACE_TintAmount=COLOUR*2; + ACE_Resistance = 1; + }; + + class G_Sport_Blackred:None{ + ACE_Color[] = {1,0,0}; + ACE_TintAmount=COLOUR; + ACE_Resistance = 1; + }; + + class G_Sport_BlackWhite:None{ + ACE_Color[] = {0,0,1}; + ACE_TintAmount=COLOUR; + ACE_Resistance = 1; + }; + + class G_Sport_Blackyellow:None{ + ACE_TintAmount=COLOUR*2; + ACE_Resistance = 1; + }; + + class G_Sport_Checkered:None{ + ACE_TintAmount=COLOUR*2; + ACE_Resistance = 1; + }; + + class G_Sport_Greenblack:None{ + ACE_TintAmount=COLOUR*2; + ACE_Resistance = 1; + }; + + class G_Sport_Red:None{ + ACE_TintAmount=COLOUR*2; + ACE_Color[] = {0,0,0}; + ACE_Resistance = 1; + }; + + class G_Squares:None{ + ACE_TintAmount=COLOUR; + ACE_Resistance = 1; + }; + + class G_Squares_Tinted:None{ + ACE_TintAmount=COLOUR; + ACE_Resistance = 1; + }; + + class G_Tactical_Black:None{ + ACE_TintAmount=COLOUR; + ACE_Color[] = {0,0,-1.5}; + ACE_Resistance = 1; + }; + + class G_Tactical_Clear:None{ + ACE_TintAmount=COLOUR; + ACE_Color[] = {0,0,-1}; + ACE_Resistance = 1; + }; + + class G_Aviator:None{ + ACE_Color[] = {0,0,-1}; + ACE_TintAmount=COLOUR; + ACE_Resistance = 1; + }; + + class G_Lady_Blue:None{ + ACE_Color[] = {0,0,1}; + ACE_TintAmount=COLOUR; + ACE_Resistance = 1; + }; + + class G_Lady_Red:None{ + ACE_Color[] = {1,0,0}; + ACE_TintAmount=COLOUR; + ACE_Resistance = 1; + }; + + class G_Lady_Dark:None{ + ACE_TintAmount=COLOUR*2; + ACE_Resistance = 1; + }; + + class G_Lady_Mirror:None{ + ACE_TintAmount=COLOUR; + ACE_Resistance = 1; + }; + + class AV_ESS_blk:None{ + COMBAT_GOGGLES + }; + + class G_Balaclava_blk; + + class G_Balaclava_combat:G_Balaclava_blk { + COMBAT_GOGGLES + }; + + class G_Balaclava_lowprofile:G_Balaclava_blk { + ACE_TintAmount=COLOUR*2; + ACE_Resistance = 2; + ACE_Protection = 1; + }; + + class G_Bandanna_blk; + class G_Bandanna_shades:G_Bandanna_blk { + ACE_TintAmount=COLOUR*2; + ACE_Resistance = 1; + ACE_Protection = 1; + }; + class G_Bandanna_sport:G_Bandanna_blk { + ACE_Color[] = {1,0,0}; + ACE_TintAmount=COLOUR; + ACE_Resistance = 1; + ACE_Protection = 1; + }; + class G_Bandanna_aviator:G_Bandanna_blk { + ACE_Color[] = {0,0,-1}; + ACE_TintAmount=COLOUR; + ACE_Resistance = 1; + ACE_Protection = 1; + }; +}; + +#include "RscTitles.hpp" + +class CfgMovesBasic { + class ManActions { + GestureWipeFace[] = {"GestureWipeFace", "gesture"}; + }; +}; + +class CfgGesturesMale { + class States { + class GestureFreezeStand; + class GestureWipeFace: GestureFreezeStand { + file = QUOTE(PATHTOF(anim\WipeGlasses.rtm)); + canPullTrigger = 0; + }; + }; +}; + +class CfgWeapons { + class H_HelmetB; + + class H_CrewHelmetHeli_B:H_HelmetB { + ACE_Protection = 1; + }; + class H_PilotHelmetHeli_B:H_HelmetB { + ACE_Protection = 1; + }; + class H_PilotHelmetFighter_B:H_HelmetB { + ACE_Protection = 1; + }; +}; + +class RifleAssaultCloud { + ACE_Goggles_BulletCount = 4; +}; +class MachineGunCloud { + ACE_Goggles_BulletCount = 3; +}; +class SniperCloud { + ACE_Goggles_BulletCount = 1; +}; + +class ACE_Options { + class showInThirdPerson { + displayName = $STR_ACE_Goggles_ShowInThirdPerson; + default = 0; + }; +}; + +class CfgCloudlets { + class Default; + class ACERainEffect:Default { + interval = 0.001; + particleShape = "\A3\data_f\ParticleEffects\Universal\Refract"; + particleFSNtieth = 1; + particleFSIndex = 0; + particleFSFrameCount = 1; + particleFSLoop = 1; + + particleType = "Billboard"; + lifeTime = 0.5; + rotationVelocity = 1; + weight = 100; + volume = 0.000; + rubbing = 1.7; + size[] = {0.1}; + color[] = {{1,1,1,1}}; + animationSpeed[] = {0,1}; + randomDirectionPeriod = 0.2; + randomDirectionIntensity = 1.2; + positionVar[] = {2, 2, 2.5}; + sizeVar = 0.01; + colorVar[] = {0, 0, 0, 0.1}; + destroyOnWaterSurface = 1; + }; +}; diff --git a/addons/goggles/define.hpp b/addons/goggles/define.hpp new file mode 100644 index 0000000000..34c207bd20 --- /dev/null +++ b/addons/goggles/define.hpp @@ -0,0 +1,26 @@ +// Control types +#define CT_STATIC 0 +#define ST_PICTURE 0x30 + +//////////////// +//Base Classes// +//////////////// + +class RscPicture { + access = 0; + idc = -1; + type = CT_STATIC; + style = ST_PICTURE; + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,1}; + font = "puristaMedium"; + sizeEx = 0; + lineSpacing = 0; + fixedWidth = 0; + shadow = 0; + text = ""; + x = safezoneX; + y = safezoneY; + w = safezoneW; + h = safezoneH; +}; diff --git a/addons/goggles/functions/fnc_applyDirtEffect.sqf b/addons/goggles/functions/fnc_applyDirtEffect.sqf new file mode 100644 index 0000000000..50d7748818 --- /dev/null +++ b/addons/goggles/functions/fnc_applyDirtEffect.sqf @@ -0,0 +1,35 @@ +/* + ApplyDirtEffect + + Author: Garth de Wet (LH) + + Description: + Adds dirt effect to the glasses. + + Parameters: + Nothing + + Returns: + BOOLEAN - True if succeeded false if not + + Example: + call FUNC(ApplyDirtEffect); +*/ +#include "script_component.hpp" + +if (cameraOn != ace_player || {call FUNC(externalCamera)}) exitWith{false}; +private "_dirtImage"; +_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"); + if (_dirtImage != "") then { + 100 cutRsc["RscACE_GogglesEffects", "PLAIN",0.1, false]; + + (GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10660) ctrlSetText _dirtImage; + }; +}; + +true diff --git a/addons/goggles/functions/fnc_applyDust.sqf b/addons/goggles/functions/fnc_applyDust.sqf new file mode 100644 index 0000000000..53e75ba274 --- /dev/null +++ b/addons/goggles/functions/fnc_applyDust.sqf @@ -0,0 +1,61 @@ +/* + Name: fnc_applyDust.sqf + + Author: Garth de Wet (LH) + + Description: + Applies dust to screen. + + Parameters: + Nothing + + Returns: + Nothing + + Example 1: + call FUNC(ApplyDust); +*/ +#include "script_component.hpp" +if (call FUNC(ExternalCamera)) exitWith {}; +if (ace_player call FUNC(isGogglesVisible)) exitWith { + 100 cutRsc["RscACE_GogglesEffects", "PLAIN",2,false]; + (uiNamespace getVariable ["ACE_Goggles_DisplayEffects", displayNull] displayCtrl 10662) ctrlSetText format[getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_DustPath"), GETDUSTT(DAMOUNT)+1]; + SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)+1,0,1)); + SETDUST(DBULLETS,0); +}; + +if (GETVAR(ace_player,ACE_EyesDamaged,false)) exitWith {SETDUST(DACTIVE,false);SETDUST(DBULLETS,0);SETDUST(DAMOUNT,0);}; +SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)+1,0,2)); + +private "_amount"; +_amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); + +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); + +if (GVAR(DustHandler) != -1) then { // should be fixed in dev CBA + [GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler); + GVAR(DustHandler) = -1; +}; +GVAR(DustHandler) = [{ + if (diag_tickTime >= GETDUSTT(DTIME) + 3) then { + SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2)); + private "_amount"; + _amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); + if !(ace_player 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 { + GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]]; + GVAR(PostProcessEyes) ppEffectCommit 2; + [{GVAR(PostProcessEyes) ppEffectEnable false;}, [], 2, 0.5] call EFUNC(common,waitAndExecute); + SETDUST(DACTIVE,false); + SETDUST(DBULLETS,0); + [GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler); + GVAR(DustHandler) = -1; + }; + }; +},0,[]] call CALLSTACK(cba_fnc_addPerFrameHandler); diff --git a/TO_MERGE/agm/Goggles/functions/fn_ApplyGlassesEffect.sqf b/addons/goggles/functions/fnc_applyGlassesEffect.sqf similarity index 51% rename from TO_MERGE/agm/Goggles/functions/fn_ApplyGlassesEffect.sqf rename to addons/goggles/functions/fnc_applyGlassesEffect.sqf index df535485d9..496f73d4b0 100644 --- a/TO_MERGE/agm/Goggles/functions/fn_ApplyGlassesEffect.sqf +++ b/addons/goggles/functions/fnc_applyGlassesEffect.sqf @@ -1,53 +1,56 @@ /* - Name: AGM_Goggles_fnc_ApplyGlassesEffect - + Name: fnc_ApplyGlassesEffect.sqf + Author: Garth de Wet (LH) - + Description: Sets screen tint for glasses. Sets screen overlay for glasses. (broken/fixed) Sets dirt/rain overlay for glasses. - - Parameters: + + Parameters: 0: STRING - Glasses class name to be applied. - + Returns: Nothing - + Example: - (goggles player) call AGM_Goggles_fnc_ApplyGlassesEffect; + (goggles ace_player) call FUNC(ApplyGlassesEffect); */ -#include "\AGM_Goggles\script.sqf" +#include "script_component.hpp" private["_postProcessColour", "_postProcessTintAmount", "_glassesClassname", "_glassImagePath"]; _glassesClassname = _this; -_postProcessColour = getArray(configFile >> "CfgGlasses" >> _glassesClassname >> "AGM_Color"); -_postProcessTintAmount = getNumber(configFile >> "CfgGlasses" >> _glassesClassname >> "AGM_TintAmount"); +_postProcessColour = getArray(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_Color"); +_postProcessTintAmount = getNumber(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_TintAmount"); -call AGM_Goggles_fnc_RemoveGlassesEffect; -AGM_Goggles_EffectsActive = true; +call FUNC(removeGlassesEffect); +GVAR(EffectsActive) = true; -if (_postProcessTintAmount != 0 && {AGM_Goggles_UsePP}) then { +if (_postProcessTintAmount != 0 && {GVAR(UsePP)}) then { _postProcessColour set [3, _postProcessTintAmount/100]; - AGM_Goggles_PostProcess ppEffectAdjust[0.9, 1.1, 0.004, _postProcessColour, [0,0,0,1],[0,0,0,0]]; - AGM_Goggles_PostProcess ppEffectCommit 0; - AGM_Goggles_PostProcess ppEffectEnable true; + GVAR(PostProcess) ppEffectAdjust[0.9, 1.1, 0.004, _postProcessColour, [0,0,0,1],[0,0,0,0]]; + GVAR(PostProcess) ppEffectCommit 0; + GVAR(PostProcess) ppEffectEnable true; + _postProcessColour set [3, _postProcessTintAmount/250]; + GVAR(PostProcess) ppEffectAdjust[0.9, 1.1, 0.004, _postProcessColour, [0,0,0,1],[0,0,0,0]]; + GVAR(PostProcess) ppEffectCommit 30; }; -_glassImagePath = getText(configFile >> "CfgGlasses" >> _glassesClassname >> "AGM_Overlay"); +_glassImagePath = getText(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_Overlay"); if GETBROKEN then { - _glassImagePath = getText(configFile >> "CfgGlasses" >> _glassesClassname >> "AGM_OverlayCracked"); + _glassImagePath = getText(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_OverlayCracked"); }; if (_glassImagePath != "") then { - 150 cutRsc["RscAGM_Goggles", "PLAIN",1, false]; + 150 cutRsc["RscACE_Goggles", "PLAIN",1, false]; (GLASSDISPLAY displayCtrl 10650) ctrlSetText _glassImagePath; }; if GETDIRT then { - call AGM_Goggles_fnc_ApplyDirtEffect; + call FUNC(applyDirtEffect); }; if GETDUSTT(DACTIVE) then { SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2)); - call AGM_Goggles_fnc_ApplyDust; + call FUNC(applyDust); }; diff --git a/addons/goggles/functions/fnc_checkGoggles.sqf b/addons/goggles/functions/fnc_checkGoggles.sqf new file mode 100644 index 0000000000..a00b7371d8 --- /dev/null +++ b/addons/goggles/functions/fnc_checkGoggles.sqf @@ -0,0 +1,37 @@ +/* + Author: Garth de Wet (LH) + + Description: + Performs rain checks and checks to see whether glasses effects have been applied or not. + Checks for external camera and removes effects. +*/ +#include "script_component.hpp" +if (!alive ace_player) exitWith {}; +if (true) then { + // Detect if curator interface is open and disable effects + if (!isNull(findDisplay 312)) exitWith { + if (GVAR(EffectsActive)) then { + call FUNC(removeGlassesEffect); + }; + }; + call FUNC(checkGlasses); + if !(ace_player call FUNC(isGogglesVisible)) exitWith { + if (GVAR(EffectsActive)) then { + call FUNC(removeGlassesEffect); + }; + }; + if (call FUNC(externalCamera)) exitWith { + if (GVAR(EffectsActive)) then { + call FUNC(removeGlassesEffect); + }; + }; + if !(GVAR(EffectsActive)) then { + (goggles ace_player) call FUNC(applyGlassesEffect); + } else { + if ((goggles ace_player) call FUNC(isDivingGoggles) && {underwater ace_player}) then { + call FUNC(removeRainEffect); + call FUNC(removeDirtEffect); + call FUNC(removeDustEffect); + }; + }; +}; diff --git a/addons/goggles/functions/fnc_clearGlasses.sqf b/addons/goggles/functions/fnc_clearGlasses.sqf new file mode 100644 index 0000000000..4072e7c68a --- /dev/null +++ b/addons/goggles/functions/fnc_clearGlasses.sqf @@ -0,0 +1,38 @@ +/* + Name: fnc_clearGlasses.sqf + + Author: Garth de Wet (LH) + + Description: + Clears all dirt, rain, dust from glasses. + Removes glasses effect (PP, overlay) and then puts it back. + + Parameters: + Nothing + + Returns: + Nothing + + Example: + call FUNC(ClearGlasses); +*/ +#include "script_component.hpp" + +private "_broken"; +_broken = GETBROKEN; +_effects = GLASSESDEFAULT; +_effects set [BROKEN, _broken]; +SETGLASSES(ace_player,_effects); + +if ((stance ace_player) != "PRONE") then { + ace_player playActionNow "gestureWipeFace"; +}; +[{ + if (cameraView == "INTERNAL") then { + addCamShake [5, 1.75, 2]; + }; +}, [], 0.3, 0] call EFUNC(common,waitAndExecute); + +call FUNC(removeDirtEffect); +call FUNC(removeRainEffect); +call FUNC(removeDustEffect); diff --git a/TO_MERGE/agm/Goggles/functions/fn_DustHandler.sqf b/addons/goggles/functions/fnc_dustHandler.sqf similarity index 72% rename from TO_MERGE/agm/Goggles/functions/fn_DustHandler.sqf rename to addons/goggles/functions/fnc_dustHandler.sqf index a4457815e1..aae722d50f 100644 --- a/TO_MERGE/agm/Goggles/functions/fn_DustHandler.sqf +++ b/addons/goggles/functions/fnc_dustHandler.sqf @@ -1,29 +1,30 @@ /* - Name: AGM_Goggles_fnc_DustHandler - + fnc_DustHandler.sqf + Author: Garth de Wet (LH) - + Description: Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements. - - Parameters: + + Parameters: 0: Object - unit - eventhandler was attached to. (Used) 1: String - weapon - Weapon fired (Used) - + Returns: Nothing - + Example: - player addEventHandler ["Fired", {[_this select 0, _this select 1] call AGM_Goggles_fnc_DustHandler;}]; + ace_player addEventHandler ["Fired", {[_this select 0, _this select 1] call FUNC(DustHandler;}]; See http://community.bistudio.com/wiki/ArmA_3:_Event_Handlers#Fired */ -#include "\AGM_Goggles\script.sqf" - -private ["_bullets", "_position", "_surface", "_found", "_weapon", "_cloudType"]; -_weapon = _this select 1; +#include "script_component.hpp" +private ["_bullets", "_position", "_surface", "_found", "_weapon", "_cloudType", "_unit"]; +EXPLODE_2_PVT(_this,_unit,_weapon); +if (_unit != ace_player) exitWith {true}; _cloudType = ""; -if ((_this select 0) != player) exitWith {true}; +if (rain > 0.1) exitWith {true}; +if ((stance _unit) != "PRONE") exitWith {true}; if (isClass(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "FirstEffect")) then { _cloudType = getText(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "FirstEffect" >> "effectName"); @@ -34,10 +35,8 @@ if (isClass(configFile >> "CfgWeapons" >> _weapon >> "GunParticles" >> "FirstEff }; if (_cloudType == "") exitWith {true}; -if (rain > 0.1) exitWith {true}; -if ((stance player) != "PRONE") exitWith {true}; -_position = getPosATL player; +_position = getPosATL _unit; if (surfaceIsWater _position) exitWith {}; if ((_position select 2) > 0.2) exitWith {}; @@ -52,24 +51,24 @@ if (!_found) exitWith {}; _bullets = GETDUSTT(DBULLETS); -if ((time - GETDUSTT(DTIME)) > 1) then { +if ((diag_tickTime - GETDUSTT(DTIME)) > 1) then { _bullets = 0; }; _bullets = _bullets + 1; SETDUST(DBULLETS,_bullets); -SETDUST(DTIME,time); +SETDUST(DTIME,diag_tickTime); if (GETDUSTT(DAMOUNT) < 2) then { private "_bulletsRequired"; _bulletsRequired = 100; - if (isNumber (ConfigFile >> _cloudType >> "AGM_Goggles_BulletCount")) then { - _bulletsRequired = getNumber (ConfigFile >> _cloudType >> "AGM_Goggles_BulletCount"); + if (isNumber (ConfigFile >> _cloudType >> "ACE_Goggles_BulletCount")) then { + _bulletsRequired = getNumber (ConfigFile >> _cloudType >> "ACE_Goggles_BulletCount"); }; if (_bulletsRequired <= _bullets) then { SETDUST(DACTIVE,true); - call AGM_Goggles_fnc_ApplyDust; + call FUNC(applyDust); }; }; true diff --git a/TO_MERGE/agm/Goggles/functions/fn_ExternalCamera.sqf b/addons/goggles/functions/fnc_externalCamera.sqf similarity index 52% rename from TO_MERGE/agm/Goggles/functions/fn_ExternalCamera.sqf rename to addons/goggles/functions/fnc_externalCamera.sqf index d3e3f98366..66e1ae6b3d 100644 --- a/TO_MERGE/agm/Goggles/functions/fn_ExternalCamera.sqf +++ b/addons/goggles/functions/fnc_externalCamera.sqf @@ -1,19 +1,20 @@ /* - Name: AGM_Goggles_fnc_ExternalCamera - + fnc_ExternalCamera.sqf + Author: Garth de Wet (LH) - + Description: Returns if the camera is external or not. - - Parameters: + + Parameters: Nothing - + Returns: Boolean - whether the camera is in external view or not. - + Example: - call AGM_Goggles_fnc_ExternalCamera; + call FUNC(ExternalCamera); */ -if (profileNamespace getVariable ["AGM_showInThirdPerson", false]) exitWith { false }; +#include "script_component.hpp" +if (GETVAR(profileNamespace,ACE_showInThirdPerson,false)) exitWith { false }; (cameraView == "External") diff --git a/addons/goggles/functions/fnc_getExplosionIndex.sqf b/addons/goggles/functions/fnc_getExplosionIndex.sqf new file mode 100644 index 0000000000..92d79f4992 --- /dev/null +++ b/addons/goggles/functions/fnc_getExplosionIndex.sqf @@ -0,0 +1,27 @@ +/* + fnc_getExplosionIndex.sqf + + Author: Garth de Wet (LH) + + Description: + Turns 0-1 damage into a rating system of 0-3 + + Parameters: + 0: NUMBER - The amount of damage + + Returns: + NUMBER (the rating) [0-3] + + Example: + _rating = 0.05 call FUNC(GetExplosionIndex); +*/ +private ["_effectIndex"]; + +_effectIndex = switch true do { + case (_this <= 0.04): {0}; + case (_this <= 0.06): {1}; + case (_this <= 0.09): {2}; + default {3}; +}; + +_effectIndex diff --git a/TO_MERGE/agm/Goggles/functions/fn_isDivingGoggles.sqf b/addons/goggles/functions/fnc_isDivingGoggles.sqf similarity index 79% rename from TO_MERGE/agm/Goggles/functions/fn_isDivingGoggles.sqf rename to addons/goggles/functions/fnc_isDivingGoggles.sqf index d4b73ff5b7..d6b97fb80a 100644 --- a/TO_MERGE/agm/Goggles/functions/fn_isDivingGoggles.sqf +++ b/addons/goggles/functions/fnc_isDivingGoggles.sqf @@ -1,20 +1,21 @@ /* - Name: AGM_Goggles_fnc_isDivingGoggles - + fnc_isDivingGoggles.sqf + Author: Garth de Wet (LH) - + Description: Determines whether current goggles worn by passed unit is diving goggles or a variant of them. - - Parameters: + + Parameters: 0: String - Glasses classname - + Returns: Boolean - whether diving goggles are worn - + Example: - (goggles player) call AGM_Goggles_fnc_isDivingGoggles; + (goggles ace_player) call FUNC(isDivingGoggles); */ +#include "script_component.hpp" private ["_result", "_glasses"]; _glasses = _this; _result = _glasses == "G_Diving"; diff --git a/TO_MERGE/agm/Goggles/functions/fn_isGogglesVisible.sqf b/addons/goggles/functions/fnc_isGogglesVisible.sqf similarity index 69% rename from TO_MERGE/agm/Goggles/functions/fn_isGogglesVisible.sqf rename to addons/goggles/functions/fnc_isGogglesVisible.sqf index d694d18c26..a663554b60 100644 --- a/TO_MERGE/agm/Goggles/functions/fn_isGogglesVisible.sqf +++ b/addons/goggles/functions/fnc_isGogglesVisible.sqf @@ -1,20 +1,21 @@ /* - Name: AGM_Goggles_fnc_isGogglesVisible - + fnc_isGogglesVisible.sqf + Author: Garth de Wet (LH) - + Description: Determines if goggles are visible on passed unit (Also checks if unit is in vehicle and cameraView is set to GUNNER) - - Parameters: + + Parameters: 0: Object - unit to check for visible goggles - + Returns: BOOL - Whether the goggles are visible or not. - + Example: - _visible = player call AGM_Goggles_fnc_isGogglesVisible; + _visible = ace_player call FUNC(isGogglesVisible); */ +#include "script_component.hpp" private ["_currentGlasses", "_result", "_unit"]; _unit = _this; @@ -26,12 +27,12 @@ if ((vehicle _unit) != _unit) exitWith {(cameraView != "GUNNER")}; if (_currentGlasses != "") then { _position =(getPosASLW _unit); if (surfaceIsWater _position && {((_position select 2) < 0.25)}) exitWith { - _result = (_currentGlasses call AGM_Goggles_fnc_isDivingGoggles); + _result = (_currentGlasses call FUNC(isDivingGoggles)); }; - if (getNumber (ConfigFile >> "CfgGlasses" >> _currentGlasses >> "AGM_Resistance") == 0) exitWith { + if (getNumber (ConfigFile >> "CfgGlasses" >> _currentGlasses >> "ACE_Resistance") == 0) exitWith { _result = false; }; - _result = !(_currentGlasses call AGM_Goggles_fnc_isDivingGoggles); + _result = !(_currentGlasses call FUNC(isDivingGoggles)); }; -_result \ No newline at end of file +_result diff --git a/TO_MERGE/agm/Goggles/functions/fn_isInRotorWash.sqf b/addons/goggles/functions/fnc_isInRotorWash.sqf similarity index 78% rename from TO_MERGE/agm/Goggles/functions/fn_isInRotorWash.sqf rename to addons/goggles/functions/fnc_isInRotorWash.sqf index f1e69c9345..f8bad1a10f 100644 --- a/TO_MERGE/agm/Goggles/functions/fn_isInRotorWash.sqf +++ b/addons/goggles/functions/fnc_isInRotorWash.sqf @@ -1,24 +1,25 @@ /* - Name: AGM_Goggles_fnc_isInRotorWash - + fnc_isInRotorWash.sqf + Author: Garth de Wet (LH) - + Description: Checks for nearby helicopters (within 15m) - + Parameters: 0: Object - Unit 1: NUMBER - (optional) Radius to check for helicopter Default: 15 - + Returns: Array: 0 - boolean - If in rotorwash 1 - number - Amount of rotor wash. - + Example: - if (([player, 10] call AGM_Goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; }; - if (([player] call AGM_Goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; }; + if (([ace_player, 10] call FUNC(isInRotorWash)) select 0) then { hint "Rotor wash"; }; + if (([ace_player] call FUNC(isInRotorWash)) select 0) then { hint "Rotor wash"; }; */ +#include "script_component.hpp" private ["_heli", "_unit", "_result", "_radius"]; _unit = _this select 0; _radius = 15; @@ -41,6 +42,7 @@ _heli = (getPosATL _unit) nearEntities [["Helicopter"], _radius]; }; }; }; + false } count _heli; _result diff --git a/addons/goggles/functions/fnc_onEachFrame.sqf b/addons/goggles/functions/fnc_onEachFrame.sqf new file mode 100644 index 0000000000..cd361e38cf --- /dev/null +++ b/addons/goggles/functions/fnc_onEachFrame.sqf @@ -0,0 +1,80 @@ +/* + fnc_onEachFrame.sqf + + Author: Garth de Wet (LH) + + Description: + Runs every frame checking for helicopters. + + Parameters: + Nothing + + Returns: + Nothing + + Example: + ["ACE_Goggles_RotorWash", "OnEachFrame", "call FUNC(OnEachFrame);"] call BIS_fnc_addStackedEventHandler; +*/ +#include "script_component.hpp" +if (isNull(ace_player)) exitWith {}; +GVAR(FrameEvent) set [0, !(GVAR(FrameEvent) select 0)]; +if (GVAR(FrameEvent) select 0) exitWith { + if (vehicle ace_player != ace_player && {!([ace_player] call EFUNC(common,isTurnedOut))}) exitWith {(GVAR(FrameEvent) select 1) set [0, false]; }; + GVAR(FrameEvent) set [1, ([ace_player] call FUNC(isInRotorWash))]; +}; +private ["_rotorWash","_safe"]; +_rotorWash = GVAR(FrameEvent) select 1; +_safe = false; +if !(_rotorWash select 0) exitWith { + if (GVAR(PostProcessEyes_Enabled)) then { + GVAR(PostProcessEyes_Enabled) = false; + if (GVAR(DustHandler) != -1) then { // should be fixed in dev CBA + [GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler); + GVAR(DustHandler) = -1; + }; + GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0,0,0,0], [0,0,0,1],[1,1,1,0]]; + GVAR(PostProcessEyes) ppEffectCommit 2; + GVAR(DustHandler) = [{ + GVAR(PostProcessEyes) ppEffectEnable false; + GVAR(DustHandler) = -1; + }, [], 2, 0.5] call EFUNC(common,waitAndExecute); + }; +}; +if ((headgear ace_player) != "") then { + _safe = (getNumber (ConfigFile >> "CfgWeapons" >> (headgear ace_player) >> "ACE_Protection") == 1); +}; +if !(_safe) then { + if !(ace_player call FUNC(isGogglesVisible)) exitWith{}; + if (GETDUSTT(DAMOUNT) < 2) then { + if (!GETDUSTT(DACTIVE)) then { + SETDUST(DACTIVE,true); + call FUNC(ApplyDust); + } else { + if ((_rotorWash select 1) > 0.5) then { + call FUNC(ApplyDust); + }; + }; + }; + _safe = (getNumber (ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_Protection") == 1); +}; +if (_safe) exitWith {}; +if ((_rotorWash select 1) <= 15) then { + private "_scale"; + _scale = 0.7; + if ((_rotorWash select 1) != 0) then { + _scale = CLAMP(0.3*(_rotorWash select 1),0.1,0.3); + } else { + _scale = 0.1; + }; + _scale = 1 - _scale; + if (GVAR(DustHandler) != -1) then { // should be fixed in dev CBA + [GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler); + GVAR(DustHandler) = -1; + }; + if !(ace_player getVariable ["ACE_EyesDamaged", false]) then { + GVAR(PostProcessEyes_Enabled) = true; + GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0,0,0,0], [_scale,_scale,_scale,_scale],[1,1,1,0]]; + GVAR(PostProcessEyes) ppEffectCommit 0.5; + GVAR(PostProcessEyes) ppEffectEnable true; + }; +}; diff --git a/addons/goggles/functions/fnc_rainEffect.sqf b/addons/goggles/functions/fnc_rainEffect.sqf new file mode 100644 index 0000000000..030e60c149 --- /dev/null +++ b/addons/goggles/functions/fnc_rainEffect.sqf @@ -0,0 +1,55 @@ +/* + fnc_rainEffect.sqf + + Author: Garth de Wet (LH) + + Description: + + + Parameters: + Nothing + + Returns: + Nothing + + Example: + [] call FUNC(RainEffect); +*/ +#include "script_component.hpp" +private ["_fnc_underCover"]; +if (isNull(ace_player) || {!(alive ace_player)}) exitWith {}; +_fnc_underCover = { + private ["_pos", "_unit"]; + _unit = (_this select 0); + if (vehicle _unit != _unit && {!([_unit] call EFUNC(common,isTurnedOut))}) exitWith {true}; + _pos = eyePos _unit; + ((positionCameraToWorld [0,0,1] select 2) < ((positionCameraToWorld [0,0,0] select 2) - 0.4)) || {(lineIntersects [_pos, _pos vectorAdd [0,0,15], _unit])} +}; +if (!isNull(findDisplay 312)) exitWith { + if (GVAR(RainActive)) then { + call FUNC(RemoveRainEffect); + }; +}; +// Ignore if ace_player is under water +if (!GVAR(EffectsActive) || {underwater ace_player}) exitWith{call FUNC(RemoveRainEffect);}; +if (GVAR(RainLastLevel) != rain) then { + call FUNC(RemoveRainEffect); + GVAR(RainLastLevel) = rain; + // Rain is happening + if (GVAR(RainLastLevel) > 0.05 && {!([ace_player] call _fnc_underCover)}) then { + GVAR(RainActive) = true; + GVAR(RainDrops) = "#particlesource" createVehicleLocal GetPos ace_player; + GVAR(RainDrops) setParticleClass "ACERainEffect"; + GVAR(RainDrops) setDropInterval (0.07 * (1.1 - GVAR(RainLastLevel))); + GVAR(RainDrops) attachTo [vehicle ace_player,[0,0,0]]; + }; +}else{ + if (GVAR(RainLastLevel) > 0.05) then { + if (GVAR(RainActive) && {[ace_player] call _fnc_underCover}) exitWith { + call FUNC(RemoveRainEffect); + }; + if (!GVAR(RainActive)) then { + GVAR(RainLastLevel) = -1; + }; + }; +}; diff --git a/addons/goggles/functions/fnc_removeDirtEffect.sqf b/addons/goggles/functions/fnc_removeDirtEffect.sqf new file mode 100644 index 0000000000..5b58fad834 --- /dev/null +++ b/addons/goggles/functions/fnc_removeDirtEffect.sqf @@ -0,0 +1,21 @@ +/* + fnc_removeDirtEffect.sqf + + Author: Garth de Wet (LH) + + Description: + Removes dirt from the glasses. + + Parameters: + Nothing + + Returns: + Nothing + + Example: + call FUNC(RemoveDirtEffect); +*/ +#include "script_component.hpp" +if (!isNull(GETUVAR(GVAR(DisplayEffects),displayNull))) then { + (GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10660) ctrlSetText ""; +}; diff --git a/addons/goggles/functions/fnc_removeDustEffect.sqf b/addons/goggles/functions/fnc_removeDustEffect.sqf new file mode 100644 index 0000000000..c937fe2bd1 --- /dev/null +++ b/addons/goggles/functions/fnc_removeDustEffect.sqf @@ -0,0 +1,21 @@ +/* + fnc_removeDustEffect.sqf + + Author: Garth de Wet (LH) + + Description: + Removes dust from the glasses. + + Parameters: + Nothing + + Returns: + Nothing + + Example: + call FUNC(RemoveDustEffect); +*/ +#include "script_component.hpp" +if (!isNull(GETUVAR(GVAR(DisplayEffects),displayNull))) then { + (GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10662) ctrlSetText ""; +}; diff --git a/addons/goggles/functions/fnc_removeGlassesEffect.sqf b/addons/goggles/functions/fnc_removeGlassesEffect.sqf new file mode 100644 index 0000000000..dc7bbee45e --- /dev/null +++ b/addons/goggles/functions/fnc_removeGlassesEffect.sqf @@ -0,0 +1,29 @@ +/* + RemoveGlassesEffect + + Author: Garth de Wet (LH) + + Description: + Removes the glasses effect from the screen, removes dirt effect, removes rain effect, + removes dust effect. Does not reset array (glasses will still be broken, dirty, ect.) + + Parameters: + Nothing + + Returns: + Nothing + + Example: + call FUNC(RemoveGlassesEffect); +*/ +#include "script_component.hpp" +GVAR(EffectsActive) = false; +GVAR(PostProcess) ppEffectEnable false; + +if (!isNull(GLASSDISPLAY)) then { + GLASSDISPLAY closeDisplay 0; +}; + +call FUNC(removeDirtEffect); +call FUNC(removeRainEffect); +call FUNC(removeDustEffect); diff --git a/addons/goggles/functions/fnc_removeRainEffect.sqf b/addons/goggles/functions/fnc_removeRainEffect.sqf new file mode 100644 index 0000000000..bcef82dc81 --- /dev/null +++ b/addons/goggles/functions/fnc_removeRainEffect.sqf @@ -0,0 +1,23 @@ +/* + RemoveRainEffect + + Author: Garth de Wet (LH) + + Description: + Removes rain effects from the screen. Resets the rain array. + + Parameters: + Nothing + + Returns: + Nothing + + Example: + call FUNC(RemoveRainEffect); +*/ +#include "script_component.hpp" +if (!isNull (GVAR(RainDrops))) then { + deleteVehicle (GVAR(RainDrops)); +}; +GVAR(RainActive) = false; +GVAR(RainLastLevel) = 0; diff --git a/addons/goggles/functions/script_component.hpp b/addons/goggles/functions/script_component.hpp new file mode 100644 index 0000000000..d8624df3b2 --- /dev/null +++ b/addons/goggles/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\goggles\script_component.hpp" diff --git a/addons/goggles/script_component.hpp b/addons/goggles/script_component.hpp new file mode 100644 index 0000000000..711a314160 --- /dev/null +++ b/addons/goggles/script_component.hpp @@ -0,0 +1,37 @@ +#define COMPONENT goggles +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_GOGGLES + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_GOGGLES + #define DEBUG_SETTINGS DEBUG_SETTINGS_GOGGLES +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +// 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 (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) (GETGLASSES(ace_player) select DUST) set [type,value] + +#define DACTIVE 0 +#define DTIME 1 +#define DBULLETS 2 +#define DAMOUNT 3 + +#define GLASSDISPLAY (GETUVAR(GVAR(Display),displayNull)) + +#define CLAMP(x,low,high) (if(x > high)then{high}else{if(x < low)then{low}else{x}}) diff --git a/TO_MERGE/agm/Goggles/stringtable.xml b/addons/goggles/stringtable.xml similarity index 91% rename from TO_MERGE/agm/Goggles/stringtable.xml rename to addons/goggles/stringtable.xml index 0d079a4063..1756442176 100644 --- a/TO_MERGE/agm/Goggles/stringtable.xml +++ b/addons/goggles/stringtable.xml @@ -1,8 +1,8 @@  - + - + Show Goggle Effects in Third Person Brilleneffekt in dritter Person anzeigen Mostrar efectos de las gafas en tercera persona @@ -14,7 +14,7 @@ Mostrar efeitos de óculos em Terceira Pessoa Attiva l'effetto degli occhiali in terza persona - + Wipe Goggles Brille abwischen Limpiar gafas @@ -27,4 +27,4 @@ Pulisci gli occhiali - \ No newline at end of file + diff --git a/TO_MERGE/agm/Goggles/textures/HUD/CombatGoggles.paa b/addons/goggles/textures/HUD/CombatGoggles.paa similarity index 100% rename from TO_MERGE/agm/Goggles/textures/HUD/CombatGoggles.paa rename to addons/goggles/textures/HUD/CombatGoggles.paa diff --git a/TO_MERGE/agm/Goggles/textures/HUD/CombatGogglesCracked.paa b/addons/goggles/textures/HUD/CombatGogglesCracked.paa similarity index 100% rename from TO_MERGE/agm/Goggles/textures/HUD/CombatGogglesCracked.paa rename to addons/goggles/textures/HUD/CombatGogglesCracked.paa diff --git a/TO_MERGE/agm/Goggles/textures/HUD/Cracked.paa b/addons/goggles/textures/HUD/Cracked.paa similarity index 100% rename from TO_MERGE/agm/Goggles/textures/HUD/Cracked.paa rename to addons/goggles/textures/HUD/Cracked.paa diff --git a/TO_MERGE/agm/Goggles/textures/HUD/DivingGoggles.paa b/addons/goggles/textures/HUD/DivingGoggles.paa similarity index 100% rename from TO_MERGE/agm/Goggles/textures/HUD/DivingGoggles.paa rename to addons/goggles/textures/HUD/DivingGoggles.paa diff --git a/TO_MERGE/agm/Goggles/textures/HUD/DivingGogglesCracked.paa b/addons/goggles/textures/HUD/DivingGogglesCracked.paa similarity index 100% rename from TO_MERGE/agm/Goggles/textures/HUD/DivingGogglesCracked.paa rename to addons/goggles/textures/HUD/DivingGogglesCracked.paa diff --git a/TO_MERGE/agm/Goggles/textures/fx/dust/1.paa b/addons/goggles/textures/fx/dust/1.paa similarity index 100% rename from TO_MERGE/agm/Goggles/textures/fx/dust/1.paa rename to addons/goggles/textures/fx/dust/1.paa diff --git a/TO_MERGE/agm/Goggles/textures/fx/dust/2.paa b/addons/goggles/textures/fx/dust/2.paa similarity index 100% rename from TO_MERGE/agm/Goggles/textures/fx/dust/2.paa rename to addons/goggles/textures/fx/dust/2.paa diff --git a/extras/blank/XEH_preInit.sqf b/extras/blank/XEH_preInit.sqf index 802b74fd63..69abb46fa9 100644 --- a/extras/blank/XEH_preInit.sqf +++ b/extras/blank/XEH_preInit.sqf @@ -1,3 +1,7 @@ #include "script_component.hpp" +ADDON = false; + PREP(empty); + +ADDON = true; diff --git a/tools/rename_fn.py b/tools/rename_fn.py old mode 100644 new mode 100755 diff --git a/tools/stringtableduplicates.py b/tools/stringtableduplicates.py old mode 100644 new mode 100755