Cleanup++:

* Added missing privates
* Removed unused privates
* Replaced some old vector calculations with new vector commands
This commit is contained in:
ulteq 2015-04-27 22:04:35 +02:00
parent 3c92cab7af
commit 0d6d96e76c
9 changed files with 34 additions and 36 deletions

View File

@ -1,5 +1,8 @@
#include "script_component.hpp" #include "script_component.hpp"
if(GVAR(autoTrace)) then {
private ["_color", "_data", "_index", "_obj", "_objTVel", "_objVel", "_origin", "_positions"];
if (GVAR(autoTrace)) then {
[] call FUNC(startTracing); [] call FUNC(startTracing);
}; };
@ -16,5 +19,6 @@ _objVel = velocity _obj;
_objTVel = sqrt((_objVel select 0)^2 + (_objVel select 1)^2 + (_objVel select 2)^2); _objTVel = sqrt((_objVel select 0)^2 + (_objVel select 1)^2 + (_objVel select 2)^2);
_positions set[(count _positions), [(getPos _obj), _objTVel]]; _positions set[(count _positions), [(getPos _obj), _objTVel]];
_data = [_origin, typeOf _origin, typeOf _obj, _objTVel, _positions, _color]; _data = [_origin, typeOf _origin, typeOf _obj, _objTVel, _positions, _color];
GVAR(traces) set[_index, _data]; GVAR(traces) set[_index, _data];
[DFUNC(trackTrace), 0, [_obj, _index, time]] call cba_fnc_addPerFrameHandler; [DFUNC(trackTrace), 0, [_obj, _index, time]] call cba_fnc_addPerFrameHandler;

View File

@ -8,8 +8,7 @@ private ["_params", "_initialData", "_hpData", "_roundType", "_round", "_object"
"_idh", "_alive", "_exit", "_vm", "_velocity", "_unitDir", "_oldVelocity", "_curVelocity", "_diff", "_polar", "_idh", "_alive", "_exit", "_vm", "_velocity", "_unitDir", "_oldVelocity", "_curVelocity", "_diff", "_polar",
"_pos", "_spallPos", "_i", "_pos1", "_pos2", "_blah", "_data", "_spallPolar", "_c", "_warn", "_m", "_k", "_pos", "_spallPos", "_i", "_pos1", "_pos2", "_blah", "_data", "_spallPolar", "_c", "_warn", "_m", "_k",
"_gC", "_shellType", "_fragPower", "_spread", "_spallCount", "_elev", "_dir", "_vel", "_spallFragVect", "_gC", "_shellType", "_fragPower", "_spread", "_spallCount", "_elev", "_dir", "_vel", "_spallFragVect",
"_fragment"]; "_fragment", "_index", "_hitData", "_fragTypes", "_fragType", "_foundObjects"];
_params = _this select 0; _params = _this select 0;
[(_this select 1)] call cba_fnc_removePerFrameHandler; [(_this select 1)] call cba_fnc_removePerFrameHandler;

View File

