From e90ccf8aea12589afbefcd5ec012fba85b1263cb Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 7 Mar 2019 13:40:41 -0600 Subject: [PATCH] add scriptNames to functions for debugging (#1079) --- addons/common/init_perFrameHandler.sqf | 4 ++++ addons/events/fnc_addPlayerEventHandler.sqf | 3 +++ addons/xeh/fnc_preInit.sqf | 10 +++++++--- addons/xeh/fnc_startFallbackLoop.sqf | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/addons/common/init_perFrameHandler.sqf b/addons/common/init_perFrameHandler.sqf index 320a64fdb..8ae7dcf43 100644 --- a/addons/common/init_perFrameHandler.sqf +++ b/addons/common/init_perFrameHandler.sqf @@ -19,6 +19,7 @@ GVAR(waitUntilAndExecArray) = []; // per frame handler system [QFUNC(onFrame), { + SCRIPT(onFrame); private _tickTime = diag_tickTime; call FUNC(missionTimePFH); @@ -103,6 +104,7 @@ if (isMultiplayer) then { if (isServer) then { // multiplayer server [QFUNC(missionTimePFH), { + SCRIPT(missionTimePFH_server); if (time != GVAR(lastTime)) then { CBA_missionTime = CBA_missionTime + (_tickTime - GVAR(lastTickTime)); GVAR(lastTime) = time; // used to detect paused game @@ -126,6 +128,7 @@ if (isMultiplayer) then { GVAR(lastTickTime) = diag_tickTime; // prevent time skip on clients [QFUNC(missionTimePFH), { + SCRIPT(missionTimePFH_client); if (time != GVAR(lastTime)) then { CBA_missionTime = CBA_missionTime + (_tickTime - GVAR(lastTickTime)); GVAR(lastTime) = time; // used to detect paused game @@ -148,6 +151,7 @@ if (isMultiplayer) then { } else { // single player [QFUNC(missionTimePFH), { + SCRIPT(missionTimePFH_sp); if (time != GVAR(lastTime)) then { CBA_missionTime = CBA_missionTime + (_tickTime - GVAR(lastTickTime)) * accTime; GVAR(lastTime) = time; // used to detect paused game diff --git a/addons/events/fnc_addPlayerEventHandler.sqf b/addons/events/fnc_addPlayerEventHandler.sqf index a0f5b5629..ef3d4e7b0 100644 --- a/addons/events/fnc_addPlayerEventHandler.sqf +++ b/addons/events/fnc_addPlayerEventHandler.sqf @@ -134,6 +134,7 @@ if (_id != -1) then { GVAR(playerEHInfo) pushBack addMissionEventHandler ["EachFrame", {call FUNC(playerEH_EachFrame)}]; [QFUNC(playerEH_EachFrame), { + SCRIPT(playerEH_EachFrame); private _player = missionNamespace getVariable ["bis_fnc_moduleRemoteControl_unit", player]; if !(_player isEqualTo GVAR(oldUnit)) then { [QGVAR(unitEvent), [_player, GVAR(oldUnit)]] call CBA_fnc_localEvent; @@ -224,6 +225,7 @@ if (_id != -1) then { GVAR(playerEHInfo) pushBack addMissionEventHandler ["Map", {call FUNC(playerEH_Map)}]; [QFUNC(playerEH_Map), { + SCRIPT(playerEH_Map); params ["_data"]; // visibleMap is updated one frame later if !(_data isEqualTo GVAR(oldVisibleMap)) then { GVAR(oldVisibleMap) = _data; @@ -244,6 +246,7 @@ if (_id != -1) then { }; GVAR(playerEHInfo) pushBack ([{ + SCRIPT(playerEH_featureCamera); private _data = call CBA_fnc_getActiveFeatureCamera; if !(_data isEqualTo GVAR(oldFeatureCamera)) then { GVAR(oldFeatureCamera) = _data; diff --git a/addons/xeh/fnc_preInit.sqf b/addons/xeh/fnc_preInit.sqf index e42b45c9b..f685f6d0c 100644 --- a/addons/xeh/fnc_preInit.sqf +++ b/addons/xeh/fnc_preInit.sqf @@ -54,16 +54,20 @@ CBA_isHeadlessClient = !hasInterface && !isDedicated; // make case insensitive list of all supported events GVAR(EventsLowercase) = []; { + private _header = ""; + #ifndef SKIP_SCRIPT_NAME + _header = format ["scriptName 'XEH:%1';", _x]; + #endif // generate event functions if (_x isEqualTo "Init") then { - FUNC(Init) = compileFinal "(_this select 0) call CBA_fnc_initEvents; (_this select 0) call CBA_fnc_init"; + FUNC(Init) = compileFinal (_header + "(_this select 0) call CBA_fnc_initEvents; (_this select 0) call CBA_fnc_init"); } else { if (_x isEqualTo "HitPart") then { - FUNC(HitPart) = compileFinal format ['{call _x; nil} count ((_this select 0 select 0) getVariable QGVAR(%1))', _x]; + FUNC(HitPart) = compileFinal (_header + format ['{call _x; nil} count ((_this select 0 select 0) getVariable QGVAR(%1))', _x]); } else { missionNamespace setVariable [ format [QFUNC(%1), _x], - compileFinal format ['{call _x; nil} count ((_this select 0) getVariable QGVAR(%1))', _x] + compileFinal (_header + format ['{call _x; nil} count ((_this select 0) getVariable QGVAR(%1))', _x]) ]; }; }; diff --git a/addons/xeh/fnc_startFallbackLoop.sqf b/addons/xeh/fnc_startFallbackLoop.sqf index 4fadee6d1..3f9520606 100644 --- a/addons/xeh/fnc_startFallbackLoop.sqf +++ b/addons/xeh/fnc_startFallbackLoop.sqf @@ -34,6 +34,7 @@ GVAR(fallbackRunning) = true; GVAR(entities) = []; [{ + SCRIPT(fallbackLoopPFEH); private _entities = entities [[], [], true, true]; if !(_entities isEqualTo GVAR(entities)) then {