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>
|
|
|
|
* 1: Controller Objects <ARRAY>
|
|
|
|
* 2: Image Paths <ARRAY>
|
|
|
|
* 3: Action Names <ARRAY>
|
|
|
|
* 4: Duration <NUMBER> (0 disables automatic transitions)
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Parsed List <ARRAY>
|
|
|
|
*
|
|
|
|
* Example:
|
2015-07-16 21:16:09 +00:00
|
|
|
* [objects, controllers, images, actionNames, duration] call ace_slideshow_fnc_autoTransition
|
2015-06-29 20:13:28 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-06-29 20:14:38 +00:00
|
|
|
//#define DEBUG_MODE_FULL
|
2015-06-29 20:13:28 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
PARAMS_4(_objects,_images,_varString,_duration);
|
|
|
|
|
|
|
|
private ["_currentSlide"];
|
|
|
|
|
|
|
|
// 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];
|
|
|
|
} forEach _objects;
|
|
|
|
|
|
|
|
TRACE_4("Auto-transition",_images select _currentSlide,_currentSlide,count _images,_duration);
|
|
|
|
|
|
|
|
|
|
|
|
// Next slide
|
|
|
|
[FUNC(autoTransition), [_objects, _images, _varString, _duration], _duration] call EFUNC(common,waitAndExecute);
|