AB Performance Optimization (Part 5)

This commit is contained in:
jokoho48 2015-08-05 18:33:28 +02:00
parent 9eb560ff3d
commit c4e4f184ff
3 changed files with 13 additions and 15 deletions

View File

@ -8,7 +8,6 @@ GVAR(Protractor) = false;
GVAR(ProtractorStart) = ACE_time;
GVAR(currentGrid) = 0;
GVAR(initMessageEnabled) = false;
GVAR(extensionAvailable) = true;
/* @TODO: Remove this until versioning is in sync with cmake/build versioning

View File

@ -22,9 +22,9 @@ _initStartTime = ACE_time;
_mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize");
if (("ace_advanced_ballistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith {
if (GVAR(initMessageEnabled)) then {
#ifdef DEBUG_MODE_FULL
systemChat "AdvancedBallistics: Terrain already initialized";
};
#endIf
};
_mapGrids = ceil(_mapSize / 50) + 1;
@ -37,9 +37,9 @@ GVAR(currentGrid) = 0;
_args params ["_mapGrids", "_gridCells", "_initStartTime"];
if (GVAR(currentGrid) >= _gridCells) exitWith {
if (GVAR(initMessageEnabled)) then {
#ifdef DEBUG_MODE_FULL
systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(ACE_time - _initStartTime)];
};
#endif
[_idPFH] call cba_fnc_removePerFrameHandler;
};

View File

@ -4,7 +4,7 @@
* Reads the weapon class config and updates the config cache
*
* Arguments:
* 0: weapon - classname <STRING>
* weapon - classname <STRING>
*
* Return Value:
* 0: _barrelTwist
@ -15,18 +15,17 @@
*/
#include "script_component.hpp"
private ["_weapon", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"];
_weapon = _this;
private ["_weaponConfig", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"];
_weaponConfig = (configFile >> "CfgWeapons" >> _this);
_barrelTwist = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_barrelTwist");
_barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist");
_twistDirection = 1;
if (isNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_twistDirection")) then {
_twistDirection = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_twistDirection");
if (_twistDirection != -1 && _twistDirection != 0 && _twistDirection != 1) then {
_twistDirection = 1;
};
_twistDirection = getNumber(_weaponConfig >> "ACE_twistDirection");
if !(_twistDirection in [-1, 0, 1]) then {
_twistDirection = 1;
};
_barrelLength = getNumber(configFile >> "CfgWeapons" >> _weapon >> "ACE_barrelLength");
_barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength");
_result = [_barrelTwist, _twistDirection, _barrelLength];