2015-02-18 04:07:29 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
2016-02-06 20:42:44 +00:00
|
|
|
* Change the blending when the player fires??. Called from the unified fired EH only for the local player and his vehicle.
|
2015-02-18 04:07:29 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2016-02-06 20:42:44 +00:00
|
|
|
* None. Parameters inherited from EFUNC(common,firedEH)
|
2015-02-18 04:07:29 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Nothing
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [clientFiredBIS-XEH] call ace_nightvision_fnc_blending
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-12 22:08:37 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2016-02-06 20:42:44 +00:00
|
|
|
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
|
|
|
|
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
|
2015-01-12 22:08:37 +00:00
|
|
|
|
2016-06-04 21:57:19 +00:00
|
|
|
private _player = ACE_player;
|
2015-09-18 17:48:59 +00:00
|
|
|
|
2016-06-04 19:26:38 +00:00
|
|
|
//If we're not in NVG mode, or it's a grenade, exit
|
2016-06-04 21:57:19 +00:00
|
|
|
if (currentVisionMode _player != 1 || {toLower _weapon in ["throw", "put"]}) exitWith {};
|
2015-01-12 22:08:37 +00:00
|
|
|
|
2016-06-04 21:57:19 +00:00
|
|
|
private _silencer = _player weaponAccessories _weapon select 0;
|
2015-01-12 22:08:37 +00:00
|
|
|
|
2016-06-04 21:57:19 +00:00
|
|
|
private _visibleFireCoef = 1;
|
|
|
|
private _visibleFireTimeCoef = 1;
|
2015-01-12 22:08:37 +00:00
|
|
|
|
|
|
|
if (_silencer != "") then {
|
2015-02-18 04:07:29 +00:00
|
|
|
_visibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFire");
|
|
|
|
_visibleFireTimeCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFireTime");
|
2015-01-12 22:08:37 +00:00
|
|
|
};
|
|
|
|
|
2016-06-04 21:57:19 +00:00
|
|
|
private _visibleFire = getNumber (configFile >> "CfgAmmo" >> _ammo >> "visibleFire");
|
|
|
|
private _visibleFireTime = getNumber (configFile >> "CfgAmmo" >> _ammo >> "visibleFireTime");
|
2015-01-12 22:08:37 +00:00
|
|
|
|
2016-06-04 21:57:19 +00:00
|
|
|
private _fnc_isTracer = {
|
2015-02-18 04:07:29 +00:00
|
|
|
if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "nvgOnly") > 0) exitWith {false};
|
2015-01-12 22:08:37 +00:00
|
|
|
|
2016-06-04 21:57:19 +00:00
|
|
|
private _indexShot = (_player ammo _weapon) + 1;
|
2015-01-12 22:08:37 +00:00
|
|
|
|
2016-06-04 21:57:19 +00:00
|
|
|
private _lastRoundsTracer = getNumber (configFile >> "CfgMagazines" >> _magazine >> "lastRoundsTracer");
|
2015-02-18 04:07:29 +00:00
|
|
|
if (_indexShot <= _lastRoundsTracer) exitWith {true};
|
2015-01-12 22:08:37 +00:00
|
|
|
|
2016-06-04 21:57:19 +00:00
|
|
|
private _tracersEvery = getNumber (configFile >> "CfgMagazines" >> _magazine >> "tracersEvery");
|
2015-02-18 04:07:29 +00:00
|
|
|
if (_tracersEvery == 0) exitWith {false};
|
2015-01-12 22:08:37 +00:00
|
|
|
|
2015-02-18 04:07:29 +00:00
|
|
|
(_indexShot - _lastRoundsTracer) % _tracersEvery == 0
|
2015-01-12 22:08:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (call _fnc_isTracer) then {
|
2015-02-18 04:07:29 +00:00
|
|
|
_visibleFire = _visibleFire + 2;
|
|
|
|
_visibleFireTime = _visibleFireTime + 2;
|
2015-01-12 22:08:37 +00:00
|
|
|
};
|
|
|
|
|
2016-06-04 21:57:19 +00:00
|
|
|
private _darkness = 1 - (call EFUNC(common,ambientBrightness));
|
|
|
|
private _nvgBrightnessCoef = 1 + (_player getVariable [QGVAR(NVGBrightness), 0]) / 4;
|
2015-01-12 22:08:37 +00:00
|
|
|
|
|
|
|
_visibleFire = _darkness * _visibleFireCoef * _visibleFire * _nvgBrightnessCoef / 10 min 1;
|
|
|
|
_visibleFireTime = _darkness * _visibleFireTimeCoef * _visibleFireTime * _nvgBrightnessCoef / 10 min 0.5;
|
|
|
|
|
2015-09-16 15:55:23 +00:00
|
|
|
TRACE_2("Player Shot, Adjusting NVG Effect", _visibleFire, _visibleFireTime);
|
2015-01-12 22:08:37 +00:00
|
|
|
|
|
|
|
GVAR(ppEffectMuzzleFlash) ppEffectAdjust [1, 1, _visibleFire, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]];
|
|
|
|
GVAR(ppEffectMuzzleFlash) ppEffectCommit 0;
|
|
|
|
|
|
|
|
GVAR(ppEffectMuzzleFlash) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]];
|
|
|
|
GVAR(ppEffectMuzzleFlash) ppEffectCommit _visibleFireTime;
|