Minor optimizations using private, params, and isEqualType (#4323)

* Optimizations with private, params, and isEqualType

* Fixed tab being used instead of space

* Fixed tabs inserted by notepad++

* More usage of new private syntax and params

- changed a few checks for an array being empty to `_arr isEqualTo []`
rather than `count _arr == 0`
- added more uses of `private` on the same line as the variable is
declared
- added more uses of params to assign variables passed as parameters
- removed unnecessary parentheses
- removed several unnecessary variable declarations with private array
syntax

* clean up and formatting
This commit is contained in:
Glowbal 2016-09-04 16:44:22 +02:00 committed by GitHub
parent 60b780e02b
commit b489750d5b
205 changed files with 589 additions and 904 deletions

View File

@ -14,24 +14,22 @@
*/
#include "script_component.hpp"
private ["_muzzleVelocityShiftTableUpperLimit", "_temperatureIndexFunction",
"_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"];
params["_muzzleVelocityShiftTable", "_temperature"];
params ["_muzzleVelocityShiftTable", "_temperature"];
// Check if muzzleVelocityShiftTable is Less Than 11 Entrys
if ((count _muzzleVelocityShiftTable) < 11) exitWith {0};
_muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10;
private _muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10;
if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 };
// Find exact data index required for given temperature
_temperatureIndexFunction = (_temperature + 15) / 5;
private _temperatureIndexFunction = (_temperature + 15) / 5;
// lower and upper data index used for interpolation
_temperatureIndexA = (0 max (floor(_temperatureIndexFunction))) min 10;
_temperatureIndexB = (0 max (ceil(_temperatureIndexFunction))) min 10;
private _temperatureIndexA = (0 max (floor(_temperatureIndexFunction))) min 10;
private _temperatureIndexB = (0 max (ceil(_temperatureIndexFunction))) min 10;
// Interpolation ratio
_interpolationRatio = _temperatureIndexFunction - floor(_temperatureIndexFunction);
private _interpolationRatio = _temperatureIndexFunction - floor(_temperatureIndexFunction);
// Interpolation
(_muzzleVelocityShiftTable select _temperatureIndexA) * (1 - _interpolationRatio) + (_muzzleVelocityShiftTable select _temperatureIndexB) * _interpolationRatio // Return

View File

