Added Slideshow mission tool

This commit is contained in:
jonpas 2015-06-27 04:11:57 +02:00
parent 6bb235f38a
commit 77cb278f61
14 changed files with 437 additions and 0 deletions

View File

@ -0,0 +1 @@
z\ace\addons\slideshow

View File

@ -0,0 +1,5 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};

View File

@ -0,0 +1,119 @@
class CfgVehicles {
class ACE_Module;
class GVAR(module): ACE_Module {
author = ECSTRING(common,ACETeam);
category = "ACE_missionModules";
displayName = CSTRING(DisplayName);
function = QFUNC(moduleInit);
scope = 2;
isGlobal = 0; // Server only
isTriggerActivated = 0;
isDisposable = 0;
//icon = QUOTE(PATHTOF(UI\Icon_Module_Slideshow_ca.paa));
class Arguments {
class Objects {
displayName = CSTRING(Objects_DisplayName);
description = CSTRING(Objects_Description);
typeName = "STRING";
defaultValue = "";
};
class Controllers {
displayName = CSTRING(Controllers_DisplayName);
description = CSTRING(Controllers_Description);
typeName = "STRING";
defaultValue = "";
};
class Images {
displayName = CSTRING(Images_DisplayName);
description = CSTRING(Images_Description);
typeName = "STRING";
defaultValue = "";
};
class Names {
displayName = CSTRING(Names_DisplayName);
description = CSTRING(Names_Description);
typeName = "STRING";
defaultValue = "";
};
};
class ModuleDescription {
description = CSTRING(Description);
// Every object in this must be initialized with GVAR(Slides) Action applied, as well as 2 of below macros
sync[] = {CLASSNAMES_OBJECTS, CLASSNAMES_BOTH, CLASSNAMES_CONTROLLERS};
#define MACRO_SYNC \
optional = 1; \
duplicate = 1;
#define OBJECT description = "Object";
#define BOTH description = "Object AND Controller";
#define CONTROLLER description = "Controller";
class Land_MapBoard_F {MACRO_SYNC OBJECT};
class Land_Laptop_unfolded_F {MACRO_SYNC BOTH};
class Land_Laptop_device_F {MACRO_SYNC BOTH};
class Land_PCSet_01_screen_F {MACRO_SYNC BOTH};
class Land_HandyCam_F {MACRO_SYNC CONTROLLER};
class Land_MobilePhone_smart_F {MACRO_SYNC CONTROLLER};
class Land_Tablet_01_F {MACRO_SYNC CONTROLLER};
class Land_PCSet_01_keyboard_F {MACRO_SYNC CONTROLLER};
class Land_PCSet_01_mouse_F {MACRO_SYNC CONTROLLER};
class Land_GamingSet_01_controller_F {MACRO_SYNC CONTROLLER};
};
};
#define MACRO_SLIDES \
class GVAR(Slides) { \
displayName = CSTRING(Interaction); \
condition = QUOTE(_this call FUNC(hasSlides)); \
insertChildren = QUOTE(_this call DFUNC(addSlideActions)); \
};
#define MACRO_INTERACT_INIT \
XEH_ENABLED; \
class ACE_Actions { \
class ACE_MainActions { \
displayName = ECSTRING(interaction,MainAction); \
selection = ""; \
condition = "true"; \
distance = 2; \
MACRO_SLIDES \
}; \
};
class ThingX;
class Land_MapBoard_F: ThingX {
MACRO_INTERACT_INIT
};
class Land_Laptop_F;
class Land_Laptop_unfolded_F: Land_Laptop_F {
MACRO_INTERACT_INIT
};
//class Land_Laptop_device_F: Land_Laptop_unfolded_F;
class Items_base_F;
class Land_PCSet_01_screen_F: Items_base_F {
MACRO_INTERACT_INIT
};
class Land_HandyCam_F: Items_base_F {
MACRO_INTERACT_INIT
};
class Land_MobilePhone_smart_F: Items_base_F {
MACRO_INTERACT_INIT
};
class Land_Tablet_01_F: Items_base_F {
MACRO_INTERACT_INIT
};
class Land_PCSet_01_keyboard_F: Items_base_F {
MACRO_INTERACT_INIT
};
class Land_PCSet_01_mouse_F: Items_base_F {
MACRO_INTERACT_INIT
};
class Land_GamingSet_01_controller_F: Items_base_F {
MACRO_INTERACT_INIT
};
};

