Moved goggles to addons folder and renamed all occurances of AGM to ACE.

This commit is contained in:
Garth L-H de Wet 2015-01-18 21:43:51 +02:00
parent a800c2935f
commit 0f04d0dfb1
41 changed files with 769 additions and 769 deletions

View File

@ -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;
};
};

View File

@ -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

View File

@ -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;
};
};
};
};

View File

@ -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;

View File

@ -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;
};
};

View File

@ -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;
};
};
};

View File

@ -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;

View File

@ -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}})

View File

@ -1,7 +1,7 @@
class CfgFunctions{ class CfgFunctions{
class AGM_Goggles{ class ACE_Goggles{
class AGM_Goggles{ class ACE_Goggles{
file="AGM_Goggles\functions"; file="ACE_Goggles\functions";
class Init{postInit = 1;}; class Init{postInit = 1;};
class ApplyGlassesEffect; class ApplyGlassesEffect;
class RemoveGlassesEffect; class RemoveGlassesEffect;

View File

@ -1,21 +1,21 @@
class RscTitles{ class RscTitles{
#include "define.hpp" #include "define.hpp"
class RscAGM_Goggles_BaseTitle{ class RscACE_Goggles_BaseTitle{
idd = -1; idd = -1;
onLoad = "uiNamespace setVariable ['AGM_Goggles_Display', _this select 0]"; onLoad = "uiNamespace setVariable ['ACE_Goggles_Display', _this select 0]";
onUnload = "uiNamespace setVariable ['AGM_Goggles_Display', displayNull]"; onUnload = "uiNamespace setVariable ['ACE_Goggles_Display', displayNull]";
fadeIn=0.5; fadeIn=0.5;
fadeOut=0.5; fadeOut=0.5;
movingEnable = false; movingEnable = false;
duration = 10e10; duration = 10e10;
name = "RscAGM_Goggles_BaseTitle"; name = "RscACE_Goggles_BaseTitle";
class controls; class controls;
}; };
class RscAGM_Goggles:RscAGM_Goggles_BaseTitle{ class RscACE_Goggles:RscACE_Goggles_BaseTitle{
idd = 1044; idd = 1044;
name = "RscAGM_Goggles"; name = "RscACE_Goggles";
class controls{ class controls{
class gogglesImage: RscPicture{ class gogglesImage: RscPicture{
idc = 10650; idc = 10650;
@ -23,11 +23,11 @@ class RscTitles{
}; };
}; };
class RscAGM_GogglesEffects:RscAGM_Goggles_BaseTitle{ class RscACE_GogglesEffects:RscACE_Goggles_BaseTitle{
idd = 1045; idd = 1045;
onLoad = "uiNamespace setVariable ['AGM_Goggles_DisplayEffects', _this select 0]"; onLoad = "uiNamespace setVariable ['ACE_Goggles_DisplayEffects', _this select 0]";
onUnload = "uiNamespace setVariable ['AGM_Goggles_DisplayEffects', displayNull]"; onUnload = "uiNamespace setVariable ['ACE_Goggles_DisplayEffects', displayNull]";
name = "RscAGM_GogglesEffects"; name = "RscACE_GogglesEffects";
fadeIn=0; fadeIn=0;
fadeOut=0.5; fadeOut=0.5;
class controls{ class controls{

295
addons/goggles/config.cpp Normal file
View File

@ -0,0 +1,295 @@
#define COLOUR 8.0
class CfgPatches {
class ACE_Goggles {
units[] = {};
weapons[] = {};
requiredVersion = 0.60;
requiredAddons[] = {ACE_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 ACE_Overlay="ACE_Goggles\textures\HUD\CombatGoggles.paa"; \
ACE_OverlayCracked = "ACE_Goggles\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 = "ACE_Goggles\textures\HUD\Cracked.paa";
ACE_Resistance = 0;
ACE_Protection = 0;
ACE_DustPath = "ACE_Goggles\textures\fx\dust\%1.paa";
};
class G_Combat:None {
COMBAT_GOGGLES
};
class G_Diving {
ACE_Overlay="ACE_Goggles\textures\HUD\DivingGoggles.paa";
ACE_OverlayCracked = "ACE_Goggles\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 = "\ACE_Goggles\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_Core_Default_Keys {
class wipeGlasses {
displayName = $STR_ACE_Goggles_WipeGlasses;
condition = "!(player getVariable['ACE_isUnconscious', false])";
statement = "call ACE_Goggles_fnc_ClearGlasses;";
key = 20; // T
shift = 1;
control = 1;
alt = 0;
};
};
class ACE_Core_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;
};
};

View File

@ -0,0 +1,32 @@
/*
Name: ACE_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 ACE_Goggles_fnc_ApplyDirtEffect;
*/
#include "\ACE_Goggles\script.sqf"
if (cameraOn != player || call ACE_Goggles_fnc_ExternalCamera) exitWith{false};
private "_dirtImage";
ACE_Goggles_Effects set [DIRT, true];
if (player call ACE_Goggles_fnc_isGogglesVisible) then{
_dirtImage = getText(ConfigFile >> "CfgGlasses" >> goggles player >> "ACE_OverlayDirt");
if (_dirtImage != "") then {
100 cutRsc["RscACE_GogglesEffects", "PLAIN",0.1, false];
(uiNamespace getVariable ["ACE_Goggles_DisplayEffects", displayNull] displayCtrl 10660) ctrlSetText _dirtImage;
};
};
true

View File

@ -1,5 +1,5 @@
/* /*
Name: AGM_Goggles_fnc_ApplyDust Name: ACE_Goggles_fnc_ApplyDust
Author: Garth de Wet (LH) Author: Garth de Wet (LH)
@ -13,31 +13,31 @@
Nothing Nothing
Example 1: Example 1:
call AGM_Goggles_fnc_ApplyDust; call ACE_Goggles_fnc_ApplyDust;
*/ */
#include "\AGM_Goggles\script.sqf" #include "\ACE_Goggles\script.sqf"
if (call AGM_Goggles_fnc_ExternalCamera) exitWith {}; if (call ACE_Goggles_fnc_ExternalCamera) exitWith {};
if (player call AGM_Goggles_fnc_isGogglesVisible) exitWith { if (player call ACE_Goggles_fnc_isGogglesVisible) exitWith {
100 cutRsc["RscAGM_GogglesEffects", "PLAIN",2,false]; 100 cutRsc["RscACE_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]; (uiNamespace getVariable ["ACE_Goggles_DisplayEffects", displayNull] displayCtrl 10662) ctrlSetText format[getText(ConfigFile >> "CfgGlasses" >> ACE_Goggles_Current >> "ACE_DustPath"), GETDUSTT(DAMOUNT)+1];
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)+1,0,1)); SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)+1,0,1));
SETDUST(DBULLETS,0); SETDUST(DBULLETS,0);
}; };
if (player getVariable ["AGM_EyesDamaged", false]) exitWith {SETDUST(DACTIVE,false);SETDUST(DBULLETS,0);SETDUST(DAMOUNT,0);}; if (player getVariable ["ACE_EyesDamaged", false]) exitWith {SETDUST(DACTIVE,false);SETDUST(DBULLETS,0);SETDUST(DAMOUNT,0);};
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)+1,0,2)); SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)+1,0,2));
private "_amount"; private "_amount";
_amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); _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]]; ACE_Goggles_PostProcessEyes ppEffectAdjust[1, 1, 0, [0,0,0,0], [_amount,_amount,_amount,_amount],[1,1,1,0]];
AGM_Goggles_PostProcessEyes ppEffectCommit 1; ACE_Goggles_PostProcessEyes ppEffectCommit 1;
AGM_Goggles_PostProcessEyes ppEffectEnable true; ACE_Goggles_PostProcessEyes ppEffectEnable true;
if !(scriptDone AGM_Goggles_DustHandler) then { if !(scriptDone ACE_Goggles_DustHandler) then {
terminate AGM_Goggles_DustHandler; terminate ACE_Goggles_DustHandler;
}; };
SETDUST(DBULLETS,0); SETDUST(DBULLETS,0);
AGM_Goggles_DustHandler = [3] spawn { ACE_Goggles_DustHandler = [3] spawn {
private ["_loop", "_timeToSleep"]; private ["_loop", "_timeToSleep"];
_timeToSleep = _this select 0; _timeToSleep = _this select 0;
_loop = true; _loop = true;
@ -51,13 +51,13 @@ AGM_Goggles_DustHandler = [3] spawn {
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2)); SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2));
private "_amount"; private "_amount";
_amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); _amount = 1 - (GETDUSTT(DAMOUNT) * 0.125);
if !(player getVariable ["AGM_EyesDamaged", false]) then { if !(player getVariable ["ACE_EyesDamaged", false]) then {
AGM_Goggles_PostProcessEyes ppEffectAdjust[1, 1, 0, [0,0,0,0], [_amount,_amount,_amount,_amount],[1,1,1,0]]; ACE_Goggles_PostProcessEyes ppEffectAdjust[1, 1, 0, [0,0,0,0], [_amount,_amount,_amount,_amount],[1,1,1,0]];
AGM_Goggles_PostProcessEyes ppEffectCommit 1; ACE_Goggles_PostProcessEyes ppEffectCommit 1;
sleep 1; sleep 1;
}; };
if (GETDUSTT(DAMOUNT) <= 0) then { if (GETDUSTT(DAMOUNT) <= 0) then {
AGM_Goggles_PostProcessEyes ppEffectEnable false; ACE_Goggles_PostProcessEyes ppEffectEnable false;
SETDUST(DACTIVE,false); SETDUST(DACTIVE,false);
SETDUST(DBULLETS,0); SETDUST(DBULLETS,0);
_loop = false; _loop = false;

View File

@ -1,5 +1,5 @@
/* /*
Name: AGM_Goggles_fnc_ApplyGlassesEffect Name: ACE_Goggles_fnc_ApplyGlassesEffect
Author: Garth de Wet (LH) Author: Garth de Wet (LH)
@ -15,39 +15,39 @@
Nothing Nothing
Example: Example:
(goggles player) call AGM_Goggles_fnc_ApplyGlassesEffect; (goggles player) call ACE_Goggles_fnc_ApplyGlassesEffect;
*/ */
#include "\AGM_Goggles\script.sqf" #include "\ACE_Goggles\script.sqf"
private["_postProcessColour", "_postProcessTintAmount", "_glassesClassname", "_glassImagePath"]; private["_postProcessColour", "_postProcessTintAmount", "_glassesClassname", "_glassImagePath"];
_glassesClassname = _this; _glassesClassname = _this;
_postProcessColour = getArray(configFile >> "CfgGlasses" >> _glassesClassname >> "AGM_Color"); _postProcessColour = getArray(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_Color");
_postProcessTintAmount = getNumber(configFile >> "CfgGlasses" >> _glassesClassname >> "AGM_TintAmount"); _postProcessTintAmount = getNumber(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_TintAmount");
call AGM_Goggles_fnc_RemoveGlassesEffect; call ACE_Goggles_fnc_RemoveGlassesEffect;
AGM_Goggles_EffectsActive = true; ACE_Goggles_EffectsActive = true;
if (_postProcessTintAmount != 0 && {AGM_Goggles_UsePP}) then { if (_postProcessTintAmount != 0 && {ACE_Goggles_UsePP}) then {
_postProcessColour set [3, _postProcessTintAmount/100]; _postProcessColour set [3, _postProcessTintAmount/100];
AGM_Goggles_PostProcess ppEffectAdjust[0.9, 1.1, 0.004, _postProcessColour, [0,0,0,1],[0,0,0,0]]; ACE_Goggles_PostProcess ppEffectAdjust[0.9, 1.1, 0.004, _postProcessColour, [0,0,0,1],[0,0,0,0]];
AGM_Goggles_PostProcess ppEffectCommit 0; ACE_Goggles_PostProcess ppEffectCommit 0;
AGM_Goggles_PostProcess ppEffectEnable true; ACE_Goggles_PostProcess ppEffectEnable true;
}; };
_glassImagePath = getText(configFile >> "CfgGlasses" >> _glassesClassname >> "AGM_Overlay"); _glassImagePath = getText(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_Overlay");
if GETBROKEN then { if GETBROKEN then {
_glassImagePath = getText(configFile >> "CfgGlasses" >> _glassesClassname >> "AGM_OverlayCracked"); _glassImagePath = getText(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_OverlayCracked");
}; };
if (_glassImagePath != "") then { if (_glassImagePath != "") then {
150 cutRsc["RscAGM_Goggles", "PLAIN",1, false]; 150 cutRsc["RscACE_Goggles", "PLAIN",1, false];
(GLASSDISPLAY displayCtrl 10650) ctrlSetText _glassImagePath; (GLASSDISPLAY displayCtrl 10650) ctrlSetText _glassImagePath;
}; };
if GETDIRT then { if GETDIRT then {
call AGM_Goggles_fnc_ApplyDirtEffect; call ACE_Goggles_fnc_ApplyDirtEffect;
}; };
if GETDUSTT(DACTIVE) then { if GETDUSTT(DACTIVE) then {
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2)); SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2));
call AGM_Goggles_fnc_ApplyDust; call ACE_Goggles_fnc_ApplyDust;
}; };

View File

@ -0,0 +1,52 @@
/*
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 "ACE_Goggles\functions\fn_CheckGoggles.sqf";
*/
#include "\ACE_Goggles\script.sqf"
waitUntil {sleep 0.46;alive player};
call ACE_Goggles_fnc_CheckGlasses;
["ACE_Goggles_RotorWash", "OnEachFrame", {call ACE_Goggles_fnc_OnEachFrame;}] call BIS_fnc_addStackedEventHandler;
[] spawn ACE_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 (ACE_Goggles_EffectsActive) then {
call ACE_Goggles_fnc_RemoveGlassesEffect;
};
};
call ACE_Goggles_fnc_CheckGlasses;
if !(player call ACE_Goggles_fnc_isGogglesVisible) exitWith {
if (ACE_Goggles_EffectsActive) then {
call ACE_Goggles_fnc_RemoveGlassesEffect;
};
};
if (call ACE_Goggles_fnc_ExternalCamera) exitWith {
if (ACE_Goggles_EffectsActive) then {
call ACE_Goggles_fnc_RemoveGlassesEffect;
};
};
if !(ACE_Goggles_EffectsActive) then {
(goggles player) call ACE_Goggles_fnc_ApplyGlassesEffect;
} else {
if ((goggles player) call ACE_Goggles_fnc_isDivingGoggles && {underwater player}) then {
call ACE_Goggles_fnc_RemoveRainEffect;
call ACE_Goggles_fnc_RemoveDirtEffect;
call ACE_Goggles_fnc_RemoveDustEffect;
};
};
};
};