@ -1,4 +1,7 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_color", "_index", "_lastPos", "_lastSpd", "_max", "_positions", "_startSpeed"];
{ {
_positions = _x select 4; _positions = _x select 4;
_color = _x select 5; _color = _x select 5;

View File

@ -1,6 +1,6 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_gun", "_type", "_round", "_doFragTrack", "_doSpall"]; private ["_gun", "_type", "_round", "_doFragTrack", "_doSpall", "_spallTrack", "_spallTrackID"];
if (!GVAR(enabled)) exitWith {}; if (!GVAR(enabled)) exitWith {};

View File

@ -14,7 +14,7 @@ private ["_round", "_lastPos", "_lastVel", "_shellType", "_gun", "_fragTypes", "
"_manObjects", "_objects", "_crew", "_fragCount", "_fragArcs", "_doRandom", "_target", "_boundingBox", "_manObjects", "_objects", "_crew", "_fragCount", "_fragArcs", "_doRandom", "_target", "_boundingBox",
"_targetPos", "_distance", "_add", "_bbX", "_bbY", "_bbZ", "_cubic", "_targetVel", "_baseVec", "_dir", "_targetPos", "_distance", "_add", "_bbX", "_bbY", "_bbZ", "_cubic", "_targetVel", "_baseVec", "_dir",
"_currentCount", "_count", "_vecVar", "_i", "_vec", "_fp", "_vel", "_fragType", "_fragObj", "_randomCount", "_currentCount", "_count", "_vecVar", "_i", "_vec", "_fp", "_vel", "_fragType", "_fragObj", "_randomCount",
"_sectorSize", "_sectorOffset", "_randomDir"]; "_sectorSize", "_sectorOffset", "_randomDir", "_endTime"];
_round = _this select 0; _round = _this select 0;

View File

@ -1,15 +1,15 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_initialData", "_currentCount", "_hpData", "_round", "_hpRound"]; private ["_initialData", "_hpData", "_round", "_hpRound", "_hpDirect"];
//player sideChat format["f: %1 c: %2", (_this select 0), (count GVAR(spallHPData))]; //player sideChat format["f: %1 c: %2", (_this select 0), (count GVAR(spallHPData))];
if((_this select 0) <= (count GVAR(spallHPData))) then {
if ((_this select 0) <= (count GVAR(spallHPData))) then {
_initialData = GVAR(spallHPData) select (_this select 0); _initialData = GVAR(spallHPData) select (_this select 0);
if(!isNil "_initialData") then { if (!isNil "_initialData") then {
_hpRound = ((_this select 1) select 0) select 2; _hpRound = ((_this select 1) select 0) select 2;
_round = _initialData select 3; _round = _initialData select 3;
_hpDirect = ((_this select 1) select 0) select 10; _hpDirect = ((_this select 1) select 0) select 10;
if(_hpDirect && {_round == _hpRound}) then { if (_hpDirect && {_round == _hpRound}) then {
{ {
_hpData = _x; _hpData = _x;
_round = _initialData select 3; _round = _initialData select 3;

View File

@ -1,30 +1,22 @@
//fnc_spallTrack.sqf //fnc_spallTrack.sqf
#include "script_component.hpp" #include "script_component.hpp"
private ["_params", "_round", "_multiplier", "_delta", "_curPos", "_velocity", "_velocityStep", "_forwardPos", "_intersectsWith", "_index", "_i", "_test", "_hpId", "_data"];
// setAccTime 0; private ["_round", "_multiplier", "_foundObjects", "_foundObjectHPIds", "_delta", "_curPos", "_velocity", "_velocityStep", "_forwardPos", "_intersectsWith", "_index", "_hpId", "_data"];
_round = _this select 0; _round = _this select 0;
_multiplier = _this select 1; _multiplier = _this select 1;
_foundObjects = _this select 2; _foundObjects = _this select 2;
_foundObjectHPIds = _this select 3; _foundObjectHPIds = _this select 3;
_delta = (1/diag_fps)*_multiplier; _delta = (1/diag_fps) * _multiplier;
_curPos = getPosASL _round; _curPos = getPosASL _round;
_velocity = velocity _round; _velocity = velocity _round;
_velocityStep = [ _velocityStep = _velocity vectorMultiply _delta;
(_velocity select 0)*_delta, _forwardPos = _curPos vectorAdd _velocityStep;
(_velocity select 1)*_delta,
(_velocity select 2)*_delta
];
_forwardPos = [
(_curPos select 0) + (_velocityStep select 0),
(_curPos select 1) + (_velocityStep select 1),
(_curPos select 2) + (_velocityStep select 2)
];
_intersectsWith = lineIntersectsWith [_curPos, _forwardPos]; _intersectsWith = lineIntersectsWith [_curPos, _forwardPos];
if(count _intersectsWith > 0) then { if (count _intersectsWith > 0) then {
// player sideChat format["inter: %1", _intersectsWith]; // player sideChat format["inter: %1", _intersectsWith];
{ {
if(!(_x in _foundObjects)) then { if(!(_x in _foundObjects)) then {

View File

@ -1,6 +1,6 @@
//fnc_trackFragRound.sqf //fnc_trackFragRound.sqf
#include "script_component.hpp" #include "script_component.hpp"
private ["_params", "_round", "_lastPos", "_lastVel", "_type", "_time", "_doSpall", "_skip", "_explosive", "_indirectRange", "_force", "_fragPower"]; private ["_params", "_round", "_lastPos", "_lastVel", "_type", "_time", "_doSpall", "_spallTrack", "_foundObjectHPIds", "_skip", "_explosive", "_indirectRange", "_force", "_fragPower"];
_params = _this select 0; _params = _this select 0;
_round = _params select 0; _round = _params select 0;
_lastPos = _params select 1; _lastPos = _params select 1;

View File

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