Port ACE delayed execution functions to CBA #288
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR ports the following functions from ACE, with some optimizations. All of them run in non sched environment and are handled by the onFrame loop that handles PFH.
CBA_fnc_waitAndExecute
: Executes a code once in non sched environment with a given game time delay. It' based on a queue, so only the bare minimum of elements are evaluated each frame. This is a very efficient way of delaying execution, certainly much more than a PFH, specially for long delays. It's savegame compatible due to the use ofCBA_missionTime
.CBA_fnc_execNextFrame
: A specialized version ofCBA_fnc_waitAndExecute
that delays execution a single frame.CBA_fnc_waitUntilAndExecute
: Evaluates a condition code on each frame, and finally launches a sepparate statement code once when the condition returns true. This behaves like BISwaitUntil
, but in non sched environment. Due to all condition being evaluated each frame, this function should be used only when necessary.All of this are heavily used in ACE. We'll certainly switch to CBA's versions if this is merged.