View File

@ -1,5 +1,5 @@
/* /*
Name: AGM_Goggles_fnc_ClearGlasses Name: ACE_Goggles_fnc_ClearGlasses
Author: Garth de Wet (LH) Author: Garth de Wet (LH)
@ -14,14 +14,14 @@
Nothing Nothing
Example: Example:
call AGM_Goggles_fnc_ClearGlasses; call ACE_Goggles_fnc_ClearGlasses;
*/ */
#include "\AGM_Goggles\script.sqf" #include "\ACE_Goggles\script.sqf"
private "_broken"; private "_broken";
_broken = GETBROKEN; _broken = GETBROKEN;
AGM_Goggles_Effects = GLASSESDEFAULT; ACE_Goggles_Effects = GLASSESDEFAULT;
AGM_Goggles_Effects set [BROKEN, _broken]; ACE_Goggles_Effects set [BROKEN, _broken];
if ((stance player) != "PRONE") then { if ((stance player) != "PRONE") then {
player playActionNow "gestureWipeFace"; player playActionNow "gestureWipeFace";
@ -34,6 +34,6 @@ null = [] spawn {
}; };
}; };
call AGM_Goggles_fnc_RemoveDirtEffect; call ACE_Goggles_fnc_RemoveDirtEffect;
call AGM_Goggles_fnc_RemoveRainEffect; call ACE_Goggles_fnc_RemoveRainEffect;
call AGM_Goggles_fnc_RemoveDustEffect; call ACE_Goggles_fnc_RemoveDustEffect;

