2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
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>
|
2020-10-25 17:14:57 +00:00
|
|
|
* 3: Current Slideshow <NUMBER>
|
|
|
|
* 4: Duration <NUMBER> (0 disables automatic transitions)
|
2021-11-28 01:11:46 +00:00
|
|
|
* 5: Texture Selection <NUMBER>
|
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:
|
2021-11-28 01:11:46 +00:00
|
|
|
* [objects, images, "ace_slideshow_slideshow1", duration, selection] call ace_slideshow_fnc_autoTransition
|
2015-06-29 20:13:28 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2021-11-28 01:11:46 +00:00
|
|
|
params ["_objects", "_images", "_varString", "_currentSlideshow", "_duration", "_selection"];
|
2015-06-29 20:13:28 +00:00
|
|
|
|
|
|
|
// Get current slide number of this slideshow
|
2016-09-04 14:44:22 +00:00
|
|
|
private _currentSlide = missionNamespace getVariable [_varString, 0];
|
2015-06-29 20:13:28 +00:00
|
|
|
|
|
|
|
// 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];
|
|
|
|
|
2020-10-25 17:14:57 +00:00
|
|
|
private _image = _images select _currentSlide;
|
|
|
|
|
2015-06-29 20:13:28 +00:00
|
|
|
// Set slide
|
|
|
|
{
|
2021-11-28 01:11:46 +00:00
|
|
|
_x setObjectTextureGlobal [_selection, _image];
|
2015-08-07 13:44:41 +00:00
|
|
|
} count _objects;
|
2015-06-29 20:13:28 +00:00
|
|
|
|
2020-10-25 17:14:57 +00:00
|
|
|
[QGVAR(slideChanged), [_image, _currentSlideshow]] call CBA_fnc_localEvent;
|
|
|
|
|
2015-08-07 23:18:48 +00:00
|
|
|
// Log current slide and execute Next slide
|
2020-10-25 17:14:57 +00:00
|
|
|
TRACE_4("Auto-transition",_image,_currentSlide,count _images,_duration);
|
2021-11-28 01:11:46 +00:00
|
|
|
[FUNC(autoTransition), [_objects, _images, _varString, _currentSlideshow, _duration, _selection], _duration] call CBA_fnc_waitAndExecute;
|