View File

@ -0,0 +1,10 @@
ace_slideshow
===============
Adds ability to have slide-shows on them and control them with a controller (another object).
## Maintainers
The people responsible for merging changes to this component or answering potential questions.
- [Jonpas] (https://github.com/jonpas)

View File

@ -0,0 +1,11 @@
#include "script_component.hpp"
ADDON = false;
PREP(addSlideActions);
PREP(createSlideshow);
PREP(hasSlides);
PREP(makeList);
PREP(moduleInit);
ADDON = true;

View File

@ -0,0 +1,16 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author[]= {"Jonpas", "DaC"};
authorUrl = "https://github.com/jonpas";
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"

View File

@ -0,0 +1,47 @@
/*
* Author: Jonpas
* Adds controller slide actions.
*
* Arguments:
* 0: Controller <OBJECT>
*
* Return Value:
* Children Actions <ARRAY>
*
* Example:
* [controller] call ace_slideshow_fnc_addSlideActions;
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_controller);
private ["_slides", "_actions"];
_slides = _controller getVariable QGVAR(Slides);
EXPLODE_3_PVT(_slides,_objects,_images,_names);
_actions = [];
{
_actions pushBack
[
[
format ["Slide_%1", _forEachIndex],
_names select _forEachIndex,
"",
{
{
_x setObjectTextureGlobal [0, (_this select 2) select 1]
} forEach ((_this select 2) select 0);
},
{true},
{},
[_objects,_x]
] call EFUNC(interact_menu,createAction),
[],
_controller
];
} forEach _images;
_actions

View File

@ -0,0 +1,57 @@
/*
* Author: Jonpas, DaC
* Prepares necessary variables and default image.
*
* Arguments:
* 0: Objects <ARRAY>
* 1: Controller Objects <ARRAY>
* 2: Image Paths <ARRAY>
* 3: Names <ARRAY>
*
* Return Value:
* Parsed List <ARRAY>
*
* Example:
* [[object1, object2, object3], [controller1], ["images\image1.paa", "images\image2.paa"], ["Action1", "Action2"]] call ace_slideshow_fnc_createSlideshow;
*
* Public: Yes
*/
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
PARAMS_4(_objects,_controllers,_images,_names);
// Add controllers to objects if they support it
{
if (typeOf _x in [CLASSNAMES_OBJECTS, CLASSNAMES_BOTH]) then {
_objects pushBack _x;
};
} forEach _controllers;
// Objects synced to the module
{
if (typeOf _x in [CLASSNAMES_OBJECTS, CLASSNAMES_BOTH]) then {
_objects pushBack _x;
};
if (typeOf _x in [CLASSNAMES_BOTH, CLASSNAMES_CONTROLLERS]) then {
_controllers pushBack _x;
};
} forEach (synchronizedObjects _logic);
// If no controllers use objects as controllers
if (count _controllers == 0) then {
_controllers = _objects;
};
TRACE_4("Information",_objects,_controllers,_images,_names);
// Default images on whiteboards (first image)
{
_x setObjectTextureGlobal [0, _images select 0];
} forEach _objects;
// Set first image as default and set variable on controllers with necessary information
{
_x setVariable [QGVAR(Slides), [_objects, _images, _names], true];
TRACE_1("Assigning Slides to",_x);
} forEach _controllers;

View File

@ -0,0 +1,20 @@
/*
* Author: Jonpas
* Checks if object has slides.
*
* Arguments:
* 0: Object <OBJECT>
*
* Return Value:
* Has Slides <BOOL>
*
* Example:
* [object] call ace_slideshow_fnc_hasSlides;
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_object);
(!isNil {_object getVariable [QGVAR(Slides), nil]})

View File

@ -0,0 +1,58 @@
/*
* Author: Jonpas
* Makes a list from a string using comma as a delimiter, optionally remove whitespace and check each for object existence.
*
* Arguments:
* 0: Text <STRING>
* 1: Remove Whitespace <BOOL>
* 2: Check Nil <BOOL>
*
* Return Value:
* Parsed List <ARRAY>
*
* Example:
* ["text", true, false] call ace_slideshow_fnc_makeList;
*
* Public: No
*/
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
PARAMS_3(_list,_removeWhitespace,_checkNil);
private ["_splittedList", "_listNoWhitespace", "_nilCheckPassedList"];
// Split using comma delimiter
_splittedList = [_list, ","] call BIS_fnc_splitString;
// Remove whitespace
_listNoWhitespace = [];
if (_removeWhitespace) then {
{
_x = [_x] call EFUNC(common,stringRemoveWhiteSpace);
_listNoWhitespace pushBack _x;
} forEach _splittedList;
_list = _listNoWhitespace;
};
// Check for object existence
_nilCheckPassedList = "";
if (_checkNil) then {
{
if !(isNil _x) then {
if (_nilCheckPassedList == "") then {
_nilCheckPassedList = _x;
} else {
_nilCheckPassedList = _nilCheckPassedList + "," + _x;
};
};
} forEach _list;
// Add Array characters and parse into array
_list = "[" + _nilCheckPassedList + "]";
_list = [] call compile _list;
};
TRACE_4("Lists",_splittedList,_listNoWhitespace,_nilCheckPassedList,_list);
_list

View File

@ -0,0 +1,38 @@
/*
* Author: Jonpas
* Initializes the module.
*
* Arguments:
* 0: The module logic <LOGIC>
* 1: Units <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* None
*
* Public: No
*/
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
if !(isServer) exitWith {};
PARAMS_3(_logic,_units,_activated);
if !(_activated) exitWith {};
private ["_objects", "_controllers", "_return", "_images", "_names", "_controller"];
_logic = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
if (isNull _logic) exitWith {};
// Extract variables from logic
_objects = [_logic getVariable ["Objects", ""], true, true] call FUNC(makeList);
_controllers = [_logic getVariable ["Controllers", ""], true, true] call FUNC(makeList);
_images = [_logic getVariable ["Images", ""], true, false] call FUNC(makeList);
_names = [_logic getVariable ["Names", ""], true, false] call FUNC(makeList);
// Prepare with actions
[_objects, _controllers, _images, _names] call FUNC(createSlideshow);
diag_log text format ["[TAC]: Slideshow Module Initialized for: %1", _objects];

View File

@ -0,0 +1 @@
#include "\z\ace\addons\slideshow\script_component.hpp"

View File

@ -0,0 +1,16 @@
#define COMPONENT slideshow
#include "\z\ace\addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_SLIDESHOW
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_SLIDESHOW
#define DEBUG_SETTINGS DEBUG_SETTINGS_SLIDESHOW
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#define CLASSNAMES_OBJECTS "Land_MapBoard_F"
#define CLASSNAMES_BOTH "Land_Laptop_unfolded_F", "Land_Laptop_device_F", "Land_PCSet_01_screen_F"
#define CLASSNAMES_CONTROLLERS "Land_HandyCam_F", "Land_MobilePhone_smart_F", "Land_Tablet_01_F", "Land_PCSet_01_keyboard_F", "Land_PCSet_01_mouse_F", "Land_GamingSet_01_controller_F"

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="Slideshow">
<Key ID="STR_ACE_Slideshow_DisplayName">
<English>Slideshow</English>
</Key>
<Key ID="STR_ACE_Slideshow_Description">
<English>This module allows you to set up slide-shows on different objects. One module per image list.</English>
</Key>
<Key ID="STR_ACE_Slideshow_Objects_DisplayName">
<English>Objects</English>
</Key>
<Key ID="STR_ACE_Slideshow_Objects_Description">
<English>Object names (can also be synchronized objects) slide-show will be displayed on, separated by commas if multiple. Reference INFO for object support.</English>
</Key>
<Key ID="STR_ACE_Slideshow_Controllers_DisplayName">
<English>Controllers</English>
</Key>
<Key ID="STR_ACE_Slideshow_Controllers_Description">
<English>Controller object names (can also be synchronized objects), separated by commas if multiple. Reference INFO for object support.</English>
</Key>
<Key ID="STR_ACE_Slideshow_Images_DisplayName">
<English>Images</English>
</Key>
<Key ID="STR_ACE_Slideshow_Images_Description">
<English>List of images that will be used for the slide-show, separated by commas, with full path correctly formatted (eg. images\image.paa).</English>
</Key>
<Key ID="STR_ACE_Slideshow_Names_DisplayName">
<English>Interaction Names</English>
</Key>
<Key ID="STR_ACE_Slideshow_Names_Description">
<English>List of names that will be used for interaction entries, separated by commas, in order of images.</English>
</Key>
<Key ID="STR_ACE_Slideshow_Interaction">
<English>Slides</English>
</Key>
</Package>
</Project>