Headers and formating

This commit is contained in:
PabstMirror 2015-02-17 22:07:29 -06:00
parent c291f29702
commit e649c8e853
8 changed files with 117 additions and 93 deletions

View File

@ -1,19 +1,19 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit) );
};
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit) );
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient) );
};
class ADDON {
clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient) );
};
};
class Extended_FiredBIS_EventHandlers {
class AllVehicles {
class ADDON {
clientFiredBIS = QUOTE( _this call FUNC(blending) );
class AllVehicles {
class ADDON {
clientFiredBIS = QUOTE( _this call FUNC(blending) );
};
};
};
};

View File

@ -1,22 +1,22 @@
class CfgVehicles {
class All {
ACE_NightVision_grain = 0.75;
ACE_NightVision_blur = 0.055;
};
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
};
class Box_NATO_Support_F;
class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_NVG_Gen1,6)
MACRO_ADDITEM(ACE_NVG_Gen2,6)
//MACRO_ADDITEM(ACE_NVG_Gen3,6)
MACRO_ADDITEM(ACE_NVG_Gen4,6)
MACRO_ADDITEM(ACE_NVG_Wide,6)
class All {
ACE_NightVision_grain = 0.75;
ACE_NightVision_blur = 0.055;
};
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
};
class Box_NATO_Support_F;
class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_NVG_Gen1,6)
MACRO_ADDITEM(ACE_NVG_Gen2,6)
//MACRO_ADDITEM(ACE_NVG_Gen3,6)
MACRO_ADDITEM(ACE_NVG_Gen4,6)
MACRO_ADDITEM(ACE_NVG_Wide,6)
};
};
};
};

View File

@ -3,8 +3,7 @@
ADDON = false;
PREP(blending);
PREP(decreaseNVGBrightness);
PREP(increaseNVGBrightness);
PREP(changeNVGBrightness);
PREP(updatePPEffects);
ADDON = true;

View File

@ -1,4 +1,24 @@
// by commy2
/*
* Author: commy2
* Change the blending when the player fires??
*
* Arguments:
* 0: unit - Object the event handler is assigned to <OBJECT>
* 1: weapon - Fired weapon <STRING>
* 2: muzzle - Muzzle that was used <STRING>
* 3: mode - Current mode of the fired weapon <STRING>
* 4: ammo - Ammo used <STRING>
* 5: magazine - magazine name which was used <STRING>
* 6: projectile - Object of the projectile that was shot <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* [clientFiredBIS-XEH] call ace_nightvision_fnc_blending
*
* Public: No
*/
#include "script_component.hpp"
private ["_vehicle", "_weapon", "_ammo", "_magazine", "_player"];
@ -8,26 +28,26 @@ _weapon = _this select 1;
_ammo = _this select 4;
_magazine = _this select 5;
if ((_vehicle != (vehicle ACE_player)) || {(currentVisionMode _vehicle) != 1}) exitWith {};
_player = ACE_player;
if ((_vehicle != (vehicle _player)) || {(currentVisionMode _player) != 1}) exitWith {};
if (_player != _vehicle && {!(_weapon in (_vehicle weaponsTurret ([_player] call EFUNC(common,getTurretIndex))))}) exitWith {};
private ["_silencer", "_visibleFireCoef", "_visibleFireTimeCoef", "_visibleFire", "_visibleFireTime", "_nvgBrightnessCoef", "_fnc_isTracer", "_darkness"];
_silencer = switch (_weapon) do {
case (primaryWeapon _player) : {primaryWeaponItems _player select 0};
case (secondaryWeapon _player) : {secondaryWeaponItems _player select 0};
case (handgunWeapon _player) : {handgunItems _player select 0};
default {""};
case (primaryWeapon _player) : {primaryWeaponItems _player select 0};
case (secondaryWeapon _player) : {secondaryWeaponItems _player select 0};
case (handgunWeapon _player) : {handgunItems _player select 0};
default {""};
};
_visibleFireCoef = 1;
_visibleFireTimeCoef = 1;
if (_silencer != "") then {
_visibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFire");
_visibleFireTimeCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFireTime");
_visibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFire");
_visibleFireTimeCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFireTime");
};
_visibleFire = getNumber (configFile >> "CfgAmmo" >> _ammo >> "visibleFire");
@ -36,24 +56,24 @@ _visibleFireTime = getNumber (configFile >> "CfgAmmo" >> _ammo >> "visibleFireTi
_nvgBrightnessCoef = 1 + (_player getVariable [QGVAR(NVGBrightness), 0]) / 4;
_fnc_isTracer = {
private ["_indexShot", "_lastRoundsTracer", "_tracersEvery"];
private ["_indexShot", "_lastRoundsTracer", "_tracersEvery"];
if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "nvgOnly") > 0) exitWith {false};
if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "nvgOnly") > 0) exitWith {false};
_indexShot = (_player ammo _weapon) + 1;
_indexShot = (_player ammo _weapon) + 1;
_lastRoundsTracer = getNumber (configFile >> "CfgMagazines" >> _magazine >> "lastRoundsTracer");
if (_indexShot <= _lastRoundsTracer) exitWith {true};
_lastRoundsTracer = getNumber (configFile >> "CfgMagazines" >> _magazine >> "lastRoundsTracer");
if (_indexShot <= _lastRoundsTracer) exitWith {true};
_tracersEvery = getNumber (configFile >> "CfgMagazines" >> _magazine >> "tracersEvery");
if (_tracersEvery == 0) exitWith {false};
_tracersEvery = getNumber (configFile >> "CfgMagazines" >> _magazine >> "tracersEvery");
if (_tracersEvery == 0) exitWith {false};
(_indexShot - _lastRoundsTracer) % _tracersEvery == 0
(_indexShot - _lastRoundsTracer) % _tracersEvery == 0
};
if (call _fnc_isTracer) then {
_visibleFire = _visibleFire + 2;
_visibleFireTime = _visibleFireTime + 2;
_visibleFire = _visibleFire + 2;
_visibleFireTime = _visibleFireTime + 2;
};
_darkness = 1 - (call EFUNC(common,ambientBrightness));

