Merge branch 'master' of https://github.com/KoffeinFlummi/ACE3 into repair

This commit is contained in:
commy2 2015-03-11 15:21:59 +01:00
commit 3cae6a4c7a
38 changed files with 532 additions and 109 deletions

View File

@ -15,7 +15,7 @@
</p>
<p align="center"><sup><strong>Requires the latest version of <a href="http://www.armaholic.com/page.php?id=18767">CBA A3</a> | <a href="#">BIF thread</a></strong></sup></p>
**ACE 3** is a join effort by the teams behind **ACE 2**, **AGM** and **CSE** to improve the realism and authenticity of Arma 3.
**ACE 3** is a joint effort by the teams behind **ACE 2**, **AGM** and **CSE** to improve the realism and authenticity of Arma 3.
This mod is entirely **open-source**, and everyone is free to propose changes or maintain their own, customized version as long as they make their changes open to the public in accordance with the GNU General Public License (for more information check the license file attached to this project).

View File

@ -19,6 +19,7 @@ PREP(ASLToPosition);
PREP(beingCarried);
PREP(binarizeNumber);
PREP(blurScreen);
PREP(cachedCall);
PREP(callCustomEventHandlers);
PREP(callCustomEventHandlersGlobal);
PREP(canGetInPosition);
@ -47,6 +48,7 @@ PREP(displayTextPicture);
PREP(displayTextStructured);
PREP(doAnimation);
PREP(endRadioTransmission);
PREP(eraseCache);
PREP(execNextFrame);
PREP(execPersistentFnc);
PREP(execRemoteFnc);
@ -109,6 +111,7 @@ PREP(insertionSort);
PREP(interpolateFromArray);
PREP(inTransitionAnim);
PREP(inWater);
PREP(isAlive);
PREP(isArrested);
PREP(isAutoWind);
PREP(isAwake);
@ -200,6 +203,9 @@ PREP(logDisplays);
PREP(monitor);
PREP(showUser);
PREP(dumpPerformanceCounters);
PREP(dumpArray);
// ACE_CuratorFix
PREP(addCuratorUnloadEventhandler);
PREP(fixCrateContent);
@ -228,6 +234,9 @@ PREP(hashListSelect);
PREP(hashListSet);
PREP(hashListPush);
//Debug
ACE_COUNTERS = [];
// Load settings
if (isServer) then {
call FUNC(loadSettingsOnServer);

View File

@ -0,0 +1,30 @@
/*
* Author: CAA-Picard and Jaynus
* Returns the result of the function and caches it up to a given time
*
* Arguments:
* 0: Parameters <ARRAY>
* 1: Function <CODE>
* 2: Namespace to store the cache on <NAMESPACE>
* 3: Cache uid <STRING>
* 4: Max duration of the cache <NUMBER>
*
* Return Value:
* Result of the function <ANY>
*
* Public: No
*/
#include "script_component.hpp"
EXPLODE_5_PVT(_this,_params,_function,_namespace,_uid,_duration);
if (((_namespace getVariable [_uid, [-99999]]) select 0) < diag_tickTime) then {
_namespace setVariable [_uid, [diag_tickTime + _duration, _params call _function]];
#ifdef DEBUG_MODE_FULL
diag_log format ["Calculated result: %1 %2", _namespace, _uid];
} else {
diag_log format ["Cached result : %1 %2", _namespace, _uid];
#endif
};
(_namespace getVariable _uid) select 1

View File

@ -0,0 +1,25 @@
//fnc_dumpArray.sqf
#include "script_component.hpp"
private ["_var", "_depth", "_pad", "_i", "_x"];
_var = _this select 0;
_depth = _this select 1;
_pad = "";
for "_i" from 0 to _depth do {
_pad = _pad + toString [9];
};
_depth = _depth + 1;
if(IS_ARRAY(_var)) then {
if((count _var) > 0) then {
diag_log text format["%1[", _pad];
{
[_x, _depth] call FUNC(dumpArray);
} forEach _var;
diag_log text format["%1],", _pad];
} else {
diag_log text format["%1[],", _pad];
};
} else {
diag_log text format["%1%2", _pad, [_var] call FUNC(formatVar)];
};

View File

@ -0,0 +1,73 @@
//fnc_dumpPerformanceCounters.sqf
#define DEBUG_MODE_FULL
#include "script_component.hpp"
/*
diag_log text format["REGISTERED ACE PFH HANDLERS"];
diag_log text format["-------------------------------------------"];
if(!isNil "ACE_PFH") then {
{
private["_pfh"];
_pfh = _x select 0;
diag_log text format["Registered PFH: id=%1, %1:%2", (_pfh select 0), (_pfh select 1), (_pfh select 2) ];
} forEach ACE_PFH;
};*/
diag_log text format["ACE COUNTER RESULTS"];
diag_log text format["-------------------------------------------"];
{
private["_counterEntry", "_iter", "_total", "_count", "_delta", "_averageResult"];
_counterEntry = _x;
_iter = 0;
_total = 0;
_count = 0;
_averageResult = 0;
if( (count _counterEntry) > 3) then {
// calc
{
if(_iter > 2) then {
_count = _count + 1;
_delta = (_x select 1) - (_x select 0);
_total = _total + _delta;
};
_iter = _iter + 1;
} forEach _counterEntry;
// results
_averageResult = (_total / _count) * 1000;
// dump results
diag_log text format["%1: Average: %2s / %3 = %4ms", (_counterEntry select 0), _total, _count, _averageResult];
} else {
diag_log text format["%1: No results", (_counterEntry select 0) ];
};
} forEach ACE_COUNTERS;
/*
// Dump PFH Trackers
diag_log text format["ACE_PERFORMANCE_EXCESSIVE_STEP_TRACKER"];
diag_log text format["-------------------------------------------"];
{
private["_delay"];
_delay = _x select 2;
//if(_delay > 0) then { _delay = _delay / 1000; };
diag_log text format["%1: %2s, delay=%3, handle=%4",(_x select 0), _delay, (_x select 3), (_x select 4)];
} forEach ACE_PERFORMANCE_EXCESSIVE_STEP_TRACKER;
// Dump PFH Trackers
diag_log text format["ACE_PERFORMANCE_EXCESSIVE_FRAME_TRACKER"];
diag_log text format["-------------------------------------------"];
{
private["_delta"];
_delta = _x select 1;
//if(_delta > 0) then { _delta = _delta / 1000; };
diag_log text format[" DELTA: %1s", _delta];
} forEach ACE_PERFORMANCE_EXCESSIVE_FRAME_TRACKER;
//{
//
//} forEach ACRE_EXCESSIVE_FRAME_TRACKER;
*/

View File

@ -0,0 +1,18 @@
/*
* Author: CAA-Picard
* Deletes a cached result
*
* Arguments:
* 0: Namespace to store the cache on <NAMESPACE>
* 1: Cache uid <STRING>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_namespace,_uid);
_namespace setVariable [_uid, nil];

View File

@ -0,0 +1,14 @@
/*
* Author: commy2
*
* Check if the object still exists and is alive. This function exists because 'alive objNull' actually returns true.
*
* Argument:
* 0: Any object (Object)
*
* Return value:
* The object exists and is alive (Bool).
*/
#include "script_component.hpp"
!isNull (_this select 0) && {alive (_this select 0)}

View File

@ -26,7 +26,7 @@ if (!hasInterface) exitWith {};
false
},
{false},
[20, true, true, false], false] call CALLSTACK(cba_fnc_addKeybind);
[20, [true, true, false]], false] call cba_fnc_addKeybind;
if isNil(QGVAR(UsePP)) then {
GVAR(UsePP) = true;

View File

@ -3,6 +3,7 @@
ADDON = false;
PREP(addAction);
PREP(addClassAction);
PREP(compileMenu);
PREP(compileMenuSelfAction);
PREP(collectActiveActionTree);
@ -11,6 +12,7 @@ PREP(keyDownSelfAction);
PREP(keyUp);
PREP(keyUpSelfAction);
PREP(removeAction);
PREP(removeClassAction);
PREP(render);
PREP(renderIcon);
PREP(renderBaseMenu);
@ -23,7 +25,8 @@ GVAR(keyDownTime) = 0;
GVAR(lastTime) = diag_tickTime;
GVAR(rotationAngle) = 0;
GVAR(selectedAction) = {};
GVAR(selectedAction) = [[],[]];
GVAR(selectedStatement) = {};
GVAR(actionSelected) = false;
GVAR(selectedTarget) = objNull;

View File

@ -13,6 +13,7 @@
* 6: Statement <CODE>
* 7: Condition <CODE>
* 8: Distance <NUMBER>
* 9: Other parameters <ARRAY> (Optional)
*
* Return value:
* The entry full path, which can be used to remove the entry, or add children entries <ARRAY>.
@ -26,7 +27,7 @@
EXPLODE_9_PVT(_this,_object,_typeNum,_fullPath,_displayName,_icon,_position,_statement,_condition,_distance);
private ["_varName","_actions"];
private ["_varName","_actions","_params","_entry"];
_varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum;
_actions = _object getVariable [_varName, []];
@ -34,7 +35,11 @@ if((count _actions) == 0) then {
_object setVariable [_varName, _actions];
};
private "_entry";
_params = [false,false,false,false];
if (count _this > 9) then {
_params = _this select 9;
};
_entry = [
[
_displayName,
@ -43,7 +48,7 @@ _entry = [
_statement,
_condition,
_distance,
[false,false,false],
_params,
+ _fullPath
],
[]

View File

@ -0,0 +1,87 @@
/*
* Author: CAA-Picard
* Add an ACE action to a class, under a certain path
* Note: This function is NOT global.
*
* Argument:
* 0: TypeOf of the class <STRING>
* 1: Type of action, 0 for actions, 1 for self-actions <NUMBER>
* 2: Full path of the new action <ARRAY>
* 3: Name of the action shown in the menu <STRING>
* 4: Icon <STRING>
* 5: Position (Position or Selection Name) <POSITION> or <STRING>
* 6: Statement <CODE>
* 7: Condition <CODE>
* 8: Distance <NUMBER>
* 9: Other parameters <ARRAY> (Optional)
*
* Return value:
* The entry full path, which can be used to remove the entry, or add children entries <ARRAY>.
*
* Example:
* [typeOf cursorTarget, 0,["ACE_TapShoulderRight","VulcanPinch"],"Vulcan Pinch","",[0,0,0],{_target setDamage 1;},{true},100] call ace_interact_menu_fnc_addClassAction;
*
* Public: No
*/
#include "script_component.hpp"
EXPLODE_9_PVT(_this,_objectType,_typeNum,_fullPath,_displayName,_icon,_position,_statement,_condition,_distance);
private ["_varName","_actions","_params","_entry", "_parentLevel", "_foundParentLevel", "_fnc_findFolder"];
_varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType];
_actions = missionNamespace getVariable [_varName, []];
if((count _actions) == 0) then {
missionNamespace setVariable [_varName, _actions];
};
_params = [false,false,false,false];
if (count _this > 9) then {
_params = _this select 9;
};
// Search the class action trees and find where to insert the entry
_parentLevel = _actions;
_foundParentLevel = false;
_fnc_findFolder = {
EXPLODE_3_PVT(_this,_fullPath,_level,_classActions);
if (count _fullPath == _level + 1) then {
_parentLevel = _classActions;
_foundParentLevel = true;
};
if (_foundParentLevel) exitWith {};
{
EXPLODE_2_PVT(_x,_actionData,_actionChildren);
if (((_actionData select 7) select _level) isEqualTo (_fullPath select _level)) exitWith {
// The action should go somewhere in here
[_fullPath, _level + 1, _actionChildren] call _fnc_findFolder;
};
} forEach _classActions;
};
[_fullPath, 0, _actions] call _fnc_findFolder;
// Exit if there's no entry point to insert this action
if (!_foundParentLevel) exitWith {};
_entry = [
[
_displayName,
_icon,
_position,
_statement,
_condition,
_distance,
_params,
+ _fullPath
],
[]
];
_parentLevel pushBack _entry;
_fullPath

View File

@ -24,7 +24,7 @@ if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {};
private "_recurseFnc";
_recurseFnc = {
private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled",
"_enableInside", "_children", "_entry", "_entryCfg", "_fullPath"];
"_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_fullPath"];
EXPLODE_2_PVT(_this,_actionsCfg,_parentPath);
_actions = [];
@ -48,6 +48,7 @@ _recurseFnc = {
_showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0;
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;
_canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0;
_runOnHover = (getNumber (_entryCfg >> "runOnHover")) > 0;
_fullPath = (+ _parentPath);
_fullPath pushBack (configName _entryCfg);
@ -63,7 +64,7 @@ _recurseFnc = {
_statement,
_condition,
_distance,
[_showDisabled,_enableInside,_canCollapse],
[_showDisabled,_enableInside,_canCollapse,_runOnHover],
_fullPath
],
_children

View File

@ -24,7 +24,7 @@ if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {};
private "_recurseFnc";
_recurseFnc = {
private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled",
"_enableInside", "_children", "_entry", "_entryCfg", "_fullPath"];
"_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_fullPath"];
EXPLODE_2_PVT(_this,_actionsCfg,_parentPath);
_actions = [];
@ -45,6 +45,7 @@ _recurseFnc = {
_showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0;
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;
_canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0;
_runOnHover = (getNumber (_entryCfg >> "runOnHover")) > 0;
_fullPath = (+ _parentPath);
_fullPath pushBack (configName _entryCfg);
@ -60,7 +61,7 @@ _recurseFnc = {
_statement,
_condition,
10, //distace
[_showDisabled,_enableInside,_canCollapse],
[_showDisabled,_enableInside,_canCollapse,_runOnHover],
_fullPath
],
_children

View File

@ -12,13 +12,18 @@
*/
#include "script_component.hpp"
GVAR(keyDown) = false;
if(GVAR(actionSelected)) then {
this = GVAR(selectedTarget);
_player = ACE_Player;
_target = GVAR(selectedTarget);
[GVAR(selectedTarget), ACE_player] call GVAR(selectedAction);
[GVAR(selectedTarget), ACE_player] call GVAR(selectedStatement);
};
if (GVAR(keyDown)) then {
GVAR(keyDown) = false;
["interactMenuClosed", [0]] call FUNC(localEvent);
};
GVAR(expanded) = false;
GVAR(lastPath) = [];
GVAR(menuDepthPath) = [];

View File

@ -16,13 +16,18 @@ if (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]) then {
closeDialog 0;
};
GVAR(keyDownSelfAction) = false;
if(GVAR(actionSelected)) then {
this = GVAR(selectedTarget);
_player = ACE_Player;
_target = GVAR(selectedTarget);
[GVAR(selectedTarget), ACE_player] call GVAR(selectedAction);
[GVAR(selectedTarget), ACE_player] call GVAR(selectedStatement);
};
if (GVAR(keyDownSelfAction)) then {
GVAR(keyDownSelfAction) = false;
["interactMenuClosed", [1]] call FUNC(localEvent);
};
GVAR(expanded) = false;
GVAR(lastPath) = [];
GVAR(menuDepthPath) = [];

View File

@ -0,0 +1,72 @@
/*
* Author: CAA-Picard
* Removes a class action from a class
* Note: This function is NOT global.
*
* Argument:
* 0: TypeOf of the class <STRING>
* 1: Type of action, 0 for actions, 1 for self-actions <NUMBER>
* 2: Full path of the new action <ARRAY>
*
* Return value:
* None
*
* Example:
* [typeOf cursorTarget, 0,["ACE_TapShoulderRight","VulcanPinch"]] call ace_interact_menu_fnc_removeClassAction;
*
* Public: No
*/
#include "script_component.hpp"
EXPLODE_3_PVT(_this,_objectType,_typeNum,_fullPath);
private ["_varName","_actions","_parentLevel", "_actionIndex", "_foundAction", "_fnc_findFolder"];
_varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType];
_actions = missionNamespace getVariable [_varName, []];
// Search the class action trees and find where to insert the entry
_parentLevel = _actions;
_actionIndex = -1;
_foundAction = false;
_fnc_findFolder = {
EXPLODE_3_PVT(_this,_fullPath,_level,_classActions);
if (count _fullPath == _level + 1) then {
_parentLevel = _classActions;
};
{
EXPLODE_2_PVT(_x,_actionData,_actionChildren);
if (((_actionData select 7) select _level) isEqualTo (_fullPath select _level)) exitWith {
if (_level + 1 == count _fullPath) exitWith {
_actionIndex = _forEachIndex;
_foundAction = true;
};
[_fullPath, _level + 1, _actionChildren] call _fnc_findFolder;
};
if (_foundAction) exitWith {};
} forEach _classActions;
};
[_fullPath, 0, _actions] call _fnc_findFolder;
// Exit if the action was not found
if (!_foundAction) exitWith {};
_entry = [
[
_displayName,
_icon,
_position,
_statement,
_condition,
_distance,
_params,
+ _fullPath
],
[]
];
_parentLevel deleteAt _actionIndex;