View File

@ -1,5 +1,5 @@
/* /*
Name: AGM_Goggles_fnc_DustHandler Name: ACE_Goggles_fnc_DustHandler
Author: Garth de Wet (LH) Author: Garth de Wet (LH)
@ -14,10 +14,10 @@
Nothing Nothing
Example: Example:
player addEventHandler ["Fired", {[_this select 0, _this select 1] call AGM_Goggles_fnc_DustHandler;}]; player addEventHandler ["Fired", {[_this select 0, _this select 1] call ACE_Goggles_fnc_DustHandler;}];
See http://community.bistudio.com/wiki/ArmA_3:_Event_Handlers#Fired See http://community.bistudio.com/wiki/ArmA_3:_Event_Handlers#Fired
*/ */
#include "\AGM_Goggles\script.sqf" #include "\ACE_Goggles\script.sqf"
private ["_bullets", "_position", "_surface", "_found", "_weapon", "_cloudType"]; private ["_bullets", "_position", "_surface", "_found", "_weapon", "_cloudType"];
_weapon = _this select 1; _weapon = _this select 1;
@ -63,13 +63,13 @@ SETDUST(DTIME,time);
if (GETDUSTT(DAMOUNT) < 2) then { if (GETDUSTT(DAMOUNT) < 2) then {
private "_bulletsRequired"; private "_bulletsRequired";
_bulletsRequired = 100; _bulletsRequired = 100;
if (isNumber (ConfigFile >> _cloudType >> "AGM_Goggles_BulletCount")) then { if (isNumber (ConfigFile >> _cloudType >> "ACE_Goggles_BulletCount")) then {
_bulletsRequired = getNumber (ConfigFile >> _cloudType >> "AGM_Goggles_BulletCount"); _bulletsRequired = getNumber (ConfigFile >> _cloudType >> "ACE_Goggles_BulletCount");
}; };
if (_bulletsRequired <= _bullets) then { if (_bulletsRequired <= _bullets) then {
SETDUST(DACTIVE,true); SETDUST(DACTIVE,true);
call AGM_Goggles_fnc_ApplyDust; call ACE_Goggles_fnc_ApplyDust;
}; };
}; };
true true

