Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common - Add CBA_fnc_execAfterNFrames from ZEN #1584

Merged
merged 5 commits into from
Jul 13, 2023

Conversation

johnb432
Copy link
Contributor

@johnb432 johnb432 commented Jul 10, 2023

When merged this pull request will:

For robustness' sake I left the existing code of CBA_fnc_execNextFrame alone, which means if the delay is 1 frame, then it uses the old code.

During testing I noticed there is a bug, where if you call the function in a certain manner, it (EDIT: it = CBA_fnc_execNextFrame) will add an extra frame of waiting. This also happens in the current steam release however, so I'm not sure if it's worth trying to fix.
Here's the code I used to test this part specifically:

private _delay = 1;

for "_index" from 1 to 10000 do {
    [{
        // If expected result, don't print result
        if (diag_frameno == ((_this select 0) + (_this select 1))) exitWith {};

        systemChat format ["%1, %2", diag_frameno, _this select 0];
    }, [diag_frameno, _delay], _delay] call CBA_fnc_execNextFrame;
	
    uiSleep 0.00005;
};

@PabstMirror
Copy link
Contributor

imho this func has fairly rare use and I'd prefer not adding any additional overhead to the eachFrame block
maybe we could just borrow
https://github.com/zen-mod/ZEN/blob/master/addons/common/functions/fnc_execAfterNFrames.sqf

@johnb432
Copy link
Contributor Author

imho this func has fairly rare use and I'd prefer not adding any additional overhead to the eachFrame block maybe we could just borrow https://github.com/zen-mod/ZEN/blob/master/addons/common/functions/fnc_execAfterNFrames.sqf

I could rewrite it in that format, however how would it work with the licensing/crediting?

@mharis001
Copy link
Contributor

I could rewrite it in that format, however how would it work with the licensing/crediting?

ZEN license (GPLv3) is compatible with CBA (GPLv2). In either case, feel free to borrow and adapt as needed.

@johnb432
Copy link
Contributor Author

I could rewrite it in that format, however how would it work with the licensing/crediting?

ZEN license (GPLv3) is compatible with CBA (GPLv2). In either case, feel free to borrow and adapt as needed.

Thank you very much.

@johnb432
Copy link
Contributor Author

Ported the code from ZEN directly over.

Copy link
Member

@veteran29 veteran29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PabstMirror PabstMirror added this to the 3.15.9 milestone Jul 11, 2023
@johnb432 johnb432 changed the title Common - Added n frame delay to CBA_fnc_execNextFrame Common - Added CBA_fnc_execAfterNFrames from ZEN Jul 12, 2023
johnb432 and others added 2 commits July 12, 2023 08:18
@veteran29 veteran29 merged commit 263286f into CBATeam:master Jul 13, 2023
@jonpas jonpas changed the title Common - Added CBA_fnc_execAfterNFrames from ZEN Common - Add CBA_fnc_execAfterNFrames from ZEN Jul 13, 2023
@johnb432 johnb432 deleted the n-frame-delay branch August 14, 2024 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Add an extra parameter to CBA_fnc_execNextFrame for settable frame delay
5 participants