View File

@ -143,7 +143,9 @@ if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then {
_foundTarget = true;
GVAR(actionSelected) = true;
GVAR(selectedTarget) = (_closest select 0) select 0;
GVAR(selectedAction) = (((_closest select 0) select 1) select 0) select 3;
GVAR(selectedAction) = (_closest select 0) select 1;
GVAR(selectedStatement) = ((GVAR(selectedAction)) select 0) select 3;
_misMatch = false;
_hoverPath = (_closest select 2);
@ -165,6 +167,16 @@ if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then {
if(!GVAR(expanded) && diag_tickTime-GVAR(startHoverTime) > 0.25) then {
GVAR(expanded) = true;
GVAR(menuDepthPath) = +GVAR(lastPath);
// Execute the current action if it's run on hover
private "_runOnHover";
_runOnHover = ((GVAR(selectedAction) select 0) select 6) select 3;
if (_runOnHover) then {
this = GVAR(selectedTarget);
_player = ACE_Player;
_target = GVAR(selectedTarget);
[GVAR(selectedTarget), ACE_player] call GVAR(selectedStatement);
};
};
};
};

View File

@ -58,8 +58,14 @@ if ((_sPos select 1) < safeZoneY || (_sPos select 1) > safeZoneY + safeZon
// Collect active tree
// @todo: cache activeActionTree?
_activeActionTree = ([_object, _baseAction] call FUNC(collectActiveActionTree));
private "_uid";
_uid = format [QGVAR(ATCache_%1), (_actionData select 7) select 0];
_activeActionTree = [
[_object, _baseAction],
DFUNC(collectActiveActionTree),
_object, _uid, 0.2
] call EFUNC(common,cachedCall);
// Check if there's something left for rendering
if (count _activeActionTree == 0) exitWith {false};

View File

@ -22,37 +22,22 @@ GVAR(isOpeningDoor) = false;
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !(!GVAR(isOpeningDoor) &&
{[2] call FUNC(getDoor) select 1 != ''}
) exitWith {false};
if (GVAR(isOpeningDoor) || {[2] call FUNC(getDoor) select 1 == ''}) exitWith {false};
// Statement
call EFUNC(interaction,openDoor);
true
},
{},
[57, [false, true, false]], false] call cba_fnc_addKeybind;
["ACE3",
localize "STR_ACE_Interaction_OpenDoor",
{
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !(GVAR(isOpeningDoor)) exitWith {false};
//Probably don't want any condidtions here, so variable never gets locked down
// Statement
GVAR(isOpeningDoor) = false;
true
},
[57, [false, true, false]],
false,
"keyup"
] call cba_fnc_registerKeybind;
[57, [false, true, false]], false] call cba_fnc_addKeybind; //Key CTRL+Space
["ACE3",
localize "STR_ACE_Interaction_TapShoulder",
["ACE3", QGVAR(tapShoulder), localize "STR_ACE_Interaction_TapShoulder",
{
// Conditions: canInteract
_exceptions = [];
@ -64,13 +49,10 @@ localize "STR_ACE_Interaction_TapShoulder",
[ACE_player, cursorTarget] call FUNC(tapShoulder);
true
},
[20, [true, false, false]],
false,
"keydown"
] call cba_fnc_registerKeybind;
{false},
[20, [true, false, false]], false] call cba_fnc_addKeybind;
["ACE3",
localize "STR_ACE_Interaction_ModifierKey",
["ACE3", QGVAR(modifierKey), localize "STR_ACE_Interaction_ModifierKey",
{
// Conditions: canInteract
_exceptions = ["ACE_Drag_isNotDragging"];
@ -81,24 +63,9 @@ localize "STR_ACE_Interaction_ModifierKey",
// Return false so it doesn't block other actions
false
},
[29, [false, false, false]],
false,
"keydown"
] call cba_fnc_registerKeybind;
["ACE3",
localize "STR_ACE_Interaction_ModifierKey",
{
// Conditions: canInteract
_exceptions = ["ACE_Drag_isNotDragging"];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Statement
//Probably don't want any condidtions here, so variable never gets locked down
ACE_Modifier = 0;
// Return false so it doesn't block other actions
false
false;
},
[29, [false, false, false]],
false,
"keyup"
] call cba_fnc_registerKeybind;
[29, [false, false, false]], false] call cba_fnc_addKeybind;