View File

@ -1,5 +1,5 @@
/* /*
Name: AGM_Goggles_fnc_ExternalCamera Name: ACE_Goggles_fnc_ExternalCamera
Author: Garth de Wet (LH) Author: Garth de Wet (LH)
@ -13,7 +13,7 @@
Boolean - whether the camera is in external view or not. Boolean - whether the camera is in external view or not.
Example: Example:
call AGM_Goggles_fnc_ExternalCamera; call ACE_Goggles_fnc_ExternalCamera;
*/ */
if (profileNamespace getVariable ["AGM_showInThirdPerson", false]) exitWith { false }; if (profileNamespace getVariable ["ACE_showInThirdPerson", false]) exitWith { false };
(cameraView == "External") (cameraView == "External")

View File

@ -1,5 +1,5 @@
/* /*
Name: AGM_Goggles_fnc_GetExplosionIndex Name: ACE_Goggles_fnc_GetExplosionIndex
Author: Garth de Wet (LH) Author: Garth de Wet (LH)
@ -13,7 +13,7 @@
NUMBER (the rating) [0-3] NUMBER (the rating) [0-3]
Example: Example:
_rating = 0.05 call AGM_Goggles_fnc_GetExplosionIndex _rating = 0.05 call ACE_Goggles_fnc_GetExplosionIndex
*/ */
private ["_effect", "_effectIndex"]; private ["_effect", "_effectIndex"];
_effect = _this; _effect = _this;

