Merge pull request #124 from KoffeinFlummi/GogglesHeaderFix

Updated headers of the goggles to be as required.
This commit is contained in:
Nicolás Badano 2015-02-03 15:12:30 -03:00
commit 9773f7b838
19 changed files with 292 additions and 302 deletions

View File

@ -1,18 +1,19 @@
/*
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
*/
* Author: Garth 'L-H' de Wet
* 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.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* None
*
* Public: No
*/
#include "script_component.hpp"
if (!hasInterface) exitWith {};
@ -57,7 +58,7 @@ player addEventHandler ["Explosion", {
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);};
if !([ace_player] call FUNC(isGogglesVisible)) exitWith {["GlassesCracked",[ace_player]] call EFUNC(common,localEvent);};
_effects = GETGLASSES(ace_player);
_effects set [BROKEN, true];
SETGLASSES(ace_player,_effects);
@ -94,8 +95,8 @@ player AddEventHandler ["Put", {call FUNC(checkGlasses);}];
if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)};
if (ace_player call FUNC(isGogglesVisible)) then {
(_this select 0) call FUNC(applyGlassesEffect);
if ([ace_player] call FUNC(isGogglesVisible)) then {
[_this select 0] call FUNC(applyGlassesEffect);
} else {
call FUNC(removeGlassesEffect);
};

View File

@ -1,3 +1,18 @@
/*
* Author: Garth 'L-H' de Wet
* Initialises Goggles.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* None
*
* Public: No
*/
#include "script_component.hpp"
ADDON = false;

View File

@ -1,20 +1,18 @@
/*
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);
*/
* Author: Garth 'L-H' de Wet
* Adds dirt effect to the glasses.
*
* Arguments:
* None
*
* Return Value:
* Succeeded <BOOL>
*
* Example:
* _applied = call ace_goggles_fnc_ApplyDirtEffect;
*
* Public: Yes
*/
#include "script_component.hpp"
if (cameraOn != ace_player || {call FUNC(externalCamera)}) exitWith{false};
@ -23,7 +21,7 @@ _effects = GETGLASSES(ace_player);
_effects set [DIRT, true];
SETGLASSES(ace_player,_effects);
if (ace_player call FUNC(isGogglesVisible)) then{
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];

View File

@ -1,23 +1,21 @@
/*
Name: fnc_applyDust.sqf
Author: Garth de Wet (LH)
Description:
Applies dust to screen.
Parameters:
Nothing
Returns:
Nothing
Example 1:
call FUNC(ApplyDust);
*/
* Author: Garth 'L-H' de Wet
* Applies dust to screen.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ace_goggles_fnc_ApplyDust;
*
* Public: Yes
*/
#include "script_component.hpp"
if (call FUNC(ExternalCamera)) exitWith {};
if (ace_player call FUNC(isGogglesVisible)) 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));

View File