View File

@ -47,7 +47,7 @@ playSound "ACE_Sound_Click";
!GVAR(isOpeningDoor) || {getPosASL ACE_player distance _position > 1}
};
if (!_usedMouseWheel && {time < _time}) then {
if (!_usedMouseWheel && {time < _time} && {[] call EGVAR(common,canInteract)}) then {
_phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5);
{_house animate [_x, _phase]} forEach _animations;

View File

@ -0,0 +1,46 @@
/**
STACK TRACING
**/
//#define ENABLE_CALLSTACK
#ifdef ENABLE_CALLSTACK
#define CALLSTACK(function) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'ANON', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'ANON'; _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#define CALLSTACK_NAMED(function, functionName) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, functionName, _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = functionName; _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#define DUMPSTACK ([__FILE__, __LINE__] call ACE_DUMPSTACK_FNC)
#define FUNC(var1) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(ADDON,fnc,var1)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(ADDON,fnc,var1)'; _ret = _this call TRIPLES(ADDON,fnc,var1); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#define EFUNC(var1,var2) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)'; _ret = _this call TRIPLES(DOUBLES(PREFIX,var1),fnc,var2); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#else
#define CALLSTACK(function) function
#define CALLSTACK_NAMED(function, functionName) function
#define DUMPSTACK
#define FUNC(var1) TRIPLES(ADDON,fnc,var1)
#define EFUNC(var1,var2) TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)
#endif
/**
PERFORMANCE COUNTERS SECTION
**/
//#define ENABLE_PERFORMANCE_COUNTERS
#ifdef ENABLE_PERFORMANCE_COUNTERS
#define ADDPFH(function, timing, args) call { _ret = [function, timing, args, #function] call EFUNC(sys_sync,perFrame_add); if(isNil "ACE_PFH" ) then { ACE_PFH=[]; }; ACE_PFH pushBack [[_ret, __FILE__, __LINE__], [function, timing, args]]; _ret }
#define CREATE_COUNTER(x) if(isNil "ACE_COUNTERS" ) then { ACE_COUNTERS=[]; }; GVAR(DOUBLES(x,counter))=[]; GVAR(DOUBLES(x,counter)) set[0, QUOTE(GVAR(DOUBLES(x,counter)))]; GVAR(DOUBLES(x,counter)) set[1, diag_tickTime]; ACE_COUNTERS pushBack GVAR(DOUBLES(x,counter));
#define BEGIN_COUNTER(x) if(isNil QUOTE(GVAR(DOUBLES(x,counter)))) then { CREATE_COUNTER(x) }; GVAR(DOUBLES(x,counter)) set[2, diag_tickTime];
#define END_COUNTER(x) GVAR(DOUBLES(x,counter)) pushBack [(GVAR(DOUBLES(x,counter)) select 2), diag_tickTime];
#define DUMP_COUNTERS ([__FILE__, __LINE__] call ACE_DUMPCOUNTERS_FNC)
#else
#define ADDPFH(function, timing, args) [function, timing, args, #function] call EFUNC(sys_sync,perFrame_add)
#define CREATE_COUNTER(x) /* disabled */
#define BEGIN_COUNTER(x) /* disabled */
#define END_COUNTER(x) /* disabled */
#define DUMP_COUNTERS /* disabled */
#endif

View File

@ -223,26 +223,6 @@
#define PREP_MODULE(folder) [] call compile preprocessFileLineNumbers QUOTE(PATHTOF(folder\__PREP__.sqf))
#ifdef ENABLE_CALLSTACK
#define CALLSTACK(function) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'ANON', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'ANON'; _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#define CALLSTACK_NAMED(function, functionName) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, functionName, _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = functionName; _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#define DUMPSTACK ([__FILE__, __LINE__] call ACE_DUMPSTACK_FNC)
#define FUNC(var1) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(ADDON,fnc,var1)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(ADDON,fnc,var1)'; _ret = _this call TRIPLES(ADDON,fnc,var1); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#define EFUNC(var1,var2) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)'; _ret = _this call TRIPLES(DOUBLES(PREFIX,var1),fnc,var2); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#else
#define CALLSTACK(function) function
#define CALLSTACK_NAMED(function, functionName) function
#define DUMPSTACK
#define FUNC(var1) TRIPLES(ADDON,fnc,var1)
#define EFUNC(var1,var2) TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)
#endif
#define HASH_CREATE ([] call EFUNC(common,hashCreate))
#define HASH_SET(hash, key, val) ([hash, key, val, __FILE__, __LINE__] call EFUNC(common,hashSet))
#define HASH_GET(hash, key) ([hash, key, __FILE__, __LINE__] call EFUNC(common,hashGet))
@ -254,3 +234,5 @@
#define HASHLIST_SELECT(hashList, index) ([hashList, index, __FILE__, __LINE__] call EFUNC(common,hashListSelect))
#define HASHLIST_SET(hashList, index, value) ([hashList, index, value, __FILE__, __LINE__] call EFUNC(common,hashListSet))
#define HASHLIST_PUSH(hashList, value) ([hashList, value, __FILE__, __LINE__] call EFUNC(common,hashListPush))
#include "script_debug.hpp"

View File

@ -347,7 +347,8 @@ class CfgVehicles {
class ACE_Actions {
class ACE_Head {
statement = QUOTE([ARR_3(_target, true, 0)] call DEFUNC(displayPatientInformation));
runOnHover = 1;
statement = QUOTE([ARR_3(_target, true, 0)] call DFUNC(displayPatientInformation));
class Bandage_Head {
displayName = "Bandage Head";
@ -406,7 +407,8 @@ class CfgVehicles {
displayName = "Medical";
distance = 5.0;
condition = "true";
statement = QUOTE([ARR_3(_target, true, 1)] call DEFUNC(displayPatientInformation));
runOnHover = 1;
statement = QUOTE([ARR_3(_target, true, 1)] call DFUNC(displayPatientInformation));
showDisabled = 1;
priority = 2;
hotkey = "M";
@ -481,7 +483,8 @@ class CfgVehicles {
};
};
class ACE_ArmLeft {
statement = QUOTE([ARR_3(_target, true, 2)] call DEFUNC(displayPatientInformation));
runOnHover = 1;
statement = QUOTE([ARR_3(_target, true, 2)] call DFUNC(displayPatientInformation));
class Bandage_LeftArm {
displayName = "Bandage Left Arm";
@ -602,7 +605,8 @@ class CfgVehicles {
};
};
class ACE_ArmRight {
statement = QUOTE([ARR_3(_target, true, 3)] call DEFUNC(displayPatientInformation));
runOnHover = 1;
statement = QUOTE([ARR_3(_target, true, 3)] call DFUNC(displayPatientInformation));
class Bandage_RightArm {
displayName = "Bandage Right Arm";
distance = 2.0;
@ -723,7 +727,8 @@ class CfgVehicles {
};
class ACE_LegLeft {
statement = QUOTE([ARR_3(_target, true, 4)] call DEFUNC(displayPatientInformation));
runOnHover = 1;
statement = QUOTE([ARR_3(_target, true, 4)] call DFUNC(displayPatientInformation));
class Bandage_LeftLeg {
displayName = "Bandage Left Leg";
distance = 2.0;
@ -834,7 +839,8 @@ class CfgVehicles {
};
};
class ACE_LegRight {
statement = QUOTE([ARR_3(_target, true, 5)] call DEFUNC(displayPatientInformation));
runOnHover = 1;
statement = QUOTE([ARR_3(_target, true, 5)] call DFUNC(displayPatientInformation));
class Bandage_RightLeg {
displayName = "Bandage Right Leg";
distance = 2.0;

View File

@ -19,3 +19,14 @@ class CfgPatches {
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
class ACE_Settings {
class GVAR(DisplayTextOnJam) {
typeName = "BOOL";
isClientSetable = 1;
value = 1;
displayName = "$STR_ACE_overheating_SettingDisplayTextName";
description = "$STR_ACE_overheating_SettingDisplayTextDesc";
};
};

View File

@ -42,13 +42,16 @@ if (_weapon in _jammedWeapons) then {
};
_unit playActionNow _clearJamAction;
};
if (_weapon == primaryWeapon _unit) then {
playSound QGVAR(fixing_rifle);
} else {
if (_weapon == secondaryWeapon _unit) then {
playSound QGVAR(fixing_pistol);
if (_weapon == primaryWeapon _unit) then {
playSound QGVAR(fixing_rifle);
} else {
if (_weapon == secondaryWeapon _unit) then {
playSound QGVAR(fixing_pistol);
};
};
};
[localize "STR_ACE_Overheating_WeaponUnjammed"] call EFUNC(common,displayTextStructured);
if (GVAR(DisplayTextOnJam)) then {
[localize "STR_ACE_Overheating_WeaponUnjammed"] call EFUNC(common,displayTextStructured);
};
};

View File

@ -61,7 +61,7 @@ if (_unit getVariable [QGVAR(JammingActionID), -1] == -1) then {
_statement = {
playSound3D ["a3\sounds_f\weapons\Other\dry9.wss", _this select 0];
if (!(missionNamespace getVariable [QGVAR(knowAboutJam), false]) && {(_this select 1) ammo currentWeapon (_this select 1) > 0}) then {
if (!(missionNamespace getVariable [QGVAR(knowAboutJam), false]) && {(_this select 1) ammo currentWeapon (_this select 1) > 0} && {GVAR(DisplayTextOnJam)}) then {
[localize "STR_ACE_Overheating_WeaponJammed"] call EFUNC(common,displayTextStructured);
GVAR(knowAboutJam) = true;
};

View File

@ -2,6 +2,12 @@
<!-- Edited with tabler - 2014-12-17 -->
<Project name="ACE">
<Package name="Overheating">
<Key ID="STR_ACE_overheating_SettingDisplayTextName">
<English>Display text on jam</English>
</Key>
<Key ID="STR_ACE_overheating_SettingDisplayTextDesc">
<English>Display a notification whenever your weapon gets jammed</English>
</Key>
<Key ID="STR_ACE_Overheating_SpareBarrelName">
<English>Spare barrel</English>
<German>Ersatzlauf</German>

View File

@ -30,7 +30,7 @@ if (!hasInterface) exitWith {};
true
},
{false},
[24, false, false, false], false] call CALLSTACK(cba_fnc_addKeybind);
[24, [false, false, false]], false] call cba_fnc_addKeybind;
GVAR(PFH) = false;
["playerVehicleChanged",{

View File

@ -14,7 +14,7 @@ class Extended_PostInit_EventHandlers {
class Extended_Take_EventHandlers {
class CAManBase {
class ACE_AmmoIndicatorReload {
clientTake = QUOTE(if (_this select 0 == ACE_player && {(_this select 1) in [ARR_3(uniformContainer (_this select 0), vestContainer (_this select 0), backpackContainer (_this select 0))]} && {_this select 2 == currentMagazine (_this select 0)}) then {[ARR_2(_this select 0, vehicle (_this select 0))] call FUNC(displayAmmo)};);
clientTake = QUOTE(if (_this select 0 == ACE_player && {GVAR(DisplayText)} && {(_this select 1) in [ARR_3(uniformContainer (_this select 0), vestContainer (_this select 0), backpackContainer (_this select 0))]} && {_this select 2 == currentMagazine (_this select 0)}) then {[ARR_2(_this select 0, vehicle (_this select 0))] call FUNC(displayAmmo)};);
};
};
};

View File

@ -21,3 +21,14 @@ class CfgPatches {
#include "CfgActions.hpp"
#include "RscInGameUI.hpp"
class ACE_Settings {
class GVAR(DisplayText) {
typeName = "BOOL";
isClientSetable = 1;
value = 1;
displayName = "$STR_ACE_reload_SettingDisplayTextName";
description = "$STR_ACE_reload_SettingDisplayTextDesc";
};
};

View File

@ -2,6 +2,12 @@
<!-- Edited with tabler - 2014-09-09 -->
<Project name="ACE">
<Package name="Reload">
<Key ID="STR_ACE_reload_SettingDisplayTextName">
<English>Check ammo on weapon reload</English>
</Key>
<Key ID="STR_ACE_reload_SettingDisplayTextDesc">
<English>Check the ammo in your new magazine on magazine reload.</English>
</Key>
<Key ID="STR_ACE_Reload_checkAmmo">
<English>Check Ammo</English>
<German>Munition prüfen</German>

View File

@ -13,3 +13,13 @@ class CfgPatches {
};
#include "CfgEventHandlers.hpp"
class ACE_Settings {
class GVAR(DisplayText) {
typeName = "BOOL";
isClientSetable = 1;
value = 1;
displayName = "$STR_ACE_Weaponselect_SettingDisplayTextName";
description = "$STR_ACE_Weaponselect_SettingDisplayTextDesc";
};
};

View File

@ -14,6 +14,8 @@
private ["_magazine", "_numberofMagazines"];
if !(GVAR(DisplayText)) exitwith {};
_magazine = _this select 0;
_numberofMagazines = _this select 1;

View File

@ -36,9 +36,10 @@ if (_nextMuzzle != "") then {
// There is a no muzzle with magazines --> select nothing
GVAR(CurrentGrenadeMuzzleFrag) = ""; GVAR(CurrentGrenadeMuzzleOther) = "";
_text = [localize "STR_ACE_WeaponSelect_NoGrenadesLeft", [1,0,0]] call EFUNC(common,stringToColoredText);
[composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured);
if (GVAR(DisplayText)) then {
_text = [localize "STR_ACE_WeaponSelect_NoGrenadesLeft", [1,0,0]] call EFUNC(common,stringToColoredText);
[composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured);
};
};
if (_nextMuzzle in GVAR(FragMuzzles)) then {

View File

@ -35,10 +35,10 @@ if (_nextMuzzle != "") then {
} else {
// There is a no muzzle with magazines --> select nothing
GVAR(CurrentGrenadeMuzzleFrag) = "";
_text = [localize "STR_ACE_WeaponSelect_NoFragsLeft", [1,0,0]] call EFUNC(common,stringToColoredText);
[composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured);
if (GVAR(DisplayText)) then {
_text = [localize "STR_ACE_WeaponSelect_NoFragsLeft", [1,0,0]] call EFUNC(common,stringToColoredText);
[composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured);
};
};
GVAR(CurrentGrenadeMuzzleIsFrag) = true;

View File

@ -35,10 +35,10 @@ if (_nextMuzzle != "") then {
} else {
// There is a no muzzle with magazines --> select nothing
GVAR(CurrentGrenadeMuzzleOther) = "";
_text = [localize "STR_ACE_WeaponSelect_NoMiscGrenadeLeft", [1,0,0]] call EFUNC(common,stringToColoredText);
[composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured);
if (GVAR(DisplayText)) then {
_text = [localize "STR_ACE_WeaponSelect_NoMiscGrenadeLeft", [1,0,0]] call EFUNC(common,stringToColoredText);
[composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured);
};
};
GVAR(CurrentGrenadeMuzzleIsFrag) = false;

View File

@ -2,6 +2,12 @@
<!-- Edited with tabler - 2014-12-20 -->
<Project name="ACE">
<Package name="WeaponSelect">
<Key ID="STR_ACE_Weaponselect_SettingDisplayTextName">
<English>Display text on grenade throw</English>
</Key>
<Key ID="STR_ACE_Weaponselect_SettingDisplayTextDesc">
<English>Display a hint or text on grenade throw.</English>
</Key>
<Key ID="STR_ACE_WeaponSelect_SelectPistol">
<English>Select Pistol</English>
<German>Pistole auswählen</German>

Binary file not shown.