View File

@ -0,0 +1,111 @@
/*
Name: ACE_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 ACE_Goggles_fnc_Init;
*/
if (!hasInterface) exitWith {};
#include "\ACE_Goggles\script.sqf"
if isNil("ACE_Goggles_UsePP") then {
ACE_Goggles_UsePP = true;
};
ACE_Goggles_PostProcess = ppEffectCreate ["ColorCorrections", 1995];
ACE_Goggles_PostProcessEyes = ppEffectCreate ["ColorCorrections", 1992];
ACE_Goggles_PostProcessEyes ppEffectAdjust[1, 1, 0, [0,0,0,0], [0,0,0,1],[1,1,1,0]];
ACE_Goggles_PostProcessEyes ppEffectCommit 0;
ACE_Goggles_PostProcessEyes ppEffectEnable false;
ACE_Goggles_EffectsActive = false;
ACE_Goggles_Effects = GLASSESDEFAULT;
ACE_Goggles_Current = "None";
ACE_Goggles_EyesDamageScript = 0 spawn {};
ACE_Goggles_FrameEvent = [false, [false,20]];
ACE_Goggles_PostProcessEyes_Enabled = false;
ACE_Goggles_DustHandler = 0 spawn {};
ACE_Goggles_RainDrops = objNull;
ACE_Goggles_fnc_CheckGlasses = {
if (ACE_Goggles_Current != (goggles player)) then {
ACE_Goggles_Current = (goggles player);
["GlassesChanged",[ACE_Goggles_Current]] call CBA_fnc_localEvent;
};
};
player addEventHandler ["Explosion", {
if (alive player) then {
call ACE_Goggles_fnc_ApplyDirtEffect;
if (GETBROKEN) exitWith {};
if (((_this select 1) call ACE_Goggles_fnc_GetExplosionIndex) < getNumber(ConfigFile >> "CfgGlasses" >> ACE_Goggles_Current >> "ACE_Resistance")) exitWith {};
if !(player call ACE_Goggles_fnc_isGogglesVisible) exitWith {["GlassesCracked",[player]] call CBA_fnc_localEvent;};
ACE_Goggles_Effects set [BROKEN, true];
if (getText(ConfigFile >> "CfgGlasses" >> ACE_Goggles_Current >> "ACE_OverlayCracked") != "" && {cameraOn == player}) then {
if (call ACE_Goggles_fnc_ExternalCamera) exitWith {};
if (isNull(GLASSDISPLAY)) then {
150 cutRsc["RscACE_Goggles", "PLAIN",1, false];
};
(GLASSDISPLAY displayCtrl 10650) ctrlSetText getText(ConfigFile >> "CfgGlasses" >> ACE_Goggles_Current >> "ACE_OverlayCracked");
};
["GlassesCracked",[player]] call CBA_fnc_localEvent;
};
}];
player addEventHandler ["Killed",{
[] spawn {
sleep 2;
ACE_Goggles_PostProcessEyes ppEffectEnable false;
ACE_Goggles_Effects = GLASSESDEFAULT;
call ACE_Goggles_fnc_RemoveGlassesEffect;
ACE_Goggles_EffectsActive=false;
player setVariable ["ACE_EyesDamaged", false];
terminate ACE_Goggles_EyesDamageScript;
terminate ACE_Goggles_MainLoop;
terminate ACE_Goggles_DustHandler;
ACE_Goggles_MainLoop = [] spawn ACE_Goggles_fnc_CheckGoggles;
};
}];
player addEventHandler ["Fired",{[_this select 0, _this select 1] call ACE_Goggles_fnc_DustHandler;}];
player AddEventHandler ["Take",{call ACE_Goggles_fnc_CheckGlasses;}];
player AddEventHandler ["Put", {call ACE_Goggles_fnc_CheckGlasses;}];
["GlassesChanged",{
ACE_Goggles_Effects = GLASSESDEFAULT;
if (call ACE_Goggles_fnc_ExternalCamera) exitWith {call ACE_Goggles_fnc_RemoveGlassesEffect};
if (player call ACE_Goggles_fnc_isGogglesVisible) then {
(_this select 0) call ACE_Goggles_fnc_ApplyGlassesEffect;
} else {
call ACE_Goggles_fnc_RemoveGlassesEffect;
};
}] call CBA_fnc_addEventHandler;
["GlassesCracked",{
if (_this select 0 != player) exitWith {};
player setVariable ["ACE_EyesDamaged", true];
if !(scriptDone ACE_Goggles_EyesDamageScript) then {
terminate ACE_Goggles_EyesDamageScript;
};
ACE_Goggles_PostProcessEyes ppEffectAdjust[1, 1, 0, [0,0,0,0], [0.5,0.5,0.5,0.5],[1,1,1,0]];
ACE_Goggles_PostProcessEyes ppEffectCommit 0;
ACE_Goggles_PostProcessEyes ppEffectEnable true;
ACE_Goggles_EyesDamageScript = [] spawn {
sleep 25;
ACE_Goggles_PostProcessEyes ppEffectAdjust[1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]];
ACE_Goggles_PostProcessEyes ppEffectCommit 5;
sleep 5;
ACE_Goggles_PostProcessEyes ppEffectEnable false;
player setVariable ["ACE_EyesDamaged", false];
};
}] call CBA_fnc_addEventHandler;
ACE_Goggles_MainLoop = [] spawn ACE_Goggles_fnc_CheckGoggles;

