2015-06-29 20:13:28 +00:00
|
|
|
/*
|
|
|
|
* Author: Jonpas
|
2015-07-16 21:16:09 +00:00
|
|
|
* Handles automatic slide transitions using waitAndExecute in a PFH-like manner resulting in no performance loss.
|
2015-06-29 20:13:28 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Objects <ARRAY>
|
2015-08-07 13:19:59 +00:00
|
|
|
* 1: Image Paths <ARRAY>
|
|
|
|
* 2: State Variable Name <ARRAY>
|
|
|
|
* 3: Duration <NUMBER> (0 disables automatic transitions)
|
2015-06-29 20:13:28 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-07 10:11:34 +00:00
|
|
|
* None
|
2015-06-29 20:13:28 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2015-08-07 10:11:34 +00:00
|
|
|
* [objects, images, "ace_slideshow_slideshow1", duration] call ace_slideshow_fnc_autoTransition
|
2015-06-29 20:13:28 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-07 10:11:34 +00:00
|
|
|
private "_currentSlide";
|
|
|
|
params ["_objects", "_images", "_varString", "_duration"];
|
2015-06-29 20:13:28 +00:00
|
|
|
|
|
|
|
// Get current slide number of this slideshow
|
|
|
|
_currentSlide = missionNamespace getVariable [_varString, 0];
|
|
|
|
|
|
|
|
// Increment slide or return to first slide if reached end
|
|
|
|
_currentSlide = (_currentSlide + 1) mod (count _images);
|
|
|
|
|
|
|
|
// Save slide back into global variable (PFH's local variables do not persist through PFH run)
|
|
|
|
missionNamespace setVariable [_varString, _currentSlide];
|
|
|
|
|
|
|
|
// Set slide
|
|
|
|
{
|
|
|
|
_x setObjectTextureGlobal [0, _images select _currentSlide];
|
2015-08-07 13:44:41 +00:00
|
|
|
} count _objects;
|
2015-06-29 20:13:28 +00:00
|
|
|
|
2015-08-07 23:18:48 +00:00
|
|
|
// Log current slide and execute Next slide
|
2015-06-29 20:13:28 +00:00
|
|
|
TRACE_4("Auto-transition",_images select _currentSlide,_currentSlide,count _images,_duration);
|
2016-05-22 13:27:24 +00:00
|
|
|
[FUNC(autoTransition), [_objects, _images, _varString, _duration], _duration] call CBA_fnc_waitAndExecute;
|