@ -1,26 +1,24 @@
/*
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:
0: STRING - Glasses class name to be applied.
Returns:
Nothing
Example:
(goggles ace_player) call FUNC(ApplyGlassesEffect);
*/
* Author: Garth 'L-H' de Wet
* Sets screen tint for glasses.
* Sets screen overlay for glasses. (broken/fixed)
* Sets dirt/rain overlay for glasses.
*
* Arguments:
* 0: Glasses classname to be applied <STRING>
*
* Return Value:
* None
*
* Example:
* [goggles ace_player] call ace_goggles_fnc_ApplyGlassesEffect;
*
* Public: No
*/
#include "script_component.hpp"
private["_postProcessColour", "_postProcessTintAmount", "_glassesClassname", "_glassImagePath"];
_glassesClassname = _this;
_glassesClassname = _this select 0;
_postProcessColour = getArray(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_Color");
_postProcessTintAmount = getNumber(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_TintAmount");

View File

@ -1,10 +1,19 @@
/*
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.
*/
* Author: Garth 'L-H' de Wet
* Performs rain checks and checks to see whether glasses effects have been applied or not.
* Checks for external camera and removes effects.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* None
*
* Public: No
*/
#include "script_component.hpp"
if (!alive ace_player) exitWith {};
if (true) then {
@ -15,7 +24,7 @@ if (true) then {
};
};
call FUNC(checkGlasses);
if !(ace_player call FUNC(isGogglesVisible)) exitWith {
if !([ace_player] call FUNC(isGogglesVisible)) exitWith {
if (GVAR(EffectsActive)) then {
call FUNC(removeGlassesEffect);
};
@ -26,9 +35,9 @@ if (true) then {
};
};
if !(GVAR(EffectsActive)) then {
(goggles ace_player) call FUNC(applyGlassesEffect);
[goggles ace_player] call FUNC(applyGlassesEffect);
} else {
if ((goggles ace_player) call FUNC(isDivingGoggles) && {underwater ace_player}) then {
if ([goggles ace_player] call FUNC(isDivingGoggles) && {underwater ace_player}) then {
call FUNC(removeRainEffect);
call FUNC(removeDirtEffect);
call FUNC(removeDustEffect);

View File

@ -1,21 +1,19 @@
/*
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);
*/
* Author: Garth 'L-H' de Wet
* Clears all dirt, rain, dust from glasses.
* Removes glasses effect (PP, overlay) and then puts it back.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ace_goggles_fnc_ClearGlasses;
*
* Public: Yes
*/
#include "script_component.hpp"
private "_broken";

View File

@ -1,22 +1,19 @@
/*
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:
0: Object - unit - eventhandler was attached to. (Used)
1: String - weapon - Weapon fired (Used)
Returns:
Nothing
Example:
ace_player addEventHandler ["Fired", {[_this select 0, _this select 1] call FUNC(DustHandler;}];
See http://community.bistudio.com/wiki/ArmA_3:_Event_Handlers#Fired
*/
* Author: Garth 'L-H' de Wet
* Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Weapon <STRING>
*
* Return Value:
* None
*
* Example:
*ace_player addEventHandler ["Fired", {[_this select 0, _this select 1] call ace_goggles_fnc_dustHandler;}];
*
* Public: No
*/
#include "script_component.hpp"
private ["_bullets", "_position", "_surface", "_found", "_weapon", "_cloudType", "_unit"];
EXPLODE_2_PVT(_this,_unit,_weapon);

View File

@ -1,22 +1,18 @@
/*
fnc_ExternalCamera.sqf
Author: Garth de Wet (LH)
Description:
Returns if the camera is external or not.
Parameters:
Nothing
Returns:
Boolean - whether the camera is in external view or not.
If the "showInThirdPerson" option is checked, this will always return false.
Example:
call FUNC(ExternalCamera);
*/
* Author: Garth 'L-H' de Wet
* Returns if the camera is external or not.
*
* Arguments:
* None
*
* Return Value:
* Whether the camera is in external view or not. If the "showInThirdPerson" option is checked, this will always return false. <BOOL>
*
* Example:
* call ace_goggles_fnc_removeRainEffect;
*
* Public: Yes
*/
#include "script_component.hpp"
if ((missionNameSpace getVariable [QGVAR(showInThirdPerson), 0]) == 1) exitWith { false };

View File

@ -1,20 +1,18 @@
/*
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);
*/
* Author: Garth 'L-H' de Wet
* Turns 0-1 damage of explosion Event into a rating system of 0-3
*
* Arguments:
* 0: The amount of damage <NUMBER>
*
* Return Value:
* The rating [0-3] <NUMBER>
*
* Example:
* _rating = 0.05 call ace_goggles_fnc_getExplosionIndex;
*
* Public: No
*/
private ["_effectIndex"];
_effectIndex = switch true do {

View File

@ -1,23 +1,21 @@
/*
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:
0: String - Glasses classname
Returns:
Boolean - whether diving goggles are worn
Example:
(goggles ace_player) call FUNC(isDivingGoggles);
*/
* Author: Garth 'L-H' de Wet
* Determines whether passed goggles is diving goggles or a variant of them.
*
* Arguments:
* 0: Glasses classname <STRING>
*
* Return Value:
* Whether diving goggles are worn <BOOL>
*
* Example:
* [(goggles ace_player)] call ace_goggles_fnc_isDivingGoggles;
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_result", "_glasses"];
_glasses = _this;
_glasses = _this select 0;
_result = _glasses == "G_Diving";
if (_result) exitWith {true};
_result = [configFile >> "CfgGlasses" >> _glasses, configFile >> "CfgGlasses" >> "G_Diving"] call CBA_fnc_inheritsFrom;

View File

@ -1,23 +1,21 @@
/*
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:
0: Object - unit to check for visible goggles
Returns:
BOOL - Whether the goggles are visible or not.
Example:
_visible = ace_player call FUNC(isGogglesVisible);
*/
* Author: Garth 'L-H' de Wet
* Determines if goggles are visible on passed unit (Also checks if unit is in vehicle and cameraView is set to GUNNER)
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* Whether goggles are visible <BOOL>
*
* Example:
* _visible = [ace_player] call ace_goggles_fnc_isGogglesVisible;
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_currentGlasses", "_result", "_unit"];
_unit = _this;
_unit = _this select 0;
_currentGlasses = goggles _unit;
_result = false;
@ -27,12 +25,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 FUNC(isDivingGoggles));
_result = ([_currentGlasses] call FUNC(isDivingGoggles));
};
if (getNumber (ConfigFile >> "CfgGlasses" >> _currentGlasses >> "ACE_Resistance") == 0) exitWith {
_result = false;
};
_result = !(_currentGlasses call FUNC(isDivingGoggles));
_result = !([_currentGlasses] call FUNC(isDivingGoggles));
};
_result

View File

@ -1,24 +1,22 @@
/*
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 (([ace_player, 10] call FUNC(isInRotorWash)) select 0) then { hint "Rotor wash"; };
if (([ace_player] call FUNC(isInRotorWash)) select 0) then { hint "Rotor wash"; };
*/
* Author: Garth 'L-H' de Wet
* Checks for nearby running helicopters (within 15m)
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Radius to check for helicopter Default: 15 (optional) <NUMBER>
*
* Return Value:
* <ARRAY>:
* 0: In rotorwash <BOOL>
* 1: Amount of rotor wash. <NUMBER>
*
* Example:
* if (([ace_player, 10] call ace_goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; };
* if (([ace_player] call ace_goggles_fnc_isInRotorWash) select 0) then { hint "Rotor wash"; };
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_heli", "_unit", "_result", "_radius"];
_unit = _this select 0;

View File

@ -1,20 +1,18 @@
/*
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;
*/
* Author: Garth 'L-H' de Wet
* Checks whether the player is in the downwash of a helicopter and handles applying effects of that.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* ["ACE_Goggles_RotorWash", "OnEachFrame", "call ace_goggles_fnc_OnEachFrame;"] call BIS_fnc_addStackedEventHandler;
*
* Public: No
*/
#include "script_component.hpp"
if (isNull(ace_player)) exitWith {};
GVAR(FrameEvent) set [0, !(GVAR(FrameEvent) select 0)];
@ -44,7 +42,7 @@ 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 !([ace_player] call FUNC(isGogglesVisible)) exitWith{};
if (GETDUSTT(DAMOUNT) < 2) then {
if (!GETDUSTT(DACTIVE)) then {
SETDUST(DACTIVE,true);

View File

@ -1,20 +1,18 @@
/*
fnc_rainEffect.sqf
Author: Garth de Wet (LH)
Description:
Parameters:
Nothing
Returns:
Nothing
Example:
[] call FUNC(RainEffect);
*/
* Author: Garth 'L-H' de Wet
* Handles rain effects being created on glasses.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ace_goggles_fnc_rainEffect;
*
* Public: No
*/
#include "script_component.hpp"
private ["_fnc_underCover"];
if (isNull(ace_player) || {!(alive ace_player)}) exitWith {};

View File

@ -1,20 +1,18 @@
/*
fnc_removeDirtEffect.sqf
Author: Garth de Wet (LH)
Description:
Removes dirt from the glasses.
Parameters:
Nothing
Returns:
Nothing
Example:
call FUNC(RemoveDirtEffect);
*/
* Author: Garth 'L-H' de Wet
* Removes dirt from the glasses.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ace_goggles_fnc_removeDirtEffect;
*
* Public: Yes
*/
#include "script_component.hpp"
if (!isNull(GETUVAR(GVAR(DisplayEffects),displayNull))) then {
(GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10660) ctrlSetText "";

View File

@ -1,20 +1,18 @@
/*
fnc_removeDustEffect.sqf
Author: Garth de Wet (LH)
Description:
Removes dust from the glasses.
Parameters:
Nothing
Returns:
Nothing
Example:
call FUNC(RemoveDustEffect);
*/
* Author: Garth 'L-H' de Wet
* Removes dust from the glasses.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ace_goggles_fnc_removeDustEffect;
*
* Public: Yes
*/
#include "script_component.hpp"
if (!isNull(GETUVAR(GVAR(DisplayEffects),displayNull))) then {
(GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10662) ctrlSetText "";

View File

@ -1,21 +1,19 @@
/*
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);
*/
* Author: Garth 'L-H' de Wet
* 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.)
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ace_goggles_fnc_removeGlassesEffect;
*
* Public: Yes
*/
#include "script_component.hpp"
GVAR(EffectsActive) = false;
GVAR(PostProcess) ppEffectEnable false;

View File

@ -1,20 +1,18 @@
/*
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);
*/
* Author: Garth 'L-H' de Wet
* Removes rain effects from the screen.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ace_goggles_fnc_removeRainEffect;
*
* Public: Yes
*/
#include "script_component.hpp"
if (!isNull (GVAR(RainDrops))) then {
deleteVehicle (GVAR(RainDrops));