@ -17,11 +17,9 @@
*/
#include "script_component.hpp"
private "_airDensity";
params ["_ballisticCoefficient", "_temperature"/*in C*/, "_pressure"/*in hPa*/, "_relativeHumidity"/*as ratio 0-1*/, "_atmosphereModel"/*"ICAO" or "ASM"*/];
_airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity);
private _airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity);
if (_atmosphereModel == "ICAO") then {
(STD_AIR_DENSITY_ICAO / _airDensity) * _ballisticCoefficient

View File

@ -19,14 +19,13 @@
*/
#include "script_component.hpp"
private ["_twist", "_length", "_stabilityFactor"];
params ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure"];
// Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf
_twist = _barrelTwist / _caliber;
_length = _bulletLength / _caliber;
private _twist = _barrelTwist / _caliber;
private _length = _bulletLength / _caliber;
_stabilityFactor = 7587000 * _bulletMass / (_twist^2 * _caliber^3 * _length * (1 + _length^2));
private _stabilityFactor = 7587000 * _bulletMass / (_twist^2 * _caliber^3 * _length * (1 + _length^2));
if (_muzzleVelocity > 341.376) then {
(_stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure

View File

@ -15,17 +15,16 @@
private _aceTimeSecond = floor CBA_missionTime;
{
private ["_bulletVelocity", "_bulletPosition", "_bulletSpeed"];
_x params["_bullet","_caliber","_bulletTraceVisible","_index"];
_x params ["_bullet","_caliber","_bulletTraceVisible","_index"];
_bulletVelocity = velocity _bullet;
private _bulletVelocity = velocity _bullet;
_bulletSpeed = vectorMagnitude _bulletVelocity;
private _bulletSpeed = vectorMagnitude _bulletVelocity;
if (!alive _bullet || _bulletSpeed < 100) then {
GVAR(allBullets) deleteAt (GVAR(allBullets) find _x);
} else {
_bulletPosition = getPosASL _bullet;
private _bulletPosition = getPosASL _bullet;
if (_bulletTraceVisible && _bulletSpeed > 500) then {
drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""];

View File

@ -15,11 +15,10 @@
*/
#include "script_component.hpp"
private ["_weaponConfig", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"];
_weaponConfig = (configFile >> "CfgWeapons" >> _this);
private _weaponConfig = (configFile >> "CfgWeapons" >> _this);
_barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist");
_twistDirection = 1;
private _barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist");
private _twistDirection = 1;
if (isNumber (_weaponConfig >> "ACE_twistDirection")) then {
_twistDirection = getNumber (_weaponConfig >> "ACE_twistDirection");
if !(_twistDirection in [-1, 0, 1]) then {
@ -27,9 +26,9 @@ if (isNumber (_weaponConfig >> "ACE_twistDirection")) then {
};
};
_barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength");
private _barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength");
_result = [_barrelTwist, _twistDirection, _barrelLength];
private _result = [_barrelTwist, _twistDirection, _barrelLength];
uiNamespace setVariable [format[QGVAR(%1), _weapon], _result];

View File

@ -15,11 +15,9 @@
*/
#include "script_component.hpp"
private ["_gunName", "_gunProfileEntry"];
_gunName = ctrlText 11001;
private _gunName = ctrlText 11001;
if (_gunName != "") then {
_gunProfileEntry = [_gunName, 810, 100, 0.0679, -0.0010350, 3.81, 0, 2, 10, 120, 0, 0, 9.525, 7.82, 25.40, 0.393, 1, "ICAO"],
private _gunProfileEntry = [_gunName, 810, 100, 0.0679, -0.0010350, 3.81, 0, 2, 10, 120, 0, 0, 9.525, 7.82, 25.40, 0.393, 1, "ICAO"],
GVAR(gunList) = GVAR(gunList) + [_gunProfileEntry];

View File

@ -17,21 +17,20 @@
[] call FUNC(parse_input);
private ["_scopeBaseAngle"];
_scopeBaseAngle = (GVAR(workingMemory) select 3);
GVAR(workingMemory) params ["",
"_muzzleVelocity", "",
"_scopeBaseAngle",
"_airFriction",
"_boreHeight", "", "", "", "", "", "",
"_bulletMass",
"_bulletDiameter",
"_barrelTwist",
"_bc",
"_dragModel",
"_atmosphereModel"
];
private ["_bulletMass", "_bulletDiameter", "_boreHeight", "_airFriction", "_barrelTwist", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel", "_twistDirection"];
_bulletMass = GVAR(workingMemory) select 12;
_bulletDiameter = GVAR(workingMemory) select 13;
_boreHeight = GVAR(workingMemory) select 5;
_airFriction = GVAR(workingMemory) select 4;
_barrelTwist = GVAR(workingMemory) select 14;
_muzzleVelocity = GVAR(workingMemory) select 1;
_bc = GVAR(workingMemory) select 15;
_dragModel = GVAR(workingMemory) select 16;
_atmosphereModel = GVAR(workingMemory) select 17;
_twistDirection = 0;
private _twistDirection = 0;
if (_barrelTwist > 0) then {
_twistDirection = 1;
} else {
@ -39,42 +38,38 @@ if (_barrelTwist > 0) then {
_twistDirection = -1;
};
};
_barrelTwist = abs(_barrelTwist);
_barrelTwist = abs _barrelTwist;
private ["_altitude", "_temperature", "_barometricPressure", "_relativeHumidity"];
_altitude = GVAR(altitude);
_temperature = GVAR(temperature);
_barometricPressure = GVAR(barometricPressure);
_relativeHumidity = GVAR(relativeHumidity);
private _altitude = GVAR(altitude);
private _temperature = GVAR(temperature);
private _barometricPressure = GVAR(barometricPressure);
private _relativeHumidity = GVAR(relativeHumidity);
if (!GVAR(atmosphereModeTBH)) then {
_barometricPressure = 1013.25 * (1 - (0.0065 * _altitude) / (273.15 + _temperature + 0.0065 * _altitude)) ^ 5.255754495;
_relativeHumidity = 50;
};
private ["_bulletLength", "_stabilityFactor"];
_bulletLength = 45.72;
_stabilityFactor = 1.5;
private _bulletLength = 45.72;
private _stabilityFactor = 1.5;
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
if (_bulletDiameter > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then {
_stabilityFactor = [_bulletDiameter, _bulletLength, _bulletMass, _barrelTwist * 10, _muzzleVelocity, _temperature, _barometricPressure] call EFUNC(advanced_ballistics,calculateStabilityFactor);
};
};
private ["_latitude", "_directionOfFire", "_windSpeed1", "_windSpeed2", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"];
_latitude = GVAR(latitude) select GVAR(currentTarget);
_directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget);
_windSpeed1 = (GVAR(windSpeed1) select GVAR(currentTarget));
_windSpeed2 = (GVAR(windSpeed2) select GVAR(currentTarget));
_windDirection = (GVAR(windDirection) select GVAR(currentTarget));
_inclinationAngle = (GVAR(inclinationAngle) select GVAR(currentTarget));
_targetSpeed = (GVAR(targetSpeed) select GVAR(currentTarget));
_targetRange = GVAR(rangeCardEndRange);
private _latitude = GVAR(latitude) select GVAR(currentTarget);
private _directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget);
private _windSpeed1 = (GVAR(windSpeed1) select GVAR(currentTarget));
private _windSpeed2 = (GVAR(windSpeed2) select GVAR(currentTarget));
private _windDirection = (GVAR(windDirection) select GVAR(currentTarget));
private _inclinationAngle = (GVAR(inclinationAngle) select GVAR(currentTarget));
private _targetSpeed = (GVAR(targetSpeed) select GVAR(currentTarget));
private _targetRange = GVAR(rangeCardEndRange);
if (GVAR(currentUnit) == 1) then {
_targetRange = _targetRange / 1.0936133;
};
GVAR(rangeCardData) = [];
private ["_result"];
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
private _result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
[_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, true, _stabilityFactor, _twistDirection, _latitude, _directionOfFire] call FUNC(calculate_solution);

View File

@ -15,10 +15,8 @@
*/
#include "script_component.hpp"
private ["_targetSize", "_imageSize", "_angle", "_estRange"];
_angle = parseNumber(ctrlText 7012);
_targetSize = parseNumber(ctrlText 7010);
private _angle = parseNumber(ctrlText 7012);
private _targetSize = parseNumber(ctrlText 7010);
if (GVAR(rangeAssistUseTargetHeight)) then {
_targetSize = _targetSize * cos(_angle);
};
@ -33,7 +31,7 @@ switch (GVAR(rangeAssistTargetSizeUnit)) do {
_targetSize = _targetSize * 0.01;
};
};
_imageSize = parseNumber(ctrlText 7011);
private _imageSize = parseNumber(ctrlText 7011);
switch (GVAR(rangeAssistImageSizeUnit)) do {
case 0: {
_imageSize = _imageSize / 6400 * 360;
@ -45,7 +43,7 @@ switch (GVAR(rangeAssistImageSizeUnit)) do {
_imageSize = _imageSize / 60 / 1.047;
};
};
_estRange = parseNumber(ctrlText 7013);
private _estRange = parseNumber(ctrlText 7013);
if (GVAR(currentUnit) == 1) then {
_estRange = _estRange / 1.0936133;
};

View File

@ -15,8 +15,7 @@
*/
#include "script_component.hpp"
private ["_target"];
_target = 0 max _this min 3;
private _target = 0 max _this min 3;
call FUNC(parse_input);

View File

@ -15,8 +15,7 @@
*/
#include "script_component.hpp"
private ["_index"];
_index = lbCurSel 6000;
private _index = lbCurSel 6000;
if (_index == -1) exitWith {};

View File

@ -23,9 +23,8 @@ if !(ctrlVisible 9000) then {
ctrlSetFocus ((uiNamespace getVariable "ATragMX_Display") displayCtrl 9002);
[{
private ["_args", "_startTime"];
_args = _this select 0;
_startTime = _args select 0;
params ["_args"];
_args params ["_startTime"];
if (!(GVAR(speedAssistTimer))) exitWith {
GVAR(speedAssistTimer) = true;

View File

@ -68,7 +68,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModel _model;
[{
private["_angle", "_dir", "_screenPos", "_realDistance", "_up", "_virtualPos", "_virtualPosASL", "_lineInterection"];
private ["_angle", "_dir", "_screenPos", "_realDistance", "_up", "_virtualPos", "_virtualPosASL", "_lineInterection"];
params ["_args","_idPFH"];
_args params ["_unit","_attachToVehicle","_itemClassname","_itemVehClass","_onAtachText","_actionID"];

View File

@ -22,10 +22,8 @@ TRACE_1("params",_unit);
if (!local _unit) exitWith {};
private ["_attachedList"];
_attachedList = _unit getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {};
private _attachedList = _unit getVariable [QGVAR(attached), []];
if (_attachedList isEqualTo []) exitWith {};
(_attachedList select 0) params ["_xObject"];
if (!isNull _xObject) then {

View File

@ -22,10 +22,8 @@ TRACE_1("params",_unit);
if (!local _unit) exitWith {};
private ["_attachedList"];
_attachedList = _unit getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {};
private _attachedList = _unit getVariable [QGVAR(attached), []];
if (_attachedList isEqualTo []) exitWith {};
(_attachedList select 0) params ["_xObject", "_xItemName"];
if (isNull _xObject) then {

View File

@ -19,11 +19,9 @@
params ["_deadUnit"];
TRACE_1("params",_deadUnit);
private ["_attachedList"];
private _attachedList = _deadUnit getVariable [QGVAR(attached), []];
_attachedList = _deadUnit getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {};
if (_attachedList isEqualTo []) exitWith {};
{
_x params ["_xObject"];

View File

@ -1,12 +1,10 @@
// by commy2
#include "script_component.hpp"
private "_paper";
params ["_wall"];
if (local _wall) then {
_paper = "UserTexture_1x2_F" createVehicle position _wall;
private _paper = "UserTexture_1x2_F" createVehicle position _wall;
_paper attachTo [_wall, [0,-0.02,0.6]];
_paper setDir getDir _wall;

View File

@ -13,8 +13,7 @@
if (isServer) then {
addMissionEventHandler ["HandleDisconnect", {
params ["_disconnectedPlayer"];
private "_escortedUnit";
_escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull];
private _escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull];
if ((!isNull _escortedUnit) && {(attachedTo _escortedUnit) == _disconnectedPlayer}) then {
detach _escortedUnit;
};

View File

@ -16,11 +16,9 @@
*/
#include "script_component.hpp"
private "_returnValue";
params ["_unit", "_newSurrenderState"];
_returnValue = if (_newSurrenderState) then {
private _returnValue = if (_newSurrenderState) then {
//no weapon equiped AND not currently surrendering and
GVAR(allowSurrender) && {(currentWeapon _unit) == ""} && {!(_unit getVariable [QGVAR(isSurrendering), false])}
} else {

View File

@ -16,8 +16,6 @@
*/
#include "script_component.hpp"
private ["_cargo"];
params ["_player", "_unit"];
((vehicle _unit) != _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}

View File

@ -16,20 +16,18 @@
*/
#include "script_component.hpp"
private ["_weapon", "_listedItemClasses", "_actions", "_allGear"];
params ["_player", "_unit"];
_weapon = currentWeapon _player;
private _weapon = currentWeapon _player;
if (_weapon == primaryWeapon _player && {_weapon != ""}) then {
[_player, "AmovPercMstpSlowWrflDnon", 0] call EFUNC(common,doAnimation);
};
_listedItemClasses = [];
private _listedItemClasses = [];
_actions = [localize LSTRING(FriskMenuHeader), ""] call ACE_Interaction_fnc_prepareSelectMenu;
private _actions = [localize LSTRING(FriskMenuHeader), ""] call ACE_Interaction_fnc_prepareSelectMenu;
_allGear = [];
private _allGear = [];
if ((handgunWeapon _unit) != "") then {
_allGear pushBack (handgunWeapon _unit);
@ -54,8 +52,7 @@ if (count (assignedItems _unit) > 0) then {
// Assigned Items
{
if (!(_x in _listedItemClasses)) then {
private "_item";
_item = configFile >> "CfgMagazines" >> _x;
private _item = configFile >> "CfgMagazines" >> _x;
if (isNil "_item" || str _item == "") then { //str _item ?
_item = configFile >> "CfgWeapons" >> _x;
};

View File

@ -21,9 +21,7 @@ params ["_vehicle", "", "_unit"];
TRACE_2("params",_vehicle,_unit);
if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then {
private ["_cargoIndex"];
_cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1];
private _cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1];
if (_cargoIndex != -1) then {
//If captive was not "unloaded", then move them back into the vehicle.

View File

@ -23,8 +23,7 @@ if (!local _unit) exitWith {};
// Group and side respawn can potentially respawn you as a captive unit
// Base and instant respawn cannot, so captive should be entirely reset
// So we explicity account for the respawn type
private ["_respawn"];
_respawn = [0] call BIS_fnc_missionRespawnType;
private _respawn = [0] call BIS_fnc_missionRespawnType;
if (_respawn > 3) then {
if (_unit getVariable [QGVAR(isHandcuffed), false]) then {

View File

@ -19,11 +19,9 @@
params ["_target","_vehicle"];
TRACE_2("params",_target,_vehicle);
private ["_cargoIndex"];
_getSeat = [_vehicle] call FUNC(findEmptyNonFFVCargoSeat);
TRACE_1("free cargo seat",_getSeat);
_cargoIndex = _getSeat select 0;
_getSeat params ["_cargoIndex"];
if (_cargoIndex == -1) exitWith {ERROR("cargo index -1");};
_target moveInCargo [_vehicle, _cargoIndex];

View File

@ -25,9 +25,8 @@ if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) ex
if (isServer) then {
{
if (isClass _x) then {
private ["_cargoClassname", "_cargoCount"];
_cargoClassname = getText (_x >> "type");
_cargoCount = getNumber (_x >> "amount");
private _cargoClassname = getText (_x >> "type");
private _cargoCount = getNumber (_x >> "amount");
TRACE_3("adding ACE_Cargo", (configName _x), _cargoClassname, _cargoCount);
["ace_addCargo", [_cargoClassname, _vehicle, _cargoCount]] call CBA_fnc_localEvent;
};

View File

@ -91,7 +91,7 @@ private _keybinds = actionKeysNamesArray _action apply {
_alt = true;
};
default {
// @todo handle double keys? ("C+R")
// @todo handle double keys? ("C + R")
// currently only reports last key
// not usable by keyDown by default
_key = _keyTable find _x;

View File

@ -69,9 +69,9 @@ private _refresh = {
private _position = switch (_setting) do {
case TOP_RIGHT_DOWN: {[X_POS_ICONS, Y_POS_ICONS + (_forEachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]};
case TOP_RIGHT_LEFT: {[X_POS_ICONS_SECOND - ((_forEachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND - (ICON_WIDTH / 2), ICON_WIDTH, ICON_WIDTH]};
case TOP_RIGHT_LEFT: {[X_POS_ICONS_SECOND - ((_forEachIndex + 3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND - (ICON_WIDTH / 2), ICON_WIDTH, ICON_WIDTH]};
case TOP_LEFT_DOWN: {[LEFT_SIDE + (0.5 * ICON_WIDTH), Y_POS_ICONS + (_forEachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]};
case TOP_LEFT_RIGHT: {[LEFT_SIDE + (0.5 * ICON_WIDTH) - ((_forEachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND, ICON_WIDTH, ICON_WIDTH]};
case TOP_LEFT_RIGHT: {[LEFT_SIDE + (0.5 * ICON_WIDTH) - ((_forEachIndex + 3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND, ICON_WIDTH, ICON_WIDTH]};
default {[X_POS_ICONS, Y_POS_ICONS + (_forEachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]};
};

View File

@ -171,8 +171,7 @@ switch (_position) do {
};
case "cargo" : {
private "_positions";
_positions = [typeOf _vehicle] call FUNC(getVehicleCargo);
private _positions = [typeOf _vehicle] call FUNC(getVehicleCargo);
{
if (alive _x) then {_positions deleteAt (_positions find (_vehicle getCargoIndex _x))};

View File

@ -53,8 +53,7 @@ _unit action ["Eject", vehicle _unit];
[_unit, _anim, 1, true] call FUNC(doAnimation);
[{
_unit = _this select 0;
_anim = _this select 1;
params ["_unit", "_anim"];
if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then {
[_unit, _anim, 2, true] call FUNC(doAnimation);
};

View File

@ -1,7 +1,7 @@
// by commy2
#include "script_component.hpp"
private["_client", "_clientVersion", "_count", "_error", "_files", "_index", "_missingAddon", "_missingAddonServer", "_missingAddons", "_missingAddonsServer", "_oldVersionClient", "_oldVersionServer", "_oldVersionsClient", "_oldVersionsServer", "_serverFiles", "_serverVersion", "_serverVersions", "_string", "_version", "_versions"];
private ["_client", "_clientVersion", "_count", "_error", "_files", "_index", "_missingAddon", "_missingAddonServer", "_missingAddons", "_missingAddonsServer", "_oldVersionClient", "_oldVersionServer", "_oldVersionsClient", "_oldVersionsServer", "_serverFiles", "_serverVersion", "_serverVersions", "_string", "_version", "_versions"];
_files = [];

View File

@ -16,17 +16,15 @@
PARAMS_2(_wirecoil,_unit);
private ["_wireNoGeo", "_dir", "_pos", "_wireNoGeoPos"];
_wireNoGeo = "ACE_ConcertinaWireNoGeo" createVehicle [0,0,0];
private _wireNoGeo = "ACE_ConcertinaWireNoGeo" createVehicle [0,0,0];
{
_wireNoGeo animate [_x, 1];
} count WIRE_FAST;
GVAR(placer) = _unit;
_dir = getDir _unit;
_pos = getPosASL _unit;
_wireNoGeoPos = _pos vectorAdd [1.1 * sin(_dir), 1.1 * cos(_dir), 0];
private _dir = getDir _unit;
private _pos = getPosASL _unit;
private _wireNoGeoPos = _pos vectorAdd [1.1 * sin(_dir), 1.1 * cos(_dir), 0];
_wireNoGeo setDir _dir;
_wireNoGeo setPosASL _wireNoGeoPos;
@ -39,16 +37,15 @@ GVAR(deployPFH) = [{
params ["_args", "_idPFH"];
_args params ["_wireNoGeo", "_wireNoGeoPos", "_unit"];
private ["_range", "_posStart", "_posEnd", "_dirVect", "_dir", "_anim", "_wire"];
_posStart = (_wireNoGeo modelToWorldVisual (_wireNoGeo selectionPosition "start")) call EFUNC(common,positionToASL);
_posEnd = (getPosASL _unit) vectorAdd (vectorDir _unit);
_dirVect = _posStart vectorDiff _posEnd;
_dir = _dirVect call CBA_fnc_vectDir;
_range = vectorMagnitude _dirVect;
_anim = 0 max (1 - (_range / 12));
private _posStart = (_wireNoGeo modelToWorldVisual (_wireNoGeo selectionPosition "start")) call EFUNC(common,positionToASL);
private _posEnd = (getPosASL _unit) vectorAdd (vectorDir _unit);
private _dirVect = _posStart vectorDiff _posEnd;
private _dir = _dirVect call CBA_fnc_vectDir;
private _range = vectorMagnitude _dirVect;
private _anim = 0 max (1 - (_range / 12));
if (!(alive _unit) || _range >= 12 || (_unit getVariable [QGVAR(wireDeployed), false])) exitWith {
_wire = "ACE_ConcertinaWire" createvehicle [0, 0, 0];
private _wire = "ACE_ConcertinaWire" createvehicle [0, 0, 0];
{
_wire animate [_x, _anim];
} count WIRE_FAST;

View File

@ -22,12 +22,10 @@ if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exit
};
params ["_wire", "_unit"];
private ["_config", "_delay"];
_config = (configFile >> "CfgVehicles" >> typeOf _unit);
_delay = if (getNumber(_config >> "engineer") == 1 || getNumber(_config >> "canDeactivateMines") == 1) then {60} else {120};
private _config = (configFile >> "CfgVehicles" >> typeOf _unit);
private _delay = [120, 60] select (getNumber (_config >> "engineer") == 1 || {getNumber (_config >> "canDeactivateMines") == 1});
// TODO: Animation?
[
_delay,
[_wire],

View File

@ -16,8 +16,6 @@
params ["_wire", "_killer"];
TRACE_2("params",_wire,_killer);
private ["_distance", "_vehicle"];
if (isNull _killer) then {
_killer = _wire getVariable [QGVAR(lastDamager), objNull];
if (isNull _killer) then {
@ -29,9 +27,9 @@ if (isNull _killer) then {
};
if (isNull _killer || {_killer == _wire} || {_killer == gunner (vehicle _killer)}) exitWith {};
_distance = _wire distance _killer;
private _distance = _wire distance _killer;
if (_distance > 14 || {_distance < 2}) exitWith {}; // Fix if shooting wire
_vehicle = vehicle _killer;
private _vehicle = vehicle _killer;
[QGVAR(vehicleDamage), [_wire, _vehicle], [_vehicle]] call CBA_fnc_targetEvent;

View File

@ -45,10 +45,10 @@ if (_mode == 0) then {
// Check if two Single coils are placed next to each other (i.e playes have built a big wire obstacle)
_wireCheckPosAr = [
[_x + (sin (_dir_w+90) * 1.5),_y + (cos (_dir_w+90) * 1.5)],
[(_x-(sin _dir_w)) + (sin (_dir_w+90) * 1.5),(_y-(cos _dir_w)) + (cos (_dir_w+90) * 1.5)],
[_x + (sin (_dir_w-90) * 1.5),_y + (cos (_dir_w-90) * 1.5)],
[(_x-(sin _dir_w)) + (sin (_dir_w-90) * 1.5),(_y-(cos _dir_w)) + (cos (_dir_w-90) * 1.5)]
[_x + (sin (_dir_w + 90) * 1.5),_y + (cos (_dir_w + 90) * 1.5)],
[(_x-(sin _dir_w)) + (sin (_dir_w + 90) * 1.5),(_y-(cos _dir_w)) + (cos (_dir_w + 90) * 1.5)],
[_x + (sin (_dir_w - 90) * 1.5),_y + (cos (_dir_w - 90) * 1.5)],
[(_x-(sin _dir_w)) + (sin (_dir_w - 90) * 1.5),(_y-(cos _dir_w)) + (cos (_dir_w - 90) * 1.5)]
];
{
_found = false;
@ -113,7 +113,7 @@ if (_mode == 1) then {
_vPos = getPosASL _vehicle;
_vDir = getDir _vehicle;
_vehicle setPosASL (_vPos vectorAdd [-0.35 * sin(_vDir), -0.35 * cos(_vDir), 0]);
// TODO: Needs to be placed in safe distance to wire, so we do not constantly re-spawn new wires
// TODO: Needs to be placed in safe distance to wire, so we do not constantly re - spawn new wires
}, [_vehicle, _wire], 0.1] call CBA_fnc_waitAndExecute;
};

View File

@ -447,11 +447,10 @@ GVAR(menuRun) = true;
};
};
if (GVAR(F2)) then {
private ["_grid", "_gridVector"];
_grid = toArray GVAR(vectorGrid);
private _grid = toArray GVAR(vectorGrid);
_grid deleteAt 4;
_grid = toString _grid;
_gridVector = parseNumber _grid;
private _gridVector = parseNumber _grid;
GVAR(digit1) = floor(_gridVector / 10000000);
GVAR(digit2) = floor(_gridVector / 1000000 - GVAR(digit1) *10);
GVAR(digit3) = floor(_gridVector / 100000 - GVAR(digit2) * 10 - GVAR(digit1) * 100);

View File

@ -30,7 +30,7 @@ __background ctrlSetText QPATHTOF(UI\dagr_gps.paa);
if (GVAR(outputPFH) != -1) exitWith {};
GVAR(outputPFH) = [{
private["_dagrElevation", "_dagrGrid", "_dagrHeading", "_dagrSpeed", "_dagrTime", "_elevation", "_gridArray", "_speed"];
private ["_dagrElevation", "_dagrGrid", "_dagrHeading", "_dagrSpeed", "_dagrTime", "_elevation", "_gridArray", "_speed"];
// Abort Condition
if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {

View File

@ -30,7 +30,7 @@ __background ctrlSetText QPATHTOF(UI\dagr_wp.paa);
if (GVAR(outputPFH) != -1) exitWith {};
GVAR(outputPFH) = [{
private["_MYpos", "_WPpos", "_bearing", "_dagrDistance", "_dagrGrid", "_dagrHeading", "_distance", "_gridArray"];
private ["_MYpos", "_WPpos", "_bearing", "_dagrDistance", "_dagrGrid", "_dagrHeading", "_distance", "_gridArray"];
// Abort Condition
if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {

View File

@ -21,9 +21,7 @@
params ["_caller", "_target", "_listOfObjectsToRemove"];
private "_itemsToAdd";
_itemsToAdd = [];
private _itemsToAdd = [];
{
if (_x == (uniform _target)) then {
_itemsToAdd = _itemsToAdd + (uniformItems _target);

View File

@ -18,10 +18,8 @@
params ["_target"];
private ["_items", "_counts"];
_items = [];
_counts = [];
private _items = [];
private _counts = [];
{
_x params ["_item", "_count"];
_items append _item;

View File

@ -17,7 +17,6 @@
*/
#include "script_component.hpp"
params ["_caller", "_target"];
private "_display";
#define DEFUALTPATH "\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa"
//Sanity Checks
if (_caller != ACE_player) exitWith {ERROR("Player isn't caller?");};
@ -28,7 +27,7 @@ disableSerialization;
createDialog QGVAR(remoteInventory);
_display = uiNamespace getVariable ["ACE_remoteInventory", displayNull];
private _display = uiNamespace getVariable ["ACE_remoteInventory", displayNull];
if (isNull _display) exitWith {ERROR("Display is Null");};
GVAR(disarmTarget) = _target;

View File

@ -18,20 +18,17 @@
#include "script_component.hpp"
disableSerialization;
private ["_classname", "_count", "_displayName", "_picture"];
params ["_listBoxCtrl", "_itemsCountArray"];
{
private "_configPath";
_displayName = "";
_picture = "";
_classname = _x;
_count = (_itemsCountArray select 1) select _forEachIndex;
private _classname = _x;
private _count = (_itemsCountArray select 1) select _forEachIndex;
if ((_classname != DUMMY_ITEM) && {_classname != "ACE_FakePrimaryWeapon"}) then { //Don't show the dummy potato or fake weapon
private "_configPath";
private _displayName = "";
private _picture = "";
switch (true) do {
case (isClass (configFile >> "CfgWeapons" >> _classname)): {
_configPath = (configFile >> "CfgWeapons");

View File

@ -21,8 +21,6 @@
*/
#include "script_component.hpp"
private ["_problem", "_beginingArray", "_index"];
PARAMS_4(_startA,_endA,_startB,_endB);
//Quick Lazy Count Check
@ -30,11 +28,11 @@ if (((count _startA) + (count _startB)) != ((count _endA) + (count _endB))) exit
false
};
_beginingArray = (_startA + _startB);
private _beginingArray = (_startA + _startB);
_problem = false;
private _problem = false;
{
_index = _beginingArray find _x;
private _index = _beginingArray find _x;
if (_index == -1) exitWith {_problem = true;};
_beginingArray deleteAt _index;
} forEach (_endA + _endB);

View File

@ -21,7 +21,7 @@
params ["_unit", "_explosive", "_magazineClass", "_extra"];
TRACE_4("params",_unit,_explosive,_magazineClass,_extra);
private["_config", "_detonators", "_hasRequired", "_requiredItems", "_code", "_count", "_codeSet"];
private ["_config", "_detonators", "_hasRequired", "_requiredItems", "_code", "_count", "_codeSet"];
// Config is the last item in the list of passed in items.
_config = (_this select 3) select (count (_this select 3) - 1);

View File

@ -36,9 +36,11 @@ _itemCount = [];
_children = [];
{
private "_name";
_name = if(isText(_x >> "displayNameShort") && {getText(_x >> "displayNameShort") != ""}) then
{getText (_x >> "displayNameShort")}else{getText(_x >> "displayName")};
private _name = getText (_x >> "displayNameShort");
if (_name isEqualTo "") then {
_name = getText (_x >> "displayName");
};
_children pushBack
[
[

View File

@ -27,7 +27,7 @@ _unit setVariable [QGVAR(Dialing), true, true];
_ran = (ceil(random 8)) + 1;
_arr = [];
for [{_i=0}, {_i<_ran}, {_i=_i+1}] do {
for [{_i=0}, {_i<_ran}, {_i=_i + 1}] do {
_arr = _arr + ['.','..','...',''];
};
if (_unit == ace_player) then {

View File

@ -26,8 +26,7 @@ if ((_i mod 4) == 0) then {
};
ctrlSetText [1400,format["Calling%1",_arr select (_i - 4)]];
private "_explosive";
_explosive = [_code] call FUNC(getSpeedDialExplosive);
private _explosive = [_code] call FUNC(getSpeedDialExplosive);
if (_i >= (count _arr + 2)) then {
[_pfID] call CALLSTACK(CBA_fnc_removePerFrameHandler);

View File

@ -15,9 +15,7 @@
*/
#include "script_component.hpp"
private "_speedDial";
_speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
private _speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
if (count _speedDial == 0) exitWith {};
{
if ((_x select 0) == (_this select 0)) exitWith {

View File

@ -20,9 +20,7 @@
params ["_explosive", "_magazine", "_trigger"];
TRACE_3("params",_explosive,_magazine,_trigger);
private ["_config"];
_config = ConfigFile >> "ACE_Triggers" >> _trigger;
private _config = ConfigFile >> "ACE_Triggers" >> _trigger;
// If the onSetup function returns true, it is handled elsewhere
if (isText(_config >> "onSetup") && {[_explosive,_magazine] call compile getText (_config >> "onSetup")}) exitWith {

View File

@ -15,13 +15,12 @@
* Public: No
*/
#include "script_component.hpp"
private ["_speedDial", "_amount"];
_speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
if (count _speedDial == 0) exitWith {};
_amount = if((_this select 0))then{1}else{-1};
private _speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
if (_speedDial isEqualTo []) exitWith {};
private _amount = [-1, 1] select (_this select 0);
GVAR(CurrentSpeedDial) = (GVAR(CurrentSpeedDial) + _amount + count _speedDial) mod (count _speedDial);
ctrlSetText [1400,(_speedDial select GVAR(CurrentSpeedDial)) select 1];
ctrlSetText [1401,(_speedDial select GVAR(CurrentSpeedDial)) select 0];
ctrlSetText [1400, (_speedDial select GVAR(CurrentSpeedDial)) select 1];
ctrlSetText [1401, (_speedDial select GVAR(CurrentSpeedDial)) select 0];

View File

@ -24,7 +24,7 @@
params ["_vehicle", "_unit", "_magClassname"];
TRACE_3("params",_vehicle,_unit,_magClassname);
private["_isAttachable", "_setupObjectClass", "_supportedTriggers", "_p3dModel"];
private ["_isAttachable", "_setupObjectClass", "_supportedTriggers", "_p3dModel"];
//Get setup object vehicle and model:
_setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> QGVAR(SetupObject));
@ -62,7 +62,7 @@ GVAR(TweakedAngle) = 0;
params ["_args", "_pfID"];
_args params ["_unit", "_magClassname", "_setupObjectClass", "_isAttachable"];
private["_angle", "_attachVehicle", "_badPosition", "_basePosASL", "_cameraAngle", "_distanceFromBase", "_expSetupVehicle", "_index", "_intersectsWith", "_lookDirVector", "_max", "_min", "_modelDir", "_modelOffset", "_modelUp", "_placeAngle", "_realDistance", "_return", "_screenPos", "_testBase", "_testPos", "_testPositionIsValid", "_virtualPosASL"];
private ["_angle", "_attachVehicle", "_badPosition", "_basePosASL", "_cameraAngle", "_distanceFromBase", "_expSetupVehicle", "_index", "_intersectsWith", "_lookDirVector", "_max", "_min", "_modelDir", "_modelOffset", "_modelUp", "_placeAngle", "_realDistance", "_return", "_screenPos", "_testBase", "_testPos", "_testPositionIsValid", "_virtualPosASL"];
_lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,0,10]) call EFUNC(common,positionToASL));
_basePosASL = (eyePos _unit);

View File

@ -19,7 +19,7 @@
params ["_unit", "_target"];
TRACE_2("params",_unit,_target);
private["_actionToPlay", "_defuseTime", "_isEOD"];
private ["_actionToPlay", "_defuseTime", "_isEOD"];
_target = attachedTo (_target);

View File

@ -18,7 +18,7 @@
params ["_magazineClassname"];
TRACE_1("params",_magazineClassname);
private["_result", "_config", "_count", "_index"];
private ["_result", "_config", "_count", "_index"];
_result = [];
_config = getArray (ConfigFile >> "CfgMagazines" >> _magazineClassname >> "ACE_Triggers" >> "SupportedTriggers");

View File

@ -16,31 +16,30 @@
#include "script_component.hpp"
params ["_vehicle"];
private ["_config", "_ropeOrigins", "_ropeOrigin", "_deployedRopes", "_hookAttachment", "_origin", "_dummy", "_hook", "_ropeTop", "_ropeBottom"];
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
_ropeOrigins = getArray (_config >> QGVAR(ropeOrigins));
_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
_hookAttachment = _vehicle getVariable [QGVAR(FRIES), _vehicle];
private _ropeOrigins = getArray (_config >> QGVAR(ropeOrigins));
private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
private _hookAttachment = _vehicle getVariable [QGVAR(FRIES), _vehicle];
{
_ropeOrigin = _x;
_hook = QGVAR(helper) createVehicle [0, 0, 0];
private _ropeOrigin = _x;
private _hook = QGVAR(helper) createVehicle [0, 0, 0];
_hook allowDamage false;
if (typeName _ropeOrigin == "ARRAY") then {
if (_ropeOrigin isEqualType []) then {
_hook attachTo [_hookAttachment, _ropeOrigin];
} else {
_hook attachTo [_hookAttachment, [0, 0, 0], _ropeOrigin];
};
_origin = getPosATL _hook;
private _origin = getPosATL _hook;
_dummy = createVehicle [QGVAR(helper), _origin vectorAdd [0, 0, -1], [], 0, "CAN_COLLIDE"];
private _dummy = createVehicle [QGVAR(helper), _origin vectorAdd [0, 0, -1], [], 0, "CAN_COLLIDE"];
_dummy allowDamage false;
_dummy disableCollisionWith _vehicle;
_ropeTop = ropeCreate [_dummy, [0, 0, 0], _hook, [0, 0, 0], 0.5];
_ropeBottom = ropeCreate [_dummy, [0, 0, 0], 1];
private _ropeTop = ropeCreate [_dummy, [0, 0, 0], _hook, [0, 0, 0], 0.5];
private _ropeBottom = ropeCreate [_dummy, [0, 0, 0], 1];
ropeUnwind [_ropeBottom, 30, 34.5, false];
_ropeTop addEventHandler ["RopeBreak", {[_this, "top"] call FUNC(onRopeBreak)}];

View File

@ -22,7 +22,7 @@ params ["_sourceUnit", "_fingerPosPrecise", "_distance"];
private _fingerPos = if (_sourceUnit == ACE_player) then {
_fingerPosPrecise
} else {
_fingerPosPrecise vectorAdd ([random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_Y) - FP_RANDOMIZATION_Y] vectorMultiply _distance)
_fingerPosPrecise vectorAdd ([random (2 * FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2 * FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2 * FP_RANDOMIZATION_Y) - FP_RANDOMIZATION_Y] vectorMultiply _distance)
};
TRACE_3("incoming finger:", _sourceUnit, _fingerPosPrecise, _fingerPos);

View File

@ -1,4 +1,3 @@
#include "script_component.hpp"
private ["_round"];
_round = _this select 0;
params ["_round"];
GVAR(blackList) set [(count GVAR(blackList)), _round];

View File

@ -55,7 +55,7 @@ if(_doFragTrack && {alive _round}) then {
_spallTrack = [];
_spallTrackID = [];
private["_args"];
private ["_args"];
_args = [_round, (getPosASL _round), (velocity _round), _type, diag_frameno, _gun, _doSpall, _spallTrack, _spallTrackID,
(getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(skip))),
(getNumber (configFile >> "CfgAmmo" >> _type >> "explosive")),

View File

@ -1,23 +1,20 @@
#include "script_component.hpp"
private ["_color", "_data", "_index", "_obj", "_objSpd", "_origin", "_positions"];
if (GVAR(autoTrace)) then {
[] call FUNC(startTracing);
};
// setAccTime 0.05;
_index = (count GVAR(traces));
_obj = _this select 1;
_origin = _this select 0;
_color = [1,0,0,1];
private _index = count GVAR(traces);
params ["_origin", "_obj"];
private _color = [1,0,0,1];
if((count _this) > 2) then {
_color = _this select 2;
};
_positions = [];
_objSpd = vectorMagnitude (velocity _obj);
private _positions = [];
private _objSpd = vectorMagnitude (velocity _obj);
_positions set[(count _positions), [(getPos _obj), _objSpd]];
_data = [_origin, typeOf _origin, typeOf _obj, _objSpd, _positions, _color];
private _data = [_origin, typeOf _origin, typeOf _obj, _objSpd, _positions, _color];
GVAR(traces) set[_index, _data];
[DFUNC(trackTrace), 0, [_obj, _index, CBA_missionTime]] call CBA_fnc_addPerFrameHandler;

View File

@ -1,18 +1,12 @@
//fnc_doExplosions.sqf
#include "script_component.hpp"
private ["_params", "_explosions", "_index", "_i", "_exp", "_refExp", "_bpos", "_hit", "_distance", "_indirectHitRange", "_depth"];
_params = _this select 0;
_explosions = _params select 0;
_index = _params select 1;
params ["_args"];
_args params ["_explosions", "_index"];
for "_i" from _index to ((_index+2) min (count _explosions)) do {
_exp = _explosions select _i;
_refExp = _exp select 0;
_bpos = _exp select 1;
_hit = _exp select 2;
_distance = _exp select 3;
_indirectHitRange = _exp select 4;
_depth = _exp select 5;
private _exp = _explosions select _i;
_exp params ["_refExp", "_bpos", "_hit", "_distance", "_indirectHitRange", "_depth"];
_refExp createVehicle (ASLtoATL _bpos);
// if(_hit >= 150 && _distance > _indirectHitRange) then {
// [_bpos, _refExp, _depth] call FUNC(doReflections);

View File

@ -1,18 +1,16 @@
//fnc_doReflections.sqf
#include "script_component.hpp"
private ["_pos", "_ammo", "_depth", "_hit", "_range", "_hitFactor", "_indirectHitRange", "_indirectHit", "_testParams"];
params ["_pos", "_ammo"];
_pos = _this select 0;
_ammo = _this select 1;
_depth = 1;
private _depth = 1;
if(count _this > 2) then {
_depth = _this select 2;
};
// TEST_ICONS pushBack [_pos, format["EXP!", _hit, _range, _hitFactor]];
if(_depth <= 2) then {
_indirectHitRange = getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirectHitRange");
_indirectHit = getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirectHit");
_testParams = [_pos, [_indirectHitRange, _indirectHit], [], [], -4, _depth, 0];
private _indirectHitRange = getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirectHitRange");
private _indirectHit = getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirectHit");
private _testParams = [_pos, [_indirectHitRange, _indirectHit], [], [], -4, _depth, 0];
[DFUNC(findReflections), 0, _testParams] call CBA_fnc_addPerFrameHandler;
};

View File

@ -2,46 +2,41 @@
#include "script_component.hpp"
// ACE_player sideChat "WAAAAAAAAAAAAAAAAAAAAA";
private ["_hitData", "_initialData", "_hpData", "_object", "_foundObjects", "_index", "_foundObjecsts", "_roundType", "_round", "_caliber", "_explosive", "_idh", "_alive", "_exit", "_vm", "_velocity", "_oldVelocity", "_curVelocity", "_diff", "_polar", "_unitDir", "_spallPos", "_pos1", "_i", "_pos2", "_blah", "_data", "_spallPolar", "_warn", "_c", "_m", "_k", "_gC", "_fragPower", "_fragTypes", "_spread", "_spallCount", "_elev", "_dir", "_vel", "_spallFragVect", "_fragType", "_fragment", "_pos"];
params ["_hitData"];
private _initialData = GVAR(spallHPData) select (_hitData select 0);
private _hpData = (_hitData select 1) select (_this select 1);
_hitData = _this select 0;
_initialData = GVAR(spallHPData) select (_hitData select 0);
_hpData = (_hitData select 1) select (_this select 1);
_object = _hpData select 0;
_hpData params ["_object"];
_object removeEventHandler ["hitPart", _initialData select 0];
_foundObjects = _initialData select 7;
_index = _foundObjects find _object;
private _foundObjects = _initialData select 7;
private _index = _foundObjects find _object;
if(_index != -1) then {
_foundObjecsts set[_index, nil];
_foundObjects set[_index, nil];
};
_roundType = (_initialData select 2);
_round = (_initialData select 3);
_object = (_initialData select 1);
_initialData params ["", "_object", "_roundType", "_round"];
_caliber = getNumber(configFile >> "CfgAmmo" >> _roundType >> "caliber");
_explosive = getNumber(configFile >> "CfgAmmo" >> _roundType >> "explosive");
_idh = getNumber(configFile >> "CfgAmmo" >> _roundType >> "indirectHitRange");
private _caliber = getNumber(configFile >> "CfgAmmo" >> _roundType >> "caliber");
private _explosive = getNumber(configFile >> "CfgAmmo" >> _roundType >> "explosive");
private _idh = getNumber(configFile >> "CfgAmmo" >> _roundType >> "indirectHitRange");
_alive = true;
if(!alive _round && (_initialData select 6) == 1) then {
private _alive = true;
if(!alive _round && (_initialData select 6) isEqualTo 1) then {
_alive = false;
};
if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
// ACE_player sideChat format["BBBB"];
_exit = false;
_vm = 1;
_velocity = _initialData select 5;
private _exit = false;
private _vm = 1;
private _velocity = _initialData select 5;
_oldVelocity = vectorMagnitude _velocity;
_curVelocity = vectorMagnitude (velocity _round);
private _oldVelocity = vectorMagnitude _velocity;
private _curVelocity = vectorMagnitude (velocity _round);
if(alive _round) then {
_diff = _velocity vectorDiff (velocity _round);
_polar = _diff call CBA_fnc_vect2polar;
private _diff = _velocity vectorDiff (velocity _round);
private _polar = _diff call CBA_fnc_vect2polar;
// ACE_player sideChat format["polar: %1", _polar];
if((abs(_polar select 1) > 45 || abs(_polar select 2) > 45)) then {
if(_caliber < 2.5) then {
@ -53,12 +48,12 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
};
};
if(!_exit) then {
_unitDir = vectorNormalized _velocity;
_pos = _hpData select 3;
_spallPos = nil;
private _unitDir = vectorNormalized _velocity;
private _pos = _hpData select 3;
private _spallPos = nil;
for "_i" from 0 to 100 do {
_pos1 = _pos vectorAdd (_unitDir vectorMultiply (0.01 * _i));
_pos2 = _pos vectorAdd (_unitDir vectorMultiply (0.01 * (_i + 1)));
private _pos1 = _pos vectorAdd (_unitDir vectorMultiply (0.01 * _i));
private _pos2 = _pos vectorAdd (_unitDir vectorMultiply (0.01 * (_i + 1)));
// _blah = [_object, "FIRE"] intersect [_object worldToModel (ASLtoATL _pos1), _object worldToModel (ASLtoATL _pos2)];
// diag_log text format["b: %1", _blah];
@ -71,29 +66,29 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
};
};
if(!isNil "_spallPos") then {
_spallPolar = _velocity call CBA_fnc_vect2polar;
private _spallPolar = _velocity call CBA_fnc_vect2polar;
if(_explosive > 0) then {
// ACE_player sideChat format["EXPLOSIVE!"];
_warn = false;
_c = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(CHARGE));
private _warn = false;
private _c = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(CHARGE));
if(_c == 0) then { _c = 1; _warn = true;};
_m = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(METAL));
private _m = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(METAL));
if(_m == 0) then { _m = 2; _warn = true;};
_k = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(GURNEY_K));
private _k = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(GURNEY_K));
if(_k == 0) then { _k = 1/2; _warn = true;};
_gC = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(GURNEY_C));
private _gC = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(GURNEY_C));
if(_gC == 0) then { _gC = 2440; _warn = true;};
if(_warn) then {
ACE_LOGWARNING_1("Ammo class %1 lacks proper explosive properties definitions for frag!",_roundType); //TODO: turn this off when we get closer to release
};
_fragPower = (((_m/_c)+_k)^-(1/2))*_gC;
private _fragPower = (((_m/_c)+_k)^-(1/2))*_gC;
_spallPolar set[0, _fragPower*0.66];
};
_fragTypes = [
private _fragTypes = [
QGVAR(spall_small), QGVAR(spall_small), QGVAR(spall_small),
QGVAR(spall_small),QGVAR(spall_medium),QGVAR(spall_medium),QGVAR(spall_medium),
QGVAR(spall_medium), QGVAR(spall_large), QGVAR(spall_large), QGVAR(spall_huge),
@ -102,21 +97,21 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
];
// diag_log text format["SPALL POWER: %1", _spallPolar select 0];
_spread = 15+(random 25);
_spallCount = 5+(random 10);
private _spread = 15+(random 25);
private _spallCount = 5+(random 10);
for "_i" from 1 to _spallCount do {
_elev = ((_spallPolar select 2)-_spread)+(random (_spread*2));
_dir = ((_spallPolar select 1)-_spread)+(random (_spread*2));
private _elev = ((_spallPolar select 2)-_spread)+(random (_spread*2));
private _dir = ((_spallPolar select 1)-_spread)+(random (_spread*2));
if(abs _elev > 90) then {
_dir = _dir + 180;
};
_dir = _dir % 360;
_vel = (_spallPolar select 0)*0.33*_vm;
private _vel = (_spallPolar select 0)*0.33*_vm;
_vel = (_vel-(_vel*0.25))+(random (_vel*0.5));
_spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect;
_fragType = round (random ((count _fragTypes)-1));
_fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
private _spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect;
private _fragType = round (random ((count _fragTypes)-1));
private _fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
_fragment setPosASL _spallPos;
_fragment setVelocity _spallFragVect;
@ -127,18 +122,18 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
_spread = 5+(random 5);
_spallCount = 3+(random 5);
for "_i" from 1 to _spallCount do {
_elev = ((_spallPolar select 2)-_spread)+(random (_spread*2));
_dir = ((_spallPolar select 1)-_spread)+(random (_spread*2));
private _elev = ((_spallPolar select 2)-_spread)+(random (_spread*2));
private _dir = ((_spallPolar select 1)-_spread)+(random (_spread*2));
if(abs _elev > 90) then {
_dir = _dir + 180;
};
_dir = _dir % 360;
_vel = (_spallPolar select 0)*0.55*_vm;
private _vel = (_spallPolar select 0)*0.55*_vm;
_vel = (_vel-(_vel*0.25))+(random (_vel*0.5));
_spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect;
_fragType = round (random ((count _fragTypes)-1));
_fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
private _spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect;
private _fragType = round (random ((count _fragTypes)-1));
private _fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
_fragment setPosASL _spallPos;
_fragment setVelocity _spallFragVect;

View File

@ -1,25 +1,18 @@
//fnc_findReflections.sqf
#include "script_component.hpp"
private ["_split", "_radi", "_params", "_pos", "_explosiveInfo", "_los", "_nlos", "_zIndex", "_depth", "_indirectHitRange", "_indirectHit", "_distanceCount", "_lastPos", "_test", "_vec", "_testPos", "_buckets", "_excludes", "_bucketIndex", "_bucketPos", "_bucketList", "_c", "_index", "_blist", "_avgX", "_avgY", "_avgZ", "_bpos", "_distance", "_hitFactor", "_hit", "_range", "_refExp", "_rand", "_i", "_x", "_res", "_forEachIndex", "_explosions", "_can", "_dirvec", "_zAng"];
private ["_lastPos", "_test", "_vec", "_testPos", "_buckets", "_excludes", "_bucketIndex", "_bucketPos", "_bucketList", "_c", "_index", "_blist", "_avgX", "_avgY", "_avgZ", "_bpos", "_distance", "_hitFactor", "_hit", "_range", "_refExp", "_i", "_x", "_res", "_forEachIndex", "_explosions", "_can", "_dirvec", "_zAng"];
BEGIN_COUNTER(fnc_findReflections);
_params = _this select 0;
_pos = _params select 0;
_explosiveInfo = _params select 1;
_los = _params select 2;
_nlos = _params select 3;
_zIndex = _params select 4;
_depth = _params select 5;
_rand = _params select 6;
params ["_args"];
_args params ["_pos", "_explosiveInfo", "_los", "_nlos", "_zIndex", "_depth", "_rand"];
_split = 15;
_radi = (360/_split*_depth);
private _split = 15;
private _radi = (360/_split*_depth);
// player sideChat format["p: %1", _explosiveInfo];
_indirectHitRange = _explosiveInfo select 0;
_indirectHit = _explosiveInfo select 1;
_distanceCount = (floor _indirectHitRange*4) min 100;
_explosiveInfo params ["_indirectHitRange", "_indirectHit"];
private _distanceCount = (floor _indirectHitRange*4) min 100;
if(_zIndex < 5) then {
_lastPos = _pos;

View File

@ -11,42 +11,39 @@ if(!isServer) exitWith { };
BEGIN_COUNTER(frago);
// _startTime = diag_tickTime;
private ["_startTime", "_round", "_lastPos", "_lastVel", "_shellType", "_gun", "_fragTypes", "_warn", "_atlPos", "_isArmed", "_fuseDist", "_indirectHitRange", "_fragRange", "_c", "_m", "_k", "_gC", "_fragPower", "_fragPowerRandom", "_manObjects", "_objects", "_crew", "_fragCount", "_fragArcs", "_doRandom", "_boundingBox", "_targetPos", "_distance", "_add", "_bbX", "_bbY", "_bbZ", "_cubic", "_targetVel", "_baseVec", "_dir", "_currentCount", "_count", "_vecVar", "_vec", "_fp", "_vel", "_fragType", "_fragObj", "_randomCount", "_sectorSize", "_sectorOffset", "_i", "_randomDir", "_endTime", "_target"];
private ["_fuseDist", "_indirectHitRange", "_fragRange", "_c", "_m", "_k", "_gC", "_fragPower", "_fragPowerRandom", "_manObjects", "_objects", "_crew", "_fragCount", "_fragArcs", "_doRandom", "_boundingBox", "_targetPos", "_distance", "_add", "_bbX", "_bbY", "_bbZ", "_cubic", "_targetVel", "_baseVec", "_dir", "_currentCount", "_count", "_vecVar", "_vec", "_fp", "_vel", "_fragType", "_fragObj", "_randomCount", "_sectorSize", "_sectorOffset", "_i", "_randomDir", "_endTime", "_target"];
_round = _this select 0;
_lastPos = _this select 1;
_lastVel = _this select 2;
_shellType = _this select 3;
_gun = nil;
params ["_round", "_lastPos", "_lastVel", "_shellType"];
private _gun = nil;
if((count _this) > 5) then {
_gun = _this select 5;
};
_fragTypes = [
private _fragTypes = [
QGVAR(tiny), QGVAR(tiny), QGVAR(tiny),
QGVAR(tiny_HD), QGVAR(tiny_HD), QGVAR(tiny_HD),
QGVAR(small),QGVAR(small),QGVAR(small),QGVAR(small),
QGVAR(small_HD),QGVAR(small_HD),QGVAR(small_HD),QGVAR(small_HD),
QGVAR(medium_HD), QGVAR(medium_HD), QGVAR(medium_HD), QGVAR(medium_HD), QGVAR(medium_HD)
];
];
_warn = false;
private _warn = false;
if(isArray (configFile >> "CfgAmmo" >> _shellType >> QGVAR(CLASSES))) then {
_fragTypes = getArray (configFile >> "CfgAmmo" >> _shellType >> QGVAR(CLASSES));
} else {
_warn = true;
};
_atlPos = ASLtoATL _lastPos;
private _atlPos = ASLtoATL _lastPos;
_isArmed = true;
private _isArmed = true;
if(!isNil "_gun") then {
_fuseDist = getNumber(configFile >> "CfgAmmo" >> _shellType >> "fuseDistance");
_isArmed = ((getPosASL _gun) distance _lastPos > _fuseDist);
};
_indirectHitRange = getNumber(configFile >> "CfgAmmo" >> _shellType >> "indirecthitrange");
_fragRange = 20*_indirectHitRange*4;
_fragRange = 20 * _indirectHitRange * 4;
// _c = 185; // grams of comp-b
// _m = 210; // grams of fragmentating metal
// _k = 3/5; // spherical K factor
@ -72,9 +69,9 @@ if(_warn) then {
};
_fragPower = (((_m/_c)+_k)^-(1/2))*_gC;
_fragPower = _fragPower*0.8; // Gunery equation is for a non-fragmenting metal, imperical value of 80% represents fragmentation
_fragPower = _fragPower * 0.8; // Gunery equation is for a non-fragmenting metal, imperical value of 80% represents fragmentation
_fragPowerRandom = _fragPower*0.5;
_fragPowerRandom = _fragPower * 0.5;
if((_atlPos select 2) < 0.5) then {
_lastPos set[2, (_lastPos select 2)+0.5];
};
@ -123,7 +120,7 @@ if(_isArmed && (count _objects) > 0) then {
_bbX = (abs((_boundingBox select 0) select 0))+((_boundingBox select 1) select 0);
_bbY = (abs((_boundingBox select 0) select 1))+((_boundingBox select 1) select 1);
_bbZ = (abs((_boundingBox select 0) select 2))+((_boundingBox select 1) select 2);
_cubic = _bbX*_bbY*_bbZ;
_cubic = _bbX * _bbY * _bbZ;
if(_cubic > 1) then {
_doRandom = true;
@ -181,7 +178,7 @@ if(_isArmed && (count _objects) > 0) then {
if(_fragCount > MAX_FRAG_COUNT) exitWith {};
} forEach _objects;
if(_fragCount > MAX_FRAG_COUNT) exitWith {};
_randomCount = ((ceil((MAX_FRAG_COUNT-_fragCount)*0.1)) max 0)+20;
_randomCount = ((ceil((MAX_FRAG_COUNT - _fragCount)*0.1)) max 0)+20;
_sectorSize = 360 / (_randomCount max 1);
// _doRandom = false;
if(_doRandom) then {

View File

@ -15,12 +15,12 @@
if (!GVAR(enabled)) exitWith {};
private["_gcIndex", "_iter"];
private ["_gcIndex", "_iter"];
_gcIndex = [];
_iter = 0;
while { (count GVAR(objects)) > 0 && { _iter < (GVAR(MaxTrackPerFrame) min (count GVAR(objects))) } } do {
private["_object", "_args"];
private ["_object", "_args"];
if(GVAR(lastIterationIndex) >= (count GVAR(objects))) then {
GVAR(lastIterationIndex) = 0;
};
@ -38,7 +38,7 @@ while { (count GVAR(objects)) > 0 && { _iter < (GVAR(MaxTrackPerFrame) min (cou
};
// clean up dead object references
private["_deletionCount", "_deleteIndex"];
private ["_deletionCount", "_deleteIndex"];
_deletionCount = 0;
{
TRACE_1("GC Projectile", _x);

View File

@ -32,7 +32,7 @@ _this set[1, (getPosASL _round)];
_this set[2, (velocity _round)];
if(_doSpall) then {
private["_scale"];
private ["_scale"];
_scale = ( (count GVAR(objects)) / GVAR(MaxTrackPerFrame) ) max 0.1;
[_round, _scale, _spallTrack, _foundObjectHPIds] call FUNC(spallTrack);
};

View File

@ -1,31 +1,27 @@
//fnc_spallTrack.sqf
#include "script_component.hpp"
private ["_round", "_multiplier", "_foundObjects", "_foundObjectHPIds", "_delta", "_curPos", "_velocity", "_velocityStep", "_forwardPos", "_intersectsWith", "_index", "_hpId", "_data"];
_round = _this select 0;
_multiplier = _this select 1;
_foundObjects = _this select 2;
_foundObjectHPIds = _this select 3;
params ["_round", "_multiplier", "_foundObjects", "_foundObjectHPIds"];
_delta = (1/diag_fps) * _multiplier;
_curPos = getPosASL _round;
_velocity = velocity _round;
private _delta = (1/diag_fps) * _multiplier;
private _curPos = getPosASL _round;
private _velocity = velocity _round;
_velocityStep = _velocity vectorMultiply _delta;
_forwardPos = _curPos vectorAdd _velocityStep;
private _velocityStep = _velocity vectorMultiply _delta;
private _forwardPos = _curPos vectorAdd _velocityStep;
_intersectsWith = lineIntersectsWith [_curPos, _forwardPos];
private _intersectsWith = lineIntersectsWith [_curPos, _forwardPos];
if (count _intersectsWith > 0) then {
// player sideChat format["inter: %1", _intersectsWith];
{
if(!(_x in _foundObjects)) then {
// diag_log text format["Adding HP: %1", _x];
_index = (count GVAR(spallHPData));
_hpId = _x addEventHandler ["hitPart", compile format["[%1, _this] call " + QFUNC(spallHP), _index]];
private _index = count GVAR(spallHPData);
private _hpId = _x addEventHandler ["hitPart", compile format["[%1, _this] call " + QFUNC(spallHP), _index]];
_foundObjects set[(count _foundObjects), _x];
_foundObjectHPIds set[(count _foundObjectHPIds), _hpId];
_data = [_hpId, _x, typeOf _round, _round, _curPos, _velocity, 0, _foundObjects, _foundObjectHPIds];
private _data = [_hpId, _x, typeOf _round, _round, _curPos, _velocity, 0, _foundObjects, _foundObjectHPIds];
GVAR(spallHPData) set[_index, _data];
};
} forEach _intersectsWith;

View File

@ -1,14 +1,12 @@
#include "script_component.hpp"
private ["_params", "_tracerObj", "_index", "_positions", "_data"];
_params = _this select 0;
_tracerObj = _params select 0;
_index = _params select 1;
params ["_args"];
_args params ["_tracerObj", "_index"];
if (alive _tracerObj && (count GVAR(traces)) > 0) then {
_data = GVAR(traces) select _index;
_positions = _data select 4;
_positions set [(count _positions), [(getPos _tracerObj), vectorMagnitude (velocity _tracerObj)]];
private _data = GVAR(traces) select _index;
private _positions = _data select 4;
_positions pushBack [(getPos _tracerObj), vectorMagnitude (velocity _tracerObj)];
} else {
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
};

View File

@ -21,11 +21,11 @@ params ["_text", "_icon", "_sPos", "_textSettings"];
TRACE_2("Icon",_text,_sPos);
if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then {
private _displayNum = [[46, 12] select visibleMap,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]);
GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]);
private _displayNum = [[46, 12] select visibleMap, 91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]);
GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021 + GVAR(iconCount)]);
if (GVAR(useCursorMenu)) then {
((finddisplay _displayNum) displayctrl (54021+GVAR(iconCount))) ctrlAddEventHandler ["MouseMoving", DFUNC(handleMouseMovement)];
((finddisplay _displayNum) displayctrl (54021+GVAR(iconCount))) ctrlAddEventHandler ["MouseButtonDown", DFUNC(handleMouseButtonDown)];
((finddisplay _displayNum) displayctrl (54021 + GVAR(iconCount))) ctrlAddEventHandler ["MouseMoving", DFUNC(handleMouseMovement)];
((finddisplay _displayNum) displayctrl (54021 + GVAR(iconCount))) ctrlAddEventHandler ["MouseButtonDown", DFUNC(handleMouseButtonDown)];
};
};
private _ctrl = GVAR(iconCtrls) select GVAR(iconCount);
@ -44,9 +44,9 @@ _text = if (GVAR(UseListMenu)) then {
GVAR(iconCount) = GVAR(iconCount) + 1;
private _pos = if (GVAR(UseListMenu)) then {
[(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.20*SafeZoneW, 0.035*SafeZoneW]
[(_sPos select 0) - (0.0095 * SafeZoneW), (_sPos select 1) - (0.0095 * SafeZoneW), 0.20 * SafeZoneW, 0.035 * SafeZoneW]
} else {
[(_sPos select 0)-(0.0750*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.15*SafeZoneW, 0.100*SafeZoneW]
[(_sPos select 0) - (0.0750 * SafeZoneW), (_sPos select 1) - (0.0095 * SafeZoneW), 0.15 * SafeZoneW, 0.100 * SafeZoneW]
};
if (GVAR(cursorKeepCentered) && {uiNamespace getVariable [QGVAR(cursorMenuOpened),false]}) then {

View File

@ -19,8 +19,7 @@
params ["_vehicle", "_player"];
private "_actions";
_actions = [];
private _actions = [];
{
private _unit = _x;

View File

@ -22,8 +22,7 @@ params ["_unit", "_target"];
[_unit, "GestureGo"] call EFUNC(common,doGesture);
private "_chance";
_chance = [0.5, 0.8] select (count weapons _unit > 0);
private _chance = [0.5, 0.8] select (count weapons _unit > 0);
{
if (count weapons _x == 0 && {random 1 < _chance}) then {

View File

@ -16,15 +16,13 @@
*/
#include "script_component.hpp"
private "_info";
_info = [MACRO_DOOR_REACH_DISTANCE] call FUNC(getDoor);
private _info = [MACRO_DOOR_REACH_DISTANCE] call FUNC(getDoor);
_info params ["_house", "_door"];
if (isNull _house) exitWith {};
private "_getDoorAnimations";
_getDoorAnimations = [_house, _door] call FUNC(getDoorAnimations);
private _getDoorAnimations = [_house, _door] call FUNC(getDoorAnimations);
_getDoorAnimations params ["_animations", "_lockedVariable"];
@ -49,8 +47,7 @@ GVAR(usedScrollWheel) = false;
// didn't use incremental opening. Just do animation normally.
if !(GVAR(usedScrollWheel)) then {
private "_phase";
_phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5);
private _phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5);
{_house animate [_x, _phase]; false} count _animations;
};

View File

@ -22,13 +22,11 @@ params ["_unit"];
[_unit, "GestureGo"] call EFUNC(common,doGesture);
private "_chance";
_chance = [0.5, 0.8] select (count weapons _unit > 0);
private _chance = [0.5, 0.8] select (count weapons _unit > 0);
{
if (count weapons _x == 0 && {random 1 < _chance}) then {
private "_position";
_position = getPosASL _unit vectorAdd (eyeDirection _unit vectorMultiply SEND_DISTANCE);
private _position = getPosASL _unit vectorAdd (eyeDirection _unit vectorMultiply SEND_DISTANCE);
_position set [2, 0];
[QGVAR(sendAway), [_x, _position], [_x]] call CBA_fnc_targetEvent;

View File

@ -26,8 +26,7 @@ params ["_leftClick", "_rightClick", ["_scroll", ""]];
disableSerialization;
private "_display";
_display = uiNamespace getVariable ["ACE_Helper_Display", objNull];
private _display = uiNamespace getVariable ["ACE_Helper_Display", objNull];
if (isNull _display) exitWith {};

View File

@ -6,9 +6,7 @@ PARAMS_2(_shooter,_weapon);
// Bail on not missile or javelin PFEH not running
if ((_shooter != ACE_player) || {(GVAR(pfehID) == -1)}) exitWith { false };
private ["_configs"];
_configs = configProperties [configFile >> "CfgWeapons" >> _weapon, QUOTE(configName _x == QUOTE(QGVAR(enabled))), false];
private _configs = configProperties [configFile >> "CfgWeapons" >> _weapon, QUOTE(configName _x == QUOTE(QGVAR(enabled))), false];
if (((count _configs) < 1) || {(getNumber (_configs select 0)) != 1}) exitWith {};
__JavelinIGUITargeting ctrlShow false;

View File

@ -5,11 +5,11 @@ TRACE_1("enter", _this);
#define __TRACKINTERVAL 0 // how frequent the check should be.
#define __LOCKONTIME 3 // Lock on won't occur sooner
private["_apos", "_aposX", "_aposY", "_args", "_boundsInput", "_bpos", "_canFire", "_constraintBottom"];
private["_constraintLeft", "_constraintRight", "_constraintTop", "_currentTarget", "_fireDisabledEH"];
private["_firedEH", "_fov", "_lastTick", "_lockTime", "_maxX", "_maxY", "_minX", "_minY", "_newTarget"];
private["_offsetX", "_offsetY", "_pos", "_randomLockInterval", "_randomPosWithinBounds", "_range"];
private["_runTime", "_soundTime", "_targetArray", "_zamerny", "_currentShooter"];
private ["_apos", "_aposX", "_aposY", "_args", "_boundsInput", "_bpos", "_canFire", "_constraintBottom"];
private ["_constraintLeft", "_constraintRight", "_constraintTop", "_currentTarget", "_fireDisabledEH"];
private ["_firedEH", "_fov", "_lastTick", "_lockTime", "_maxX", "_maxY", "_minX", "_minY", "_newTarget"];
private ["_offsetX", "_offsetY", "_pos", "_randomLockInterval", "_randomPosWithinBounds", "_range"];
private ["_runTime", "_soundTime", "_targetArray", "_zamerny", "_currentShooter"];
_currentShooter = if (ACE_player call CBA_fnc_canUseWeapon) then {ACE_player} else {vehicle ACE_player};
@ -35,7 +35,7 @@ _soundTime = _args select 4;
_randomLockInterval = _args select 5;
_fireDisabledEH = _args select 6;
private["_ammo", "_magazineConfig", "_weaponConfig"];
private ["_ammo", "_magazineConfig", "_weaponConfig"];
_weaponConfig = configProperties [configFile >> "CfgWeapons" >> (currentWeapon _currentShooter), QUOTE(configName _x == QUOTE(QGVAR(enabled))), false];
_magazineConfig = if ((currentMagazine _currentShooter) != "") then {
_ammo = getText (configFile >> "CfgMagazines" >> (currentMagazine _currentShooter) >> "ammo");
@ -123,7 +123,7 @@ _offsetY = __OffsetY;
__JavelinIGUITargeting ctrlShow true;
__JavelinIGUITargetingConstrains ctrlShow true;
_zamerny = if (_currentTarget isKindOf "CAManBase") then {_currentTarget selectionPosition "body"} else {_currentTarget selectionPosition "zamerny"};
_zamerny = _currentTarget selectionPosition (["zamerny", "body"] select (_currentTarget isKindOf "CAManBase"));
_randomPosWithinBounds = [(_zamerny select 0) + 1 - (random 2.0),(_zamerny select 1) + 1 - (random 2.0),(_zamerny select 2) + 0.5 - (random 1.0)];
_apos = worldToScreen (_currentTarget modelToWorld _randomPosWithinBounds);
@ -202,17 +202,17 @@ if (isNull _newTarget) then {
_minX = ((_bpos select 0) + _offsetX) max _constraintLeft;
_minY = ((_bpos select 1) + _offsetY) max _constraintTop;
_maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025*(3/4)*SafezoneH);
_maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025*SafezoneH);
_maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025 * (3 / 4) * SafezoneH);
_maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025 * SafezoneH);
TRACE_4("", _boundsInput, _bpos, _minX, _minY);
__JavelinIGUITargetingGateTL ctrlSetPosition [_minX,_minY];
__JavelinIGUITargetingGateTR ctrlSetPosition [_maxX,_minY];
__JavelinIGUITargetingGateBL ctrlSetPosition [_minX,_maxY];
__JavelinIGUITargetingGateBR ctrlSetPosition [_maxX,_maxY];
__JavelinIGUITargetingGateTL ctrlSetPosition [_minX, _minY];
__JavelinIGUITargetingGateTR ctrlSetPosition [_maxX, _minY];
__JavelinIGUITargetingGateBL ctrlSetPosition [_minX, _maxY];
__JavelinIGUITargetingGateBR ctrlSetPosition [_maxX, _maxY];
{_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR];
{_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL, __JavelinIGUITargetingGateTR, __JavelinIGUITargetingGateBL, __JavelinIGUITargetingGateBR];
_currentShooter setVariable["ace_missileguidance_target", _currentTarget, false];
@ -241,8 +241,8 @@ if (isNull _newTarget) then {
_minX = ((_bpos select 0) + _offsetX) max _constraintLeft;
_minY = ((_bpos select 1) + _offsetY) max _constraintTop;
_maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025*(3/4)*SafezoneH);
_maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025*SafezoneH);
_maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025 * (3 / 4) * SafezoneH);
_maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025 * SafezoneH);
TRACE_4("", _boundsInput, _bpos, _minX, _minY);
@ -272,7 +272,7 @@ if (isNull _newTarget) then {
__JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false;
_currentShooter setVariable ["ace_missileguidance_target",nil, false];
_currentShooter setVariable ["ace_missileguidance_target", nil, false];
// Disallow fire
_fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire);

View File

@ -1,7 +1,7 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);
private["_args", "_disableFireEH"];
private ["_args", "_disableFireEH"];
// uiNameSpace setVariable ['ACE_RscOptics_javelin',nil];

View File

@ -103,8 +103,7 @@ switch (_this) do {
case 6: { // Backlight
};
case 7: { // Exit
private ["_exit"];
_exit = true;
private _exit = true;
if (GVAR(referenceHeadingMenu) == 1) then {
GVAR(referenceHeadingMenu) = 0;
_exit = false;

View File

@ -16,10 +16,9 @@
* Public: No
*/
#include "script_component.hpp"
private "_table";
params ["_year", "_month", "_day"];
_table = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4];
private _table = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4];
if (_month < 3) then {
_year = _year - 1;
};

View File

@ -62,8 +62,7 @@ GVAR(Overlay) = true;
if (diag_tickTime > GVAR(updateTimer)) then {
GVAR(updateTimer) = diag_tickTime + 1;
private ["_outputData"];
_outputData = [] call FUNC(generateOutputData);
private _outputData = [] call FUNC(generateOutputData);
3 cutRsc ["RscKestrel4500", "PLAIN", 1, false];
_outputData params [

View File

@ -18,9 +18,7 @@
#define __ctrlCenterLine3 (__dsp displayCtrl 74602)
#define __ctrlCenterLine4 (__dsp displayCtrl 74603)
private ["_outputData"];
_outputData = [] call FUNC(generateOutputData);
private _outputData = [] call FUNC(generateOutputData);
{
ctrlSetText [_x , _outputData select _forEachIndex];

View File

@ -14,9 +14,7 @@
*/
#include "script_component.hpp"
private ["_windSpeed"];
_windSpeed = call FUNC(measureWindSpeed);
private _windSpeed = call FUNC(measureWindSpeed);
GVAR(ImpellerState) = GVAR(ImpellerState) + (ceil(_windSpeed) min 1) max _windSpeed;
if (GVAR(ImpellerState) > 1000) then { GVAR(ImpellerState) = 0 };

View File

@ -1,21 +1,18 @@
#include "script_component.hpp"
private ["_pos1", "_pos2", "_spacing", "_vectorTo", "_x", "_y", "_z", "_distance", "_count", "_return", "_alt", "_pos", "_designator", "_seeker"];
_pos1 = _this select 0;
_pos2 = _this select 1;
_designator = _this select 2;
_seeker = _this select 3;
_spacing = 100;
params ["_pos1", "_pos2", "_designator", "_seeker"]
private _spacing = 100;
if((count _this) > 4) then {
_spacing = _this select 4;
};
_return = true;
_vectorTo = [_pos2, _pos1] call BIS_fnc_vectorFromXToY;
private _return = true;
private _vectorTo = [_pos2, _pos1] call BIS_fnc_vectorFromXToY;
_x = (_vectorTo select 0)*0.25;
_y = (_vectorTo select 1)*0.25;
_z = (_vectorTo select 2)*0.25;
private _x = (_vectorTo select 0)*0.25;
private _y = (_vectorTo select 1)*0.25;
private _z = (_vectorTo select 2)*0.25;
_pos2 = [(_pos2 select 0) + _x, (_pos2 select 1) + _y, (_pos2 select 2) + _z];

View File

@ -1,13 +1,12 @@
#include "script_component.hpp"
private["_checkPos", "_i", "_largest", "_largestSpot", "_list", "_outliers", "_remainingSpots", "_samplePos", "_spot", "_spots", "_testPos"];
_list = _this select 0;
_checkPos = _this select 1;
_spots = [];
_outliers = [];
_spot = [];
_testPos = (_list select 0) select 0;
params ["_list", "_checkPos"];
private _spots = [];
private _outliers = [];
private _spot = [];
(_list select 0) params ["_testPos"];
{
_samplePos = _x select 0;
_x params ["_samplePos"];
if(!lineIntersects [_samplePos, _checkPos] && {!terrainIntersectASL [_samplePos, _checkPos]}) then {
if(_samplePos distance _testPos < 2) then {
_spot pushBack _samplePos;
@ -20,12 +19,12 @@ _spots pushBack _spot;
if(count _outliers > 0) then {
for "_i" from 1 to 3 do {
_remainingSpots = _outliers;
private _remainingSpots = _outliers;
_outliers = [];
_spot = [];
_testPos = (_remainingSpots select 0);
{
_samplePos = _x;
private _samplePos = _x;
if(!lineIntersects [_samplePos, _checkPos] && {!terrainIntersectASL [_samplePos, _checkPos]}) then {
if(_samplePos distance _testPos < 2) then {
_spot pushBack _samplePos;
@ -37,11 +36,11 @@ if(count _outliers > 0) then {
_spots pushBack _spot;
};
};
_largest = 0;
_largestSpot = [];
private _largest = 0;
private _largestSpot = [];
{
if((count _x) > _largest) then {
_largest = (count _x);
if(count _x > _largest) then {
_largest = count _x;
_largestSpot = _x;
};
} forEach _spots;

View File

@ -1,8 +1,7 @@
//fnc_handleLaserOff.sqf
#include "script_component.hpp"
private ["_uuid"];
_uuid = _this select 0;
params ["_uuid"];
if ([GVAR(laserEmitters), _uuid] call CBA_fnc_hashHasKey) then {
[GVAR(laserEmitters), _uuid] call CBA_fnc_hashRem;
};

View File

@ -1,7 +1,5 @@
//fnc_handleLaserOn.sqf
#include "script_component.hpp"
private ["_uuid", "_args"];
_uuid = _this select 0;
_args = _this select 1;
params ["_uuid", "_args"];
[GVAR(laserEmitters), _uuid, _args] call CBA_fnc_hashSet;

View File

@ -1,6 +1,6 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
private["_oldLaserCode", "_laserCode"];
private ["_oldLaserCode", "_laserCode"];
_oldLaserCode = ACE_player getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE];
if(_oldLaserCode > ACE_DEFAULT_LASER_CODE) then {

View File

@ -1,6 +1,6 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
private["_oldLaserCode", "_laserCode"];
private ["_oldLaserCode", "_laserCode"];
_oldLaserCode = ACE_player getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE];
_laserCode = _oldLaserCode + 1;

View File

@ -11,6 +11,5 @@
#include "script_component.hpp"
private ["_uuid"];
_uuid = _this select 0;
params ["_uuid"];
["ace_laserOff", [_uuid]] call CBA_fnc_globalEvent;

View File

@ -16,8 +16,7 @@
#include "script_component.hpp"
private ["_uuid", "_args"];
_uuid = format["%1%2%3", floor diag_tickTime, floor random 1000, floor random 10000];
_args = [_uuid, _this];
private _uuid = format["%1%2%3", floor diag_tickTime, floor random 1000, floor random 10000];
private _args = [_uuid, _this];
["ace_laserOn", _args] call CBA_fnc_globalEvent;
_uuid;

View File

@ -2,12 +2,9 @@
#include "script_component.hpp"
TRACE_1("enter", _this);
private["_args", "_laserTarget", "_pos", "_shooter", "_uuid"];
//TRACE_1("enter", _this);
_args = _this select 0;
_laserTarget = _args select 0;
_shooter = _args select 1;
_uuid = _args select 2;
params ["_args"];
_args params ["_laserTarget", "_shooter", "_uuid"];
if(isNull _laserTarget || !alive _shooter) exitWith {
[(_this select 1)] call CBA_fnc_removePerFrameHandler;

View File

@ -3,7 +3,7 @@
TRACE_1("enter", _this);
PARAMS_1(_laserTarget);
private["_uuid"];
private ["_uuid"];
// Add the target to the global targets array
// Everyone tracks them

View File

@ -1,6 +1,6 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
private["_laserCode"];
private ["_laserCode"];
_laserCode = ACE_player getVariable[QGVAR(code), ACE_DEFAULT_LASER_CODE];
if(!isNil "_laserCode") then {

View File

@ -1,5 +1,5 @@
#include "script_component.hpp"
private["_d", "_map", "_p", "_theta", "_u"];
private ["_d", "_map", "_p", "_theta", "_u"];
_map = _this select 0;
_theta = _this select 1;

View File

@ -18,7 +18,7 @@
private ["_pos", "_seekerWavelengths", "_seekerCode", "_spots", "_buckets", "_excludes", "_bucketIndex", "_finalPos", "_owner", "_obj", "_x", "_method"];
private ["_emitterWavelength", "_laserCode", "_divergence", "_laser", "_res", "_bucketPos", "_bucketList", "_c", "_forEachIndex", "_index"];
private ["_testPos", "_finalBuckets", "_largest", "_largestIndex", "_finalBucket", "_owners", "_avgX", "_avgY", "_avgZ", "_count", "_maxOwner", "_maxOwnerIndex", "_finalOwner"];
private["_dir", "_seekerCos", "_seekerFov", "_testDotProduct", "_testPoint", "_testPointVector"];
private ["_dir", "_seekerCos", "_seekerFov", "_testDotProduct", "_testPoint", "_testPointVector"];
_pos = _this select 0;
_dir = vectorNormalized (_this select 1);

View File

@ -12,7 +12,7 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
private["_emmiter", "_owner", "_gunnerInfo", "_turretInfo", "_povPos", "_povDir"];
private ["_emmiter", "_owner", "_gunnerInfo", "_turretInfo", "_povPos", "_povDir"];
_emmiter = _this select 0;
_owner = _this select 1;

View File

@ -13,7 +13,7 @@
*/
#include "script_component.hpp"
private["_gunnerInfo", "_turretInfo"];
private ["_gunnerInfo", "_turretInfo"];
params ["_emmiter"];
_gunnerInfo = [_emmiter, (currentWeapon _emmiter)] call CBA_fnc_getFirer;

View File

@ -18,7 +18,7 @@ TRACE_1("enter", _this);
#define FCS_UPDATE_DELAY 1
FUNC(laserHudDesignatePFH) = {
private["_strongestResultPos", "_args", "_localLaserTarget", "_laserResultPosition", "_laserResult", "_shooter", "_vehicle", "_weapon", "_gunnerInfo", "_turretInfo", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir", "_result", "_resultPositions", "_firstResult", "_forceUpdateTime"];
private ["_strongestResultPos", "_args", "_localLaserTarget", "_laserResultPosition", "_laserResult", "_shooter", "_vehicle", "_weapon", "_gunnerInfo", "_turretInfo", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir", "_result", "_resultPositions", "_firstResult", "_forceUpdateTime"];
params ["_args"];
_args params ["_shooter", "_localLaserTarget"];
_vehicle = vehicle _shooter;

View File

@ -16,8 +16,7 @@ GVAR(nearUnits) = [];
// @todo. Maybe move to common?
[{
private "_nearUnits";
_nearUnits = [];
private _nearUnits = [];
{
_nearUnits append crew _x;
if (count _nearUnits > 10) exitWith {

View File

@ -15,19 +15,18 @@
* Public: No
*/
#include "script_component.hpp"
private ["_onFinish", "_onFailure"];
params ["_caller", "_target"];
if (!(_this call FUNC(canRefuelUAV))) exitWith {};
_onFinish = {
private _onFinish = {
(_this select 0) params ["_caller", "_target"];
_caller removeItem "ACE_UAVBattery";
playSound3D [QUOTE(PATHTO_R(sounds\exchange_battery.ogg)), objNull, false, getPosASL _caller, 1, 1, 10];
[QEGVAR(common,setFuel), [_target, 1], [_target]] call CBA_fnc_targetEvent; //setFuel is local
};
_onFailure = {
private _onFailure = {
(_this select 0) params ["_caller", "_target"];
[_caller, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
};

View File

@ -22,10 +22,9 @@ params ["_target", "_player"];
private _unitMagazines = [];
private _unitMagCounts = [];
{
private "_xFullMagazineCount";
_x params ["_xClassname", "_xCount", "_xLoaded", "_xType"];
_xFullMagazineCount = getNumber (configFile >> "CfgMagazines" >> _xClassname >> "count");
private _xFullMagazineCount = getNumber (configFile >> "CfgMagazines" >> _xClassname >> "count");
//for every partial magazine, that is either in inventory or can be moved there
if ((_xCount < _xFullMagazineCount) && {_xCount > 0} && {(!_xLoaded) || {_player canAdd _xClassname}}) then {

View File

@ -26,7 +26,7 @@
if (!GVAR(enabled) || !visibleMap) exitWith {};
private["_color", "_drawPosVariableName", "_group", "_grpName", "_pos", "_unitUID"];
private ["_color", "_drawPosVariableName", "_group", "_grpName", "_pos", "_unitUID"];
params ["_mapHandle"];

View File

@ -16,11 +16,9 @@
*/
#include "script_component.hpp"
private "_proximityPlayers";
params ["_unit", "_range"];
_proximityPlayers = (getPos _unit) nearEntities [["CAMAnBase"], _range];
private _proximityPlayers = (getPos _unit) nearEntities [["CAMAnBase"], _range];
_proximityPlayers deleteAt (_proximityPlayers find _unit);
_proximityPlayers append (crew vehicle _unit);
_proximityPlayers

Some files were not shown because too many files have changed in this diff Show More