client/addons/briefing/functions/fnc_prevImage.sqf
Jacob Schmidt d474b3676a
All checks were successful
Build / Build (push) Successful in 28s
Refactor: Standardize function descriptions and variable handling
This commit refactors several client-side functions to improve code consistency and readability.

- Standardizes function descriptions by removing redundant "Function: forge_client..." prefixes and "[Description]" sections, focusing on concise descriptions of the function's purpose.
- Updates variable handling in arsenal functions to use GVAR and EGVARS for default values, improving consistency and reducing code duplication.
- Removes the bank init function as it is no longer needed.
- Adds a done variable to the preinit file.
2025-05-25 11:30:26 -05:00

65 lines
1.3 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Displays the previous image
*
* Arguments:
* 0: _controller <OBJECT> - object that controls the slide show
*
* Return Value:
* 0: _return <BOOL> - true if the previous image was displayed; false if not
*
* Example:
* [controller] call forge_briefing_fnc_prevImage
*
* Public: No
*/
params [["_controller", objNull]];
if (isNull _controller) exitWith {
_return = false;
_return
};
private _controllers = _controller getVariable ["FORGE_SlideShow_Controllers", []];
private _currentIndex = _controller getVariable ["FORGE_SlideShow_CurrentIndex", 0];
private _images = _controller getVariable ["FORGE_SlideShow_Images", []];
private _screens = _controller getVariable ["FORGE_SlideShow_Screens", []];
if (_images isEqualTo []) exitWith {
_return = false;
_return
};
if (_screens isEqualTo []) exitWith {
_return = false;
_return
};
if (_controllers isEqualTo []) exitWith {
_return = false;
_return
};
private _imageCount = (count _images) - 1;
if (_currentIndex isEqualTo 0) then {
_currentIndex = 0;
} else {
_currentIndex = _currentIndex - 1;
};
{
_x setObjectTextureGlobal [0, (_images select _currentIndex) select 0];
true
} count (_screens);
{
_x setVariable ["FORGE_SlideShow_CurrentIndex", _currentIndex, true];
true
} count (_controllers);
_return = true;
_return