diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index e57dab3521..9477dcf235 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -18,7 +18,12 @@ (_x select 0) call (_x select 1); } forEach GVAR(nextFrameBufferA); - + //Swap double-buffer for execNextFrame: + GVAR(nextFrameBufferA) = GVAR(nextFrameBufferB); + GVAR(nextFrameBufferB) = []; + GVAR(nextFrameNo) = diag_frameno + 1; + + //Handle the waitUntilAndExec array: _deleted = 0; { _x params ["_condition", "_code", "_args"]; @@ -28,11 +33,6 @@ _args call _code; }; } forEach GVAR(waitUntilAndExecArray); - - //Swap double-buffer: - GVAR(nextFrameBufferA) = GVAR(nextFrameBufferB); - GVAR(nextFrameBufferB) = []; - GVAR(nextFrameNo) = diag_frameno + 1; }, 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 6fdf99113c..306eec12da 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -194,6 +194,7 @@ PREP(unmuteUnit); PREP(useItem); PREP(useMagazine); PREP(waitAndExecute); +PREP(waitUntilAndExecute); PREP(waveHeightAt); PREP(translateToWeaponSpace); @@ -297,11 +298,12 @@ PREP(_handleRequestAllSyncedEvents); GVAR(syncedEvents) = HASH_CREATE; -//GVARS for execNextFrame and waitAndExec +//GVARS for execNextFrame and waitAndExec and waitUntilAndExecute GVAR(waitAndExecArray) = []; GVAR(nextFrameNo) = diag_frameno; GVAR(nextFrameBufferA) = []; GVAR(nextFrameBufferB) = []; +GVAR(waitUntilAndExecArray) = []; // @TODO: Generic local-managed global-synced objects (createVehicleLocal) diff --git a/addons/common/functions/fnc_waitUnilAndExecute.sqf b/addons/common/functions/fnc_waitUntilAndExecute.sqf similarity index 81% rename from addons/common/functions/fnc_waitUnilAndExecute.sqf rename to addons/common/functions/fnc_waitUntilAndExecute.sqf index de4623b4ae..630ec4e2ce 100644 --- a/addons/common/functions/fnc_waitUnilAndExecute.sqf +++ b/addons/common/functions/fnc_waitUntilAndExecute.sqf @@ -1,22 +1,22 @@ /* * Author: joko // Jonas - * * Executes a code once with after the Condition is True, using a PFH * * Argument: * 0: Condition * 1: Code to execute * 2: Parameters to run the code with - * * Return value: * None * * Example: - * [{(_this select 0) == vehicle (_this select 0)}, {(_this select 0) setDamage 1;}, [ACE_player], false] call ace_common_fnc_waitAndExecute + * [{(_this select 0) == vehicle (_this select 0)}, {(_this select 0) setDamage 1;}, [ACE_player]] call ace_common_fnc_waitAndExecute * * Public: No */ #include "script_component.hpp" +TRACE_1("Adding",_this); + GVAR(waitUntilAndExecArray) pushBack _this;