-
Notifications
You must be signed in to change notification settings - Fork 149
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
Add Feature Camera Player EH #982
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5ca1a28
Add Feature Camera Player EH
jonpas 99f32e7
Add argument verification to registerFeatureCamera
jonpas 9e07b1c
Optimize CBA_fnc_getActiveFeatureCamera
PabstMirror 2289585
fixes
PabstMirror 8696687
Run feature camera player EH only every 0.5s
jonpas 55f5e2e
Don't compile final a PFH function
jonpas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "script_component.hpp" | ||
/* ---------------------------------------------------------------------------- | ||
Function: CBA_fnc_getActiveFeatureCamera | ||
|
||
Description: | ||
Returns active feature camera. | ||
|
||
Checks for the following feature cameras: | ||
- Curator | ||
- Arsenal camera (BIS_fnc_arsenal) | ||
- Nexus Spectator (BIS_fnc_EGSpectator) | ||
- Establishing shot (BIS_fnc_establishingShot) | ||
- Splendid camera (BIS_fnc_camera) | ||
- Animation viewer (BIS_fnc_animViewer) | ||
- Classic camera (BIS_fnc_cameraOld) | ||
|
||
And cameras registered via CBA_fnc_registerFeatureCamera. | ||
|
||
Parameters: | ||
None | ||
|
||
Returns: | ||
Active feature camera ("" if none) <STRING> | ||
|
||
Examples: | ||
(begin example) | ||
_result = [] call CBA_fnc_getActiveFeatureCamera | ||
(end) | ||
|
||
Author: | ||
Sniperwolf572, Jonpas | ||
---------------------------------------------------------------------------- */ | ||
SCRIPT(getActiveFeatureCamera); | ||
|
||
{ | ||
_x params ["_name", "_callback"]; | ||
|
||
if (call _callback) exitWith {_name}; | ||
"" | ||
} forEach GVAR(featureCameras); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "script_component.hpp" | ||
/* ---------------------------------------------------------------------------- | ||
Function: CBA_fnc_registerFeatureCamera | ||
|
||
Description: | ||
Registers a feature camera for use with CBA_fnc_getActiveFeatureCamera. | ||
|
||
Parameters: | ||
_name - Name (unique/tagged) <STRING> | ||
_callback - Activity check (should return true if active, false otherwise) <CODE> | ||
|
||
Returns: | ||
Successfully registered <BOOL> | ||
|
||
Examples: | ||
(begin example) | ||
_result = [ | ||
"ace_spectator", | ||
{!isNull (missionNamespace getVariable ["ace_spectator_isSet", objNull])} | ||
] call CBA_fnc_registerFeatureCamera | ||
(end) | ||
|
||
Author: | ||
Sniperwolf572, Jonpas | ||
---------------------------------------------------------------------------- */ | ||
SCRIPT(registerFeatureCamera); | ||
|
||
params [["_name", "", [""]], ["_callback", false, [{}]]]; | ||
|
||
if (_name isEqualTo "") exitWith { | ||
TRACE_1("Name empty",_name); | ||
false | ||
}; | ||
|
||
if (_callback isEqualTo false) exitWith { | ||
TRACE_1("Callback not code",_name); | ||
false | ||
}; | ||
|
||
(GVAR(featureCameras) pushBackUnique _this) != -1 // return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
performance?
We might want to only add this when it's actually needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just a bunch of null checks (7 in vanilla). Aren't all Player EHs only added when they are needed already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.0301 - 0.031 ms on 10k/10k cycles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.03 ouhhhh.
How about a check whether either the array of eventhandlers is not empty (by using the CBA internal variable name of the array)
Or check that
GVAR(oldFeatureCamera
is not nil? and set it to non nil once a Eventhandler is added in line 92?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That wouldn't work for cases where we might want to use internal variable (ref ACE PR).