Skip to content

Commit

Permalink
compileFinal more functions
Browse files Browse the repository at this point in the history
  • Loading branch information
commy2 committed Aug 20, 2016
1 parent 1021d3b commit d4cab9a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 20 deletions.
4 changes: 2 additions & 2 deletions addons/common/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ ADDON = false;

CBA_logic = objNull;

FUNC(log) = {
[QFUNC(log), {
diag_log text _this;
_this spawn {
sleep 1;
systemChat _this;
hintC _this;
};
};
}] call CBA_fnc_compileFinal;

// FSM
GVAR(delayless) = QUOTE(PATHTOF(delayless.fsm));
Expand Down
5 changes: 2 additions & 3 deletions addons/common/init_delayLess.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Generic twice-a-second loop instantiator(?)
GVAR(d) = [];

FUNC(addTriggerHandler) = {
[QFUNC(addTriggerHandler), {
private ["_c"];
// #include "script_component.hpp"
// #define DEBUG_MODE_FULL
Expand All @@ -18,9 +18,8 @@ FUNC(addTriggerHandler) = {
GVAR(d_trigger) setTriggerStatements ["{ if (count _x == 2) then { (_x select 0) call (_x select 1) } } forEach cba_common_d", "", ""];
};
_c; // return index, so can either change array parameter count, or empty?
};
}] call CBA_fnc_compileFinal;
// TODO: Cleanup functions?

// Specific twice-a-second loop
// TODO: Should be a function that creates a trigger per loop, and uses onAct, onDeact, and removes the trigger on finish?

18 changes: 8 additions & 10 deletions addons/common/init_perFrameHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ GVAR(nextFrameBufferB) = [];
GVAR(waitUntilAndExecArray) = [];

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

Expand Down Expand Up @@ -80,9 +80,7 @@ FUNC(onFrame) = {
if (_delete) then {
GVAR(waitUntilAndExecArray) = GVAR(waitUntilAndExecArray) - [objNull];
};

};

}] call CBA_fnc_compileFinal;

// fix for save games. subtract last tickTime from ETA of all PFHs after mission was loaded
addMissionEventHandler ["Loaded", {
Expand All @@ -103,14 +101,14 @@ if (isMultiplayer) then {
// multiplayer - no accTime in MP
if (isServer) then {
// multiplayer server
FUNC(missionTimePFH) = {
[QFUNC(missionTimePFH), {
if (time != GVAR(lastTime)) then {
CBA_missionTime = CBA_missionTime + (_tickTime - GVAR(lastTickTime));
GVAR(lastTime) = time; // used to detect paused game
};

GVAR(lastTickTime) = _tickTime;
};
}] call CBA_fnc_compileFinal;

addMissionEventHandler ["PlayerConnected", {
(_this select 4) publicVariableClient "CBA_missionTime";
Expand All @@ -125,25 +123,25 @@ if (isMultiplayer) then {

GVAR(lastTickTime) = diag_tickTime; // prevent time skip on clients

FUNC(missionTimePFH) = {
[QFUNC(missionTimePFH), {
if (time != GVAR(lastTime)) then {
CBA_missionTime = CBA_missionTime + (_tickTime - GVAR(lastTickTime));
GVAR(lastTime) = time; // used to detect paused game
};

GVAR(lastTickTime) = _tickTime;
};
}] call CBA_fnc_compileFinal;
};
};
};
} else {
// single player
FUNC(missionTimePFH) = {
[QFUNC(missionTimePFH), {
if (time != GVAR(lastTime)) then {
CBA_missionTime = CBA_missionTime + (_tickTime - GVAR(lastTickTime)) * accTime;
GVAR(lastTime) = time; // used to detect paused game
};

GVAR(lastTickTime) = _tickTime;
};
}] call CBA_fnc_compileFinal;
};
4 changes: 2 additions & 2 deletions addons/events/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ GVAR(keyUpActiveList) = [];

GVAR(keyHoldTimers) = call CBA_fnc_createNamespace;

FUNC(handleKeyDownUp) = {
[QFUNC(handleKeyDownUp), {
private _xUp = _this select (count _this - 1);

GVAR(keyUpActiveList) deleteAt (GVAR(keyUpActiveList) find _xUp);
GVAR(keyHoldTimers) setVariable [_xUp, nil];

false
};
}] call CBA_fnc_compileFinal;
6 changes: 3 additions & 3 deletions addons/help/XEH_preClientInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ LOG(MSG_INIT);

ADDON = false;

FUNC(help) = {call BIS_fnc_help};
[QFUNC(help), {call BIS_fnc_help}] call CBA_fnc_compileFinal;

FUNC(process) = {
[QFUNC(process), {
params ["_hash1", "_hash2", "_hash3"];

private _result = [];
Expand All @@ -25,7 +25,7 @@ FUNC(process) = {
} forEach allVariables _hash1;

_result joinString "<br/><br/>";
};
}] call CBA_fnc_compileFinal;

// keys
private _fnc_getKeyName = {
Expand Down

0 comments on commit d4cab9a

Please sign in to comment.