diff --git a/addons/slideshow/functions/fnc_addSlideActions.sqf b/addons/slideshow/functions/fnc_addSlideActions.sqf index 80e9b387af..1ebba306b4 100644 --- a/addons/slideshow/functions/fnc_addSlideActions.sqf +++ b/addons/slideshow/functions/fnc_addSlideActions.sqf @@ -10,19 +10,19 @@ * 4: Current Slideshow * * Return Value: - * None + * List of actions * * Example: * [[object], ["image"], ["name"], controller, 1] call ace_slideshow_fnc_addSlideActions * * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_5(_objects,_images,_names,_controller,_currentSlideshow); +private "_actions"; + +params ["_objects", "_images", "_names", "_controller", "_currentSlideshow"]; -private ["_actions"]; _actions = []; { _actions pushBack @@ -32,10 +32,10 @@ _actions = []; _names select _forEachIndex, "", { - EXPLODE_2_PVT(_this select 2,_objects,_image); + (_this select 2) params ["_objects", "_image"]; { _x setObjectTextureGlobal [0, _image] - } forEach _objects; + } count _objects; }, {true}, {}, diff --git a/addons/slideshow/functions/fnc_autoTransition.sqf b/addons/slideshow/functions/fnc_autoTransition.sqf index 639a0fb70b..c8b03a707a 100644 --- a/addons/slideshow/functions/fnc_autoTransition.sqf +++ b/addons/slideshow/functions/fnc_autoTransition.sqf @@ -4,25 +4,23 @@ * * Arguments: * 0: Objects - * 1: Controller Objects - * 2: Image Paths - * 3: Action Names - * 4: Duration (0 disables automatic transitions) + * 1: Image Paths + * 2: State Variable Name + * 3: Duration (0 disables automatic transitions) * * Return Value: - * Parsed List + * None * * Example: - * [objects, controllers, images, actionNames, duration] call ace_slideshow_fnc_autoTransition + * [objects, images, "ace_slideshow_slideshow1", duration] call ace_slideshow_fnc_autoTransition * * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_4(_objects,_images,_varString,_duration); +private "_currentSlide"; -private ["_currentSlide"]; +params ["_objects", "_images", "_varString", "_duration"]; // Get current slide number of this slideshow _currentSlide = missionNamespace getVariable [_varString, 0]; @@ -36,10 +34,8 @@ missionNamespace setVariable [_varString, _currentSlide]; // Set slide { _x setObjectTextureGlobal [0, _images select _currentSlide]; -} forEach _objects; +} count _objects; +// Log current slide and execute Next slide TRACE_4("Auto-transition",_images select _currentSlide,_currentSlide,count _images,_duration); - - -// Next slide [FUNC(autoTransition), [_objects, _images, _varString, _duration], _duration] call EFUNC(common,waitAndExecute); diff --git a/addons/slideshow/functions/fnc_createSlideshow.sqf b/addons/slideshow/functions/fnc_createSlideshow.sqf index debeac3340..6781716adb 100644 --- a/addons/slideshow/functions/fnc_createSlideshow.sqf +++ b/addons/slideshow/functions/fnc_createSlideshow.sqf @@ -17,10 +17,11 @@ * * Public: Yes */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_5(_objects,_controllers,_images,_names,_duration); +private ["_currentSlideshow", "_actionsObject", "_actionsClass", "_mainAction", "_slidesAction", "_varString"]; + +params ["_objects", "_controllers", "_images", "_names", "_duration"]; // Verify data if (count _images != count _names || {count _images == 0} || {count _names == 0}) exitWith { @@ -30,7 +31,8 @@ if (count _images != count _names || {count _images == 0} || {count _names == 0} // Objects synced to the module { _objects pushBack _x; -} forEach (synchronizedObjects _logic); + nil +} count (synchronizedObjects _logic); // If no controllers use objects as controllers if (count _controllers == 0) then { @@ -42,16 +44,14 @@ TRACE_4("Information",_objects,_controllers,_images,_names); // Default images on whiteboards (first image) { _x setObjectTextureGlobal [0, _images select 0]; -} forEach _objects; +} count _objects; // Number of slideshows (multiple modules support) GVAR(slideshows) = GVAR(slideshows) + 1; -private ["_currentSlideshow"]; _currentSlideshow = GVAR(slideshows); // Local variable in case GVAR gets changed during execution of below code // Add interactions if automatic transitions are disabled, else setup automatic transitions if (_duration == 0) then { - private ["_actionsObject", "_actionsClass", "_mainAction", "_slidesAction"]; { // Add MainAction if one does not already exist _actionsObject = _x getVariable [QEGVAR(interact_menu,actions), []]; @@ -65,10 +65,10 @@ if (_duration == 0) then { // Add Slides sub-action and populate with images _slidesAction = [QGVAR(Slides), localize LSTRING(Interaction), "", {}, {true}, {(_this select 2) call FUNC(addSlideActions)}, [_objects,_images,_names,_x,_currentSlideshow], [0,0,0], 2] call EFUNC(interact_menu,createAction); [_x, 0, ["ACE_MainActions"], _slidesAction] call EFUNC(interact_menu,addActionToObject); - } forEach _controllers; + nil + } count _controllers; } else { // Formatted GVAR string (multiple modules support) - private ["_varString"]; _varString = format [QGVAR(slideshow%1), _currentSlideshow]; TRACE_1("Current Slide",_varString); diff --git a/addons/slideshow/functions/fnc_makeList.sqf b/addons/slideshow/functions/fnc_makeList.sqf index 9ce4a723cc..8de87a2d96 100644 --- a/addons/slideshow/functions/fnc_makeList.sqf +++ b/addons/slideshow/functions/fnc_makeList.sqf @@ -18,7 +18,7 @@ //#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_3(_list,_removeWhitespace,_checkNil); +params ["_list", "_removeWhitespace", "_checkNil"]; private ["_splittedList", "_listNoWhitespace", "_nilCheckPassedList"]; @@ -30,7 +30,8 @@ _listNoWhitespace = []; if (_removeWhitespace) then { { _listNoWhitespace pushBack ([_x] call EFUNC(common,stringRemoveWhiteSpace)); - } forEach _splittedList; + nil + } count _splittedList; _list = _listNoWhitespace; }; @@ -45,7 +46,7 @@ if (_checkNil) then { _nilCheckPassedList = _nilCheckPassedList + "," + _x; }; }; - } forEach _list; + } count _list; // Add Array characters and parse into array _list = "[" + _nilCheckPassedList + "]"; @@ -54,4 +55,4 @@ if (_checkNil) then { TRACE_4("Lists",_splittedList,_listNoWhitespace,_nilCheckPassedList,_list); -_list +_list // return diff --git a/addons/slideshow/functions/fnc_moduleInit.sqf b/addons/slideshow/functions/fnc_moduleInit.sqf index 50de48693e..419cb415e3 100644 --- a/addons/slideshow/functions/fnc_moduleInit.sqf +++ b/addons/slideshow/functions/fnc_moduleInit.sqf @@ -12,18 +12,15 @@ * * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" if !(isServer) exitWith {}; -PARAMS_3(_logic,_units,_activated); - -if !(_activated) exitWith {}; - private ["_objects", "_controllers", "_images", "_names", "_duration"]; -_logic = [_this, 0, objNull, [objNull]] call BIS_fnc_param; +params [["_logic", objNull, [objNull]], "_units", "_activated"]; + +if !(_activated) exitWith {}; if (isNull _logic) exitWith {}; // Extract variables from logic