View File

@ -0,0 +1,80 @@
/*
Name: ACE_Goggles_fnc_OnEachFrame
Author: Garth de Wet (LH)
Description:
Runs every frame checking for helicopters.
Parameters:
Nothing
Returns:
Nothing
Example:
["ACE_Goggles_RotorWash", "OnEachFrame", "call ACE_Goggles_fnc_OnEachFrame;"] call BIS_fnc_addStackedEventHandler;
*/
#include "\ACE_Goggles\script.sqf"
if (isNull(player)) then {
["ACE_Goggles_RotorWash", "OnEachFrame"] call BIS_fnc_removeStackedEventHandler;
};
ACE_Goggles_FrameEvent set [0, !(ACE_Goggles_FrameEvent select 0)];
if (ACE_Goggles_FrameEvent select 0) exitWith {
if (vehicle player != player && {!([player] call ACE_Core_fnc_isTurnedOut)}) exitWith {(ACE_Goggles_FrameEvent select 1) set [0, false]; };
ACE_Goggles_FrameEvent set [1, ([player] call ACE_Goggles_fnc_isInRotorWash)];
};
private ["_rotorWash","_safe"];
_rotorWash = ACE_Goggles_FrameEvent select 1;
_safe = false;
if !(_rotorWash select 0) exitWith {
if (ACE_Goggles_PostProcessEyes_Enabled) then {
ACE_Goggles_PostProcessEyes_Enabled = false;
if (!scriptDone (ACE_Goggles_DustHandler)) then {
terminate ACE_Goggles_DustHandler;
};
ACE_Goggles_DustHandler = [] spawn {
ACE_Goggles_PostProcessEyes ppEffectAdjust [1, 1, 0, [0,0,0,0], [0,0,0,1],[1,1,1,0]];
ACE_Goggles_PostProcessEyes ppEffectCommit 2;
sleep 2;
ACE_Goggles_PostProcessEyes ppEffectEnable false;
};
};
};
if ((headgear player) != "") then {
_safe = (getNumber (ConfigFile >> "CfgWeapons" >> (headgear player) >> "ACE_Protection") == 1);
};
if !(_safe) then {
if !(player call ACE_Goggles_fnc_isGogglesVisible) exitWith{};
if (GETDUSTT(DAMOUNT) < 2) then {
if (!GETDUSTT(DACTIVE)) then {
SETDUST(DACTIVE,true);
call ACE_Goggles_fnc_ApplyDust;
} else {
if ((_rotorWash select 1) > 0.5) then {
call ACE_Goggles_fnc_ApplyDust;
};
};
};
_safe = (getNumber (ConfigFile >> "CfgGlasses" >> ACE_Goggles_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 (!scriptDone (ACE_Goggles_DustHandler)) then {
terminate ACE_Goggles_DustHandler;
};
if !(player getVariable ["ACE_EyesDamaged", false]) then {
ACE_Goggles_PostProcessEyes_Enabled = true;
ACE_Goggles_PostProcessEyes ppEffectAdjust [1, 1, 0, [0,0,0,0], [_scale,_scale,_scale,_scale],[1,1,1,0]];
ACE_Goggles_PostProcessEyes ppEffectCommit 0.5;
ACE_Goggles_PostProcessEyes ppEffectEnable true;
};
};

View File

@ -0,0 +1,61 @@
/*
Name: ACE_Goggles_fnc_RainEffect
Author: Garth de Wet (LH)
Description:
Parameters:
Nothing
Returns:
Nothing
Example:
[] spawn ACE_Goggles_fnc_RainEffect;
*/
#include "\ACE_Goggles\script.sqf"
ACE_Goggles_RainDrops = objNull;
ACE_Goggles_Rain_Active = false;
_fnc_underCover = {
private ["_pos", "_unit"];
_unit = (_this select 0);
if (vehicle _unit != _unit && {!([_unit] call ACE_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 (!ACE_Goggles_EffectsActive || {underwater player}) exitWith{call ACE_Goggles_fnc_RemoveRainEffect;};
if (_lastRain != rain) then {
call ACE_Goggles_fnc_RemoveRainEffect;
_lastRain = rain;
// Rain is happening
if (_lastRain > 0.05 && {!([player] call _fnc_underCover)}) then {
ACE_Goggles_Rain_Active = true;
ACE_Goggles_RainDrops = "#particlesource" createVehicleLocal GetPos player;
ACE_Goggles_RainDrops setParticleClass "ACERainEffect";
ACE_Goggles_RainDrops setDropInterval (0.07 * (1.1 - _lastRain));
ACE_Goggles_RainDrops attachTo [vehicle player,[0,0,0]];
};
}else{
if (_lastRain > 0.05) then {
if (ACE_Goggles_Rain_Active && {[player] call _fnc_underCover}) exitWith {
call ACE_Goggles_fnc_RemoveRainEffect;
};
if (!ACE_Goggles_Rain_Active) then {
_lastRain = -1;
};
};
};
}else{
if (ACE_Goggles_Rain_Active) then {
call ACE_Goggles_fnc_RemoveRainEffect;
};
};
};

View File

@ -1,5 +1,5 @@
/* /*
Name: AGM_Goggles_fnc_RemoveDirtEffect Name: ACE_Goggles_fnc_RemoveDirtEffect
Author: Garth de Wet (LH) Author: Garth de Wet (LH)
@ -13,8 +13,8 @@
Nothing Nothing
Example: Example:
call AGM_Goggles_fnc_RemoveDirtEffect; call ACE_Goggles_fnc_RemoveDirtEffect;
*/ */
if (!isNull(uiNamespace getVariable ["AGM_Goggles_DisplayEffects", displayNull])) then { if (!isNull(uiNamespace getVariable ["ACE_Goggles_DisplayEffects", displayNull])) then {
(uiNamespace getVariable ["AGM_Goggles_DisplayEffects", displayNull] displayCtrl 10660) ctrlSetText ""; (uiNamespace getVariable ["ACE_Goggles_DisplayEffects", displayNull] displayCtrl 10660) ctrlSetText "";
}; };

View File

@ -1,5 +1,5 @@
/* /*
Name: AGM_Goggles_fnc_RemoveDustEffect Name: ACE_Goggles_fnc_RemoveDustEffect
Author: Garth de Wet (LH) Author: Garth de Wet (LH)
@ -13,8 +13,8 @@
Nothing Nothing
Example: Example:
call AGM_Goggles_fnc_RemoveDustEffect; call ACE_Goggles_fnc_RemoveDustEffect;
*/ */
if (!isNull(uiNamespace getVariable ["AGM_Goggles_DisplayEffects", displayNull])) then { if (!isNull(uiNamespace getVariable ["ACE_Goggles_DisplayEffects", displayNull])) then {
(uiNamespace getVariable ["AGM_Goggles_DisplayEffects", displayNull] displayCtrl 10662) ctrlSetText ""; (uiNamespace getVariable ["ACE_Goggles_DisplayEffects", displayNull] displayCtrl 10662) ctrlSetText "";
}; };

View File

@ -1,5 +1,5 @@
/* /*
Name: AGM_Goggles_fnc_RemoveGlassesEffect Name: ACE_Goggles_fnc_RemoveGlassesEffect
Author: Garth de Wet (LH) Author: Garth de Wet (LH)
@ -14,16 +14,16 @@
Nothing Nothing
Example: Example:
call AGM_Goggles_fnc_RemoveGlassesEffect; call ACE_Goggles_fnc_RemoveGlassesEffect;
*/ */
#include "\AGM_Goggles\script.sqf" #include "\ACE_Goggles\script.sqf"
AGM_Goggles_EffectsActive = false; ACE_Goggles_EffectsActive = false;
AGM_Goggles_PostProcess ppEffectEnable false; ACE_Goggles_PostProcess ppEffectEnable false;
if (!isNull(GLASSDISPLAY)) then { if (!isNull(GLASSDISPLAY)) then {
GLASSDISPLAY closeDisplay 0; GLASSDISPLAY closeDisplay 0;
}; };
call AGM_Goggles_fnc_RemoveDirtEffect; call ACE_Goggles_fnc_RemoveDirtEffect;
call AGM_Goggles_fnc_RemoveRainEffect; call ACE_Goggles_fnc_RemoveRainEffect;
call AGM_Goggles_fnc_RemoveDustEffect; call ACE_Goggles_fnc_RemoveDustEffect;

View File

@ -0,0 +1,21 @@
/*
Name: ACE_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 ACE_Goggles_fnc_RemoveRainEffect;
*/
if (!isNull (ACE_Goggles_RainDrops)) then {
deleteVehicle (ACE_Goggles_RainDrops);
};
ACE_Goggles_Rain_Active = false;

View File

@ -1,5 +1,5 @@
/* /*
Name: AGM_Goggles_fnc_isDivingGoggles Name: ACE_Goggles_fnc_isDivingGoggles
Author: Garth de Wet (LH) Author: Garth de Wet (LH)
@ -13,7 +13,7 @@
Boolean - whether diving goggles are worn Boolean - whether diving goggles are worn
Example: Example:
(goggles player) call AGM_Goggles_fnc_isDivingGoggles; (goggles player) call ACE_Goggles_fnc_isDivingGoggles;
*/ */
private ["_result", "_glasses"]; private ["_result", "_glasses"];
_glasses = _this; _glasses = _this;

View File

@ -1,5 +1,5 @@
/* /*
Name: AGM_Goggles_fnc_isGogglesVisible Name: ACE_Goggles_fnc_isGogglesVisible
Author: Garth de Wet (LH) Author: Garth de Wet (LH)
@ -13,7 +13,7 @@
BOOL - Whether the goggles are visible or not. BOOL - Whether the goggles are visible or not.
Example: Example:
_visible = player call AGM_Goggles_fnc_isGogglesVisible; _visible = player call ACE_Goggles_fnc_isGogglesVisible;
*/ */
private ["_currentGlasses", "_result", "_unit"]; private ["_currentGlasses", "_result", "_unit"];
_unit = _this; _unit = _this;
@ -26,12 +26,12 @@ if ((vehicle _unit) != _unit) exitWith {(cameraView != "GUNNER")};
if (_currentGlasses != "") then { if (_currentGlasses != "") then {
_position =(getPosASLW _unit); _position =(getPosASLW _unit);
if (surfaceIsWater _position && {((_position select 2) < 0.25)}) exitWith { if (surfaceIsWater _position && {((_position select 2) < 0.25)}) exitWith {
_result = (_currentGlasses call AGM_Goggles_fnc_isDivingGoggles); _result = (_currentGlasses call ACE_Goggles_fnc_isDivingGoggles);
}; };
if (getNumber (ConfigFile >> "CfgGlasses" >> _currentGlasses >> "AGM_Resistance") == 0) exitWith { if (getNumber (ConfigFile >> "CfgGlasses" >> _currentGlasses >> "ACE_Resistance") == 0) exitWith {
_result = false; _result = false;
}; };
_result = !(_currentGlasses call AGM_Goggles_fnc_isDivingGoggles); _result = !(_currentGlasses call ACE_Goggles_fnc_isDivingGoggles);
}; };
_result _result

View File

@ -1,5 +1,5 @@
/* /*
Name: AGM_Goggles_fnc_isInRotorWash Name: ACE_Goggles_fnc_isInRotorWash
Author: Garth de Wet (LH) Author: Garth de Wet (LH)
@ -16,8 +16,8 @@
1 - number - Amount of rotor wash. 1 - number - Amount of rotor wash.
Example: Example:
if (([player, 10] call AGM_Goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; }; if (([player, 10] call ACE_Goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; };
if (([player] call AGM_Goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; }; if (([player] call ACE_Goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; };
*/ */
private ["_heli", "_unit", "_result", "_radius"]; private ["_heli", "_unit", "_result", "_radius"];
_unit = _this select 0; _unit = _this select 0;

21
addons/goggles/script.sqf Normal file
View File

@ -0,0 +1,21 @@
#define GLASSESDEFAULT [false,[false,0,0,0],false]
#define DIRT 0
#define DUST 1
#define BROKEN 2
#define GETDIRT (ACE_Goggles_Effects select DIRT)
#define GETDUST (ACE_Goggles_Effects select DUST)
#define GETBROKEN (ACE_Goggles_Effects select BROKEN)
#define GETDUSTT(type) ((ACE_Goggles_Effects select DUST) select type)
#define SETDUST(type,value) (ACE_Goggles_Effects select DUST) set [type, value]
#define DACTIVE 0
#define DTIME 1
#define DBULLETS 2
#define DAMOUNT 3
#define GLASSDISPLAY (uiNamespace getVariable ["ACE_Goggles_Display", displayNull])
#define CLAMP(x,low,high) (if(x > high)then{high}else{if(x < low)then{low}else{x}})

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-19 --> <!-- Edited with tabler - 2014-12-19 -->
<Project name="AGM"> <Project name="ACE">
<Package name="Goggles"> <Package name="Goggles">
<Key ID="STR_AGM_Goggles_ShowInThirdPerson"> <Key ID="STR_ACE_Goggles_ShowInThirdPerson">
<English>Show Goggle Effects in Third Person</English> <English>Show Goggle Effects in Third Person</English>
<German>Brilleneffekt in dritter Person anzeigen</German> <German>Brilleneffekt in dritter Person anzeigen</German>
<Spanish>Mostrar efectos de las gafas en tercera persona</Spanish> <Spanish>Mostrar efectos de las gafas en tercera persona</Spanish>
@ -14,7 +14,7 @@
<Portuguese>Mostrar efeitos de óculos em Terceira Pessoa</Portuguese> <Portuguese>Mostrar efeitos de óculos em Terceira Pessoa</Portuguese>
<Italian>Attiva l'effetto degli occhiali in terza persona</Italian> <Italian>Attiva l'effetto degli occhiali in terza persona</Italian>
</Key> </Key>
<Key ID="STR_AGM_Goggles_WipeGlasses"> <Key ID="STR_ACE_Goggles_WipeGlasses">
<English>Wipe Goggles</English> <English>Wipe Goggles</English>
<German>Brille abwischen</German> <German>Brille abwischen</German>
<Spanish>Limpiar gafas</Spanish> <Spanish>Limpiar gafas</Spanish>