From 1a9b5728502a6004206295e5833f82f1bcdeb96a Mon Sep 17 00:00:00 2001 From: Thomas Kooi Date: Mon, 12 Jan 2015 23:26:46 +0100 Subject: [PATCH] Added cse_sys_gestures source --- TO_MERGE/cse/sys_gestures/CfgAddons.h | 7 ++ TO_MERGE/cse/sys_gestures/CfgFunctions.h | 8 ++ TO_MERGE/cse/sys_gestures/CfgVehicles.h | 29 +++++ .../sys_gestures/Combat_Space_Enhancement.h | 61 ++++++++++ TO_MERGE/cse/sys_gestures/config.cpp | 17 +++ .../sys_gestures/functions/fn_playGesture.sqf | 47 ++++++++ .../cse/sys_gestures/init_sys_gestures.sqf | 66 +++++++++++ TO_MERGE/cse/sys_gestures/stringtable.xml | 106 ++++++++++++++++++ 8 files changed, 341 insertions(+) create mode 100644 TO_MERGE/cse/sys_gestures/CfgAddons.h create mode 100644 TO_MERGE/cse/sys_gestures/CfgFunctions.h create mode 100644 TO_MERGE/cse/sys_gestures/CfgVehicles.h create mode 100644 TO_MERGE/cse/sys_gestures/Combat_Space_Enhancement.h create mode 100644 TO_MERGE/cse/sys_gestures/config.cpp create mode 100644 TO_MERGE/cse/sys_gestures/functions/fn_playGesture.sqf create mode 100644 TO_MERGE/cse/sys_gestures/init_sys_gestures.sqf create mode 100644 TO_MERGE/cse/sys_gestures/stringtable.xml diff --git a/TO_MERGE/cse/sys_gestures/CfgAddons.h b/TO_MERGE/cse/sys_gestures/CfgAddons.h new file mode 100644 index 0000000000..e802565741 --- /dev/null +++ b/TO_MERGE/cse/sys_gestures/CfgAddons.h @@ -0,0 +1,7 @@ +class CfgAddons { + class PreloadAddons { + class cse_sys_gestures { + list[] = {"cse_sys_gestures"}; + }; + }; +}; diff --git a/TO_MERGE/cse/sys_gestures/CfgFunctions.h b/TO_MERGE/cse/sys_gestures/CfgFunctions.h new file mode 100644 index 0000000000..24b113642b --- /dev/null +++ b/TO_MERGE/cse/sys_gestures/CfgFunctions.h @@ -0,0 +1,8 @@ +class CfgFunctions { + class CSE { + class Gestures { + file = "cse\cse_sys_gestures\functions"; + class playGesture { recompile = 1; }; + }; + }; +}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_gestures/CfgVehicles.h b/TO_MERGE/cse/sys_gestures/CfgVehicles.h new file mode 100644 index 0000000000..bf8da07323 --- /dev/null +++ b/TO_MERGE/cse/sys_gestures/CfgVehicles.h @@ -0,0 +1,29 @@ +class CfgVehicles { + class Logic; + class Module_F: Logic { + class ArgumentsBaseUnits { + }; + }; + class cse_sys_gestures: Module_F { + scope = 2; + displayName = "Gestures [CSE]"; + icon = "\cse\cse_main\data\cse_groups_module.paa"; + category = "cseMisc"; + function = "cse_fnc_initalizeModule_F"; + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + class Arguments { + class allowAIControl { + displayName = "Allow AI Control"; + description = "Allow Group leaders to issue basic orders through gestures"; + typeName = "BOOL"; + defaultValue = true; + }; + }; + class ModuleDescription { + description = "Enables the CSE Gesture actions."; + sync[] = {}; + }; + }; +}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_gestures/Combat_Space_Enhancement.h b/TO_MERGE/cse/sys_gestures/Combat_Space_Enhancement.h new file mode 100644 index 0000000000..0de3163760 --- /dev/null +++ b/TO_MERGE/cse/sys_gestures/Combat_Space_Enhancement.h @@ -0,0 +1,61 @@ +#define MENU_KEYBINDING 1 +#define ACTION_KEYBINDING 2 +#define CLIENT_SETTING 3 + +class Combat_Space_Enhancement { + class cfgModules { + class cse_sys_gestures { + init = "call compile preprocessFile 'cse\cse_sys_gestures\init_sys_gestures.sqf';"; + name = "Gestures"; + + /*class Configurations { + class playGesture_Freeze { + type = ACTION_KEYBINDING; + title = $STR_CSE_GESTURE_FREEZE_TOOLTIP; + description = $STR_CSE_GESTURE_FREEZE_TOOLTIP; + value[] = {0,0,0,0}; + onPressed = "[player, 'gestureFreeze'] call cse_fnc_playGesture"; + }; + + class playGesture_Follow { + type = ACTION_KEYBINDING; + title = $STR_CSE_GESTURE_FOLLOW_TOOLTIP; + description = $STR_CSE_GESTURE_FOLLOW_TOOLTIP; + value[] = {0,0,0,0}; + onPressed = "[player, 'gestureFollow'] call cse_fnc_playGesture"; + }; + + class playGesture_CEASEFIRE { + type = ACTION_KEYBINDING; + title = $STR_CSE_GESTURE_CEASEFIRE_TOOLTIP; + description = $STR_CSE_GESTURE_CEASEFIRE_TOOLTIP; + value[] = {0,0,0,0}; + onPressed = "[player, 'gestureCeaseFire'] call cse_fnc_playGesture"; + }; + + class playGesture_COVER { + type = ACTION_KEYBINDING; + title = $STR_CSE_GESTURE_COVER_TOOLTIP; + description = $STR_CSE_GESTURE_COVER_TOOLTIP; + value[] = {0,0,0,0}; + onPressed = "[player, 'gestureCover'] call cse_fnc_playGesture"; + }; + + class playGesture_Go { + type = ACTION_KEYBINDING; + title = $STR_CSE_GESTURE_GO_TOOLTIP; + description = $STR_CSE_GESTURE_GO_TOOLTIP; + value[] = {0,0,0,0}; + onPressed = "[player, 'gestureGo'] call cse_fnc_playGesture"; + }; + class playGesture_Point { + type = ACTION_KEYBINDING; + title = $STR_CSE_GESTURE_POINT_TOOLTIP; + description = $STR_CSE_GESTURE_POINT_TOOLTIP; + value[] = {0,0,0,0}; + onPressed = "[player, 'gesturePoint'] call cse_fnc_playGesture"; + }; + };*/ + }; + }; +}; diff --git a/TO_MERGE/cse/sys_gestures/config.cpp b/TO_MERGE/cse/sys_gestures/config.cpp new file mode 100644 index 0000000000..261dcff887 --- /dev/null +++ b/TO_MERGE/cse/sys_gestures/config.cpp @@ -0,0 +1,17 @@ +#define _ARMA_ +class CfgPatches { + class cse_sys_gestures { + units[] = {}; + weapons[] = {}; + requiredVersion = 0.1; + requiredAddons[] = {"cse_f_eh","cse_main", "cse_gui"}; + version = "0.10.0_rc"; + author[] = {"Combat Space Enhancement"}; + authorUrl = "http://csemod.com"; + }; +}; + +#include "CfgAddOns.h" +#include "CfgFunctions.h" +#include "CfgVehicles.h" +#include "Combat_Space_Enhancement.h" diff --git a/TO_MERGE/cse/sys_gestures/functions/fn_playGesture.sqf b/TO_MERGE/cse/sys_gestures/functions/fn_playGesture.sqf new file mode 100644 index 0000000000..8e3e53ca63 --- /dev/null +++ b/TO_MERGE/cse/sys_gestures/functions/fn_playGesture.sqf @@ -0,0 +1,47 @@ +/** + * fn_playGesture.sqf + * @Descr: Plays a gesture and executes orders for group AI, if setting has been enabled. + * @Author: Glowbal + * + * @Arguments: [unit OBJECT (The unit that plays the gesture), gesture STRING (Classname of the gesture animation being played)] + * @Return: void + * @PublicAPI: true + */ + + +private ["_unit", "_gesture", "_groupUnits"]; +_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param; +_gesture = [_this, 1, "", [""]] call BIS_fnc_Param; + + +_unit playactionnow _gesture; +_groupUnits = units group _unit; + +if (leader (group _unit) == _unit && CSE_SYS_GESTURES_ALLOW_AI_CONTROL) then { + switch (_gesture) do { + case ("gestureCeaseFire"): { + }; + case ("gestureCover"): { + }; + case ("gestureFreeze"): { + {_x stop true;} count _groupUnits; + }; + case ("gestureFollow"): { + {_x dofollow _unit;} count _groupUnits; + }; + case ("gestureGo"): { + {_x stop false;} count _groupUnits; + }; + case ("gesturePoint"): { + }; + }; +}; +/* +_unit setvariable ["cse_playGesture_GRP", _gesture, true]; +_handle = _this spawn { + uisleep 3; + if (((_this select 0) getvariable ["cse_playGesture_GRP", ""]) == (_this select 1)) then { + (_this select 0) setvariable ["cse_playGesture_GRP", nil, true]; + }; +}; +*/ \ No newline at end of file diff --git a/TO_MERGE/cse/sys_gestures/init_sys_gestures.sqf b/TO_MERGE/cse/sys_gestures/init_sys_gestures.sqf new file mode 100644 index 0000000000..7651e06b4f --- /dev/null +++ b/TO_MERGE/cse/sys_gestures/init_sys_gestures.sqf @@ -0,0 +1,66 @@ + +private ["_args", "_entries"]; +_args = _this; +CSE_SYS_GESTURES_ALLOW_AI_CONTROL = false; +{ + if (_x select 0 == "allowAIControl") then { + CSE_SYS_GESTURES_ALLOW_AI_CONTROL = (_x select 1); + }; +}foreach _args; +waituntil {!isnil "cse_gui"}; + +cse_displayGestureActions_GroupMenu_GESTURES = { + [ _this select 3, + [ + [localize "STR_CSE_GESTURE_FREEZE_SHORT", "cse\cse_sys_gestures\data\icons\icon_hand.paa", {closeDialog 0; [player, "gestureFreeze"] call cse_fnc_playGesture}, true, localize "STR_CSE_GESTURE_FREEZE_TOOLTIP"], + [localize "STR_CSE_GESTURE_FOLLOW_SHORT", "cse\cse_sys_gestures\data\icons\icon_hand.paa", {closeDialog 0; [player, "gestureFollow"] call cse_fnc_playGesture}, true, localize "STR_CSE_GESTURE_FOLLOW_TOOLTIP"], + [localize "STR_CSE_GESTURE_CEASEFIRE_SHORT", "cse\cse_sys_gestures\data\icons\icon_hand.paa", {closeDialog 0; [player, "gestureCeaseFire"] call cse_fnc_playGesture}, true, localize "STR_CSE_GESTURE_CEASEFIRE_TOOLTIP"], + [localize "STR_CSE_GESTURE_COVER_SHORT", "cse\cse_sys_gestures\data\icons\icon_hand.paa", {closeDialog 0; [player, "gestureCover"] call cse_fnc_playGesture}, true, localize "STR_CSE_GESTURE_COVER_TOOLTIP"], + [localize "STR_CSE_GESTURE_GO_SHORT", "cse\cse_sys_gestures\data\icons\icon_hand.paa", {closeDialog 0; [player, "gestureGo"] call cse_fnc_playGesture}, true, localize "STR_CSE_GESTURE_GO_TOOLTIP"], + [localize "STR_CSE_GESTURE_POINT_SHORT", "cse\cse_sys_gestures\data\icons\icon_hand.paa", {closeDialog 0; [player, "gesturePoint"] call cse_fnc_playGesture}, true, localize "STR_CSE_GESTURE_POINT_TOOLTIP"] + ], + _this select 1, CSE_SELECTED_RADIAL_OPTION_N_GUI, true + ] call cse_fnc_openRadialSecondRing_GUI; +}; + +_entries = [ + [localize "STR_CSE_GESTURE_GESTUREACTION_SHORT", {([player] call cse_fnc_canInteract)}, "cse\cse_sys_gestures\data\icons\icon_hand.paa", cse_displayGestureActions_GroupMenu_GESTURES, localize "STR_CSE_GESTURE_GESTUREACTION_TOOLTIP"] +]; + +["ActionMenu","group_actions", _entries ] call cse_fnc_addMultipleEntriesToRadialCategory_F; + + +_playCondition = { + (((_this select 0) getvariable ["cse_playGesture_GRP", ""]) != ""); +}; + +_playOnDraw = { + _var = (_this select 0) getvariable ["cse_playGesture_GRP", ""]; + + switch (_gesture) do { + case ("gestureCeaseFire"): { + + }; + case ("gestureCover"): { + + }; + case ("gestureFreeze"): { + + }; + case ("gestureFollow"): { + + }; + case ("gestureGo"): { + + }; + case ("gesturePoint"): { + + }; + }; + + ["cse\cse_sys_gestures\data\icons\icon_hand.paa", [1,1,1,1]]; +}; + +if (["cse_sys_tags"] call cse_fnc_isModLoaded_f) then { + [_playCondition, _playOnDraw, 1] call cse_fnc_registerIconSet_TAGS; +}; \ No newline at end of file diff --git a/TO_MERGE/cse/sys_gestures/stringtable.xml b/TO_MERGE/cse/sys_gestures/stringtable.xml new file mode 100644 index 0000000000..845eda59e8 --- /dev/null +++ b/TO_MERGE/cse/sys_gestures/stringtable.xml @@ -0,0 +1,106 @@ + + + + + + Freeze! + Freeze! + Halt! + Stój! + Alto¡ + + + Follow! + Follow! + Mitkommen! + Za mną! + Seguidme¡ + + + Cease Fire! + Cease Fire! + Feuer einstellen! + Wstrzymać ogień! + Alto el fuego¡ + + + Cover! + Cover! + In Deckung! + Do osłon! + A cobertura¡ + + + Go! + Go! + Los, Los, Los! + Naprzód! + Vamos¡ + + + Point! + Point! + Fingerzeig. + Wskaż palcem! + Señalar + + + Play Gesture Freeze + Play Gesture Freeze + Halt! Geste ausführen + Pokazuje gest Stój! + Ejecutar gesto Alto¡ + + + Play Gesture Follow + Play Gesture Follow + Mitkommen! Geste ausführen + Pokazuje gest Za mną! + Ejecutar gesto Seguidme¡ + + + Play Gesture Cease Fire + Play Gesture Cease Fire + Feuer einstellen! Geste ausführen + Pokazuje gest Wstrzymać ogień! + Ejecutar gesto Alto el fuego¡ + + + Play Gesture Cover + Play Gesture Cover + In Deckung! Geste ausführen + Pokazuje gest Do osłon! + Ejecutar gesto A cobertura¡¡ + + + Play Gesture Go + Play Gesture Go + Los, Los, Los! Geste ausführen + Pokazuje gest Naprzód! + Ejecutar gesto Vamos¡ + + + Play Gesture Point + Play Gesture Point + Zeigt nach Vorne. + Pokazuje gest Wskaż palcem! + Ejecutar gesto Señalar¡ + + + + Gestures + Gestures + Gesten + Gesty + Gestos + + + Use Gesture + Use Gesture + Gesten ausführen + Pokaż gest + Usar Gestos + + + +