Skip to content

Commit

Permalink
add scriptNames to functions for debugging (#1079)
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror authored and commy2 committed Mar 7, 2019
1 parent 0f14c49 commit e90ccf8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions addons/common/init_perFrameHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ GVAR(waitUntilAndExecArray) = [];

// per frame handler system
[QFUNC(onFrame), {
SCRIPT(onFrame);
private _tickTime = diag_tickTime;
call FUNC(missionTimePFH);

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions addons/events/fnc_addPlayerEventHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
10 changes: 7 additions & 3 deletions addons/xeh/fnc_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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])
];
};
};
Expand Down
1 change: 1 addition & 0 deletions addons/xeh/fnc_startFallbackLoop.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ GVAR(fallbackRunning) = true;
GVAR(entities) = [];

[{
SCRIPT(fallbackLoopPFEH);
private _entities = entities [[], [], true, true];

if !(_entities isEqualTo GVAR(entities)) then {
Expand Down

0 comments on commit e90ccf8

Please sign in to comment.