View File

@ -0,0 +1,33 @@
/*
* Author: commy2
* Change the brightness of the unit's NVG
*
* Arguments:
* 0: The Unit <OBJECT>
* 1: Change in brightness (1 or -1) <SCALAR>
*
* Return Value:
* Nothing
*
* Example:
* [player, 1] call ace_nightvision_fnc_changeNVGBrightness
*
* Public: No
*/
#include "script_component.hpp"
private ["_brightness"];
PARAMS_2(_player,_changeInBrightness);
_brightness = _player getVariable [QGVAR(NVGBrightness), 0];
_brightness = ((round (10 * _brightness + _changeInBrightness) / 10) min 1) max -1;
_player setVariable [QGVAR(NVGBrightness), _brightness, false];
GVAR(ppEffectNVGBrightness) ppEffectAdjust [1, 1, _brightness / 4, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]];
GVAR(ppEffectNVGBrightness) ppEffectCommit 0;
[format [(localize "STR_ACE_NightVision_NVGBrightness"), (_brightness * 100)]] call EFUNC(common,displayTextStructured);
playSound "ACE_Sound_Click";

View File

@ -1,21 +0,0 @@
// by commy2
#include "script_component.hpp"
private ["_player", "_vehicle", "_brightness"];
_player = _this select 0;
_vehicle = _this select 1;
_brightness = _player getVariable [QGVAR(NVGBrightness), 0];
if (_brightness > -1) then {
_brightness = round (10 * _brightness - 1) / 10;
_player setVariable [QGVAR(NVGBrightness), _brightness, false];
GVAR(ppEffectNVGBrightness) ppEffectAdjust [1, 1, _brightness / 4, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]];
GVAR(ppEffectNVGBrightness) ppEffectCommit 0;
[format [localize "STR_ACE_NightVision_NVGBrightness", format ["%1%", _brightness * 100]]] call EFUNC(common,displayTextStructured);
playSound "ACE_Sound_Click";
};

View File

@ -1,21 +0,0 @@
// by commy2
#include "script_component.hpp"
private ["_player", "_vehicle", "_brightness"];
_player = _this select 0;
_vehicle = _this select 1;
_brightness = _player getVariable [QGVAR(NVGBrightness), 0];
if (_brightness < 1) then {
_brightness = round (10 * _brightness + 1) / 10;
_player setVariable [QGVAR(NVGBrightness), _brightness, false];
GVAR(ppEffectNVGBrightness) ppEffectAdjust [1, 1, _brightness / 4, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]];
GVAR(ppEffectNVGBrightness) ppEffectCommit 0;
[format [localize "STR_ACE_NightVision_NVGBrightness", format ["%1%", _brightness * 100]]] call EFUNC(common,displayTextStructured);
playSound "ACE_Sound_Click";
};

View File

@ -1,4 +1,18 @@
//by commy2, PabstMirror and CAA-Picard
/*
* Author: commy2, PabstMirror and CAA-Picard
* Update the ppEffects everytime something changes
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
* [someEvent] call ace_nightvision_fnc_updatePPEffects
*
* Public: No
*/
#include "script_component.hpp"
private ["_currentVehicle", "_grainSetting", "_blurSetting", "_radBlurSetting", "_config"];