From a20b9c9f43f61c49454fb607bfc319edb8aceef5 Mon Sep 17 00:00:00 2001 From: GunnyDev Date: Wed, 17 Jun 2020 21:00:15 +0100 Subject: [PATCH] #698 Added texture Toggle to Tasks Map Texture toggle added to C2ISTAR Tasks --- addons/mil_c2istar/data/ui/common.hpp | 18 ++++- addons/mil_c2istar/data/ui/main.hpp | 26 +++++- addons/mil_c2istar/fnc_C2ISTAR.sqf | 112 ++++++++++++++++++++++---- 3 files changed, 135 insertions(+), 21 deletions(-) diff --git a/addons/mil_c2istar/data/ui/common.hpp b/addons/mil_c2istar/data/ui/common.hpp index b1508d717..dc2ec92fd 100644 --- a/addons/mil_c2istar/data/ui/common.hpp +++ b/addons/mil_c2istar/data/ui/common.hpp @@ -266,8 +266,6 @@ class C2Tablet_RscButton class C2Tablet_RscMap { access = 0; - alphaFadeEndScale = 2;//0.4; - alphaFadeStartScale = 2;// 0.35; colorBackground[] = {0.9, 0.9, 0.9, 1}; //colorBackground[] = {0.969,0.957,0.949,1}; colorCountlines[] = {0.65, 0.53, 0.3, 1}; //colorCountlines[] = {0.572,0.354,0.188,0.25}; colorCountlinesWater[] = {0.491,0.577,0.702,0.3}; @@ -300,7 +298,6 @@ class C2Tablet_RscMap fontLevel = "TahomaB"; fontNames = "PuristaMedium"; fontUnits = "TahomaB"; - maxSatelliteAlpha = 0.85; //maxSatelliteAlpha = 0; moveOnEdges = 1; ptsPerSquareSea = 8; ptsPerSquareTxt = 10; @@ -645,3 +642,18 @@ class C2Tablet_RscMap size = 24; }; }; + +class C2Tablet_RscMapTextured : C2Tablet_RscMap +{ + alphaFadeEndScale = 2;//0.4; + alphaFadeStartScale = 2;// 0.35; + maxSatelliteAlpha = 0.85; //maxSatelliteAlpha = 0; +}; + +class C2Tablet_RscMapNonTextured : C2Tablet_RscMap +{ + alphaFadeEndScale = 0.4; + alphaFadeStartScale = 0.35; + maxSatelliteAlpha = 0; +}; + diff --git a/addons/mil_c2istar/data/ui/main.hpp b/addons/mil_c2istar/data/ui/main.hpp index 67b634f29..3c6e50b1e 100644 --- a/addons/mil_c2istar/data/ui/main.hpp +++ b/addons/mil_c2istar/data/ui/main.hpp @@ -350,7 +350,7 @@ class C2Tablet rowHeight = (safeZoneW / 75) + (safeZoneH / 275); }; - class C2Tablet_taskingMap : C2Tablet_RscMap + class C2Tablet_taskingMapTextured : C2Tablet_RscMapTextured { idc = 70022; x = 0.519796 * safezoneW + safezoneX; @@ -359,6 +359,15 @@ class C2Tablet h = 0.4 * safezoneH; }; + class C2Tablet_taskingMapNonTextured : C2Tablet_RscMapNonTextured + { + idc = 70057; + x = 0.519796 * safezoneW + safezoneX; + y = 0.1584 * safezoneH + safezoneY; + w = 0.216525 * safezoneW; + h = 0.4 * safezoneH; + }; + class C2Tablet_taskingAddTaskCreateButton : C2Tablet_RscButton { idc = 70023; @@ -404,6 +413,21 @@ class C2Tablet colorFocused[] = {0.706,0.706,0.706,1}; }; + class C2Tablet_toggleMapTexturesButton : C2Tablet_RscButton + { + idc = 70058; + text = "Toggle Map Textures"; + style = 0x02; + x = 0.519796 * safezoneW + safezoneX; + y = 0.5950 * safezoneH + safezoneY; + w = 0.216525 * safezoneW; + h = 0.028 * safezoneH; + sizeEx = 0.8 * GUI_GRID_H; + colorBackground[] = {0.384,0.439,0.341,1}; + colorBackgroundFocused[] = {0.706,0.706,0.706,1}; + colorFocused[] = {0.706,0.706,0.706,1}; + }; + class C2Tablet_taskingAddTaskApplyEditTitle : C2Tablet_RscText { idc = 70033; diff --git a/addons/mil_c2istar/fnc_C2ISTAR.sqf b/addons/mil_c2istar/fnc_C2ISTAR.sqf index 0aa546922..066b7f542 100644 --- a/addons/mil_c2istar/fnc_C2ISTAR.sqf +++ b/addons/mil_c2istar/fnc_C2ISTAR.sqf @@ -87,7 +87,9 @@ Peer Reviewed: #define C2Tablet_CTRL_TaskAddDescriptionEdit 70021 #define C2Tablet_CTRL_TaskAddStateEditTitle 70030 #define C2Tablet_CTRL_TaskAddStateEdit 70031 -#define C2Tablet_CTRL_TaskAddMap 70022 +#define C2Tablet_CTRL_TaskAddMapTextured 70022 +#define C2Tablet_CTRL_TaskAddMapNonTextured 70057 +#define C2Tablet_CTRL_ToggleTexturesButton 70058 #define C2Tablet_CTRL_TaskAddCreateButton 70023 #define C2Tablet_CTRL_TaskCurrentList 70025 #define C2Tablet_CTRL_TaskCurrentListEditButton 70026 @@ -1023,6 +1025,33 @@ switch(_operation) do { }; + case "TOGGLE_MAP_TEXTURES": { + private ["_texturedMapEnabled","_texturedMap","_nonTexturedMap"]; + + _texturedMapEnabled = _logic getVariable ["texturedMap", true]; + diag_log format ["_texturedMapEnabled: %1", _texturedMapEnabled]; + if(_texturedMapEnabled) then { + _texturedMap = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapTextured); + _texturedMap ctrlShow false; + + _nonTexturedMap = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapNonTextured); + _nonTexturedMap ctrlShow true; + + _nonTexturedMap ctrlSetEventHandler ["MouseButtonDown", "['TASK_GENERATE_MAP_CLICK',[_this]] call ALIVE_fnc_C2TabletOnAction"]; + _logic setVariable ["texturedMap", false]; + } else { + + _nonTexturedMap = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapNonTextured); + _nonTexturedMap ctrlShow false; + + _texturedMap = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapTextured); + _texturedMap ctrlShow true; + + _texturedMap ctrlSetEventHandler ["MouseButtonDown", "['TASK_GENERATE_MAP_CLICK',[_this]] call ALIVE_fnc_C2TabletOnAction"]; + _logic setVariable ["texturedMap", true]; + }; + }; + case "TASK_ADD_BACK_BUTTON_CLICK": { [_logic,"disableAddTask"] call MAINCLASS; @@ -1217,7 +1246,7 @@ switch(_operation) do { case "TASK_ADD_MAP_CLICK": { - private ["_button","_posX","_posY","_map","_position","_markers","_marker","_markerLabel","_selectedDeliveryValue"]; + private ["_button","_posX","_posY","_map","_texturedMapEnabled","_position","_markers","_marker","_markerLabel","_selectedDeliveryValue"]; _button = _args select 0 select 1; _posX = _args select 0 select 2; @@ -1231,9 +1260,15 @@ switch(_operation) do { deleteMarkerLocal (_markers select 0); }; - _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMap); + _texturedMapEnabled = _logic getVariable ["texturedMap", true]; - _position = _map ctrlMapScreenToWorld [_posX, _posY]; + if(_texturedMapEnabled) then { + _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapTextured); + } else { + _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapNonTextured); + }; + + _position = _map ctrlMapScreenToWorld [_posX, _posY]; ctrlMapAnimClear _map; _map ctrlMapAnimAdd [0.5, ctrlMapScale _map, _position]; @@ -1901,7 +1936,7 @@ switch(_operation) do { case "TASK_GENERATE_MAP_CLICK": { - private ["_button","_posX","_posY","_map","_position","_markers","_marker","_markerLabel","_selectedDeliveryValue"]; + private ["_button","_posX","_posY","_map","_texturedMapEnabled","_position","_markers","_marker","_markerLabel","_selectedDeliveryValue"]; _button = _args select 0 select 1; _posX = _args select 0 select 2; @@ -1915,7 +1950,13 @@ switch(_operation) do { deleteMarkerLocal (_markers select 0); }; - _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMap); + _texturedMapEnabled = _logic getVariable ["texturedMap", true]; + + if(_texturedMapEnabled) then { + _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapTextured); + } else { + _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapNonTextured); + }; _position = _map ctrlMapScreenToWorld [_posX, _posY]; @@ -2646,9 +2687,16 @@ switch(_operation) do { private ["_map"]; - _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMap); + _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapTextured); _map ctrlShow true; _map ctrlSetEventHandler ["MouseButtonDown", "['TASK_GENERATE_MAP_CLICK',[_this]] call ALIVE_fnc_C2TabletOnAction"]; + _logic setVariable ["texturedMap", true]; + + private ["_toggleTextureButton"]; + + _toggleTextureButton = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_ToggleTexturesButton); + _toggleTextureButton ctrlShow true; + _toggleTextureButton ctrlSetEventHandler ["MouseButtonDown", "['TOGGLE_MAP_TEXTURES',[_this]] call ALIVE_fnc_C2TabletOnAction"]; private ["_createButton"]; @@ -2744,10 +2792,20 @@ switch(_operation) do { _statusText = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddStatusText); _statusText ctrlShow false; - private ["_map"]; + private ["_mapTextured"]; - _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMap); - _map ctrlShow false; + _mapTextured = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapTextured); + _mapTextured ctrlShow false; + + private ["_mapNonTextured"]; + + _mapNonTextured = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapNonTextured); + _mapNonTextured ctrlShow false; + + private ["_toggleTexturesButton"]; + + _toggleTexturesButton = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_ToggleTexturesButton); + _toggleTexturesButton ctrlShow false; }; case "enableGenerateTaskManagePlayers": { @@ -2888,7 +2946,7 @@ switch(_operation) do { _abortButton ctrlShow true; private ["_editTitle","_titleEdit","_editDescription","_descriptionEdit","_map","_createButton","_stateTitle", - "_stateList","_stateListOptions","_managePlayersButton","_applyTitle","_applyList","_applyListOptions","_statusText"]; + "_stateList","_stateListOptions","_managePlayersButton","_applyTitle","_applyList","_applyListOptions","_statusText","_toggleTextureButton"]; _editTitle = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddTitleEditTitle); _editTitle ctrlShow true; @@ -2970,10 +3028,14 @@ switch(_operation) do { _parentList ctrlSetEventHandler ["LBSelChanged", "['TASK_ADD_PARENT_LIST_SELECT',[_this]] call ALIVE_fnc_C2TabletOnAction"]; - _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMap); + _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapTextured); _map ctrlShow true; _map ctrlSetEventHandler ["MouseButtonDown", "['TASK_ADD_MAP_CLICK',[_this]] call ALIVE_fnc_C2TabletOnAction"]; + _toggleTextureButton = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_ToggleTexturesButton); + _toggleTextureButton ctrlShow true; + _toggleTextureButton ctrlSetEventHandler ["MouseButtonDown", "['TOGGLE_MAP_TEXTURES',[_this]] call ALIVE_fnc_C2TabletOnAction"]; + _statusText = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddStatusText); _statusText ctrlShow true; @@ -3007,7 +3069,7 @@ switch(_operation) do { _abortButton = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_SubMenuAbort); _abortButton ctrlShow false; - private ["_editTitle","_titleEdit","_editDescription","_descriptionEdit","_map","_createButton","_stateTitle", + private ["_editTitle","_titleEdit","_editDescription","_descriptionEdit","_map","_mapNonTextured","_toggleTexturesButton","_createButton","_stateTitle", "_stateList","_managePlayersButton","_applyTitle","_applyList","_currentTitle","_currentList","_statusText","_parentTitle","_parentList"]; _editTitle = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddTitleEditTitle); @@ -3046,9 +3108,15 @@ switch(_operation) do { _parentList = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddParentEdit); _parentList ctrlShow false; - _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMap); + _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapTextured); _map ctrlShow false; + _mapNonTextured = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapNonTextured); + _mapNonTextured ctrlShow false; + + _toggleTexturesButton = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_ToggleTexturesButton); + _toggleTexturesButton ctrlShow false; + _statusText = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddStatusText); _statusText ctrlShow false; @@ -3212,7 +3280,7 @@ switch(_operation) do { _abortButton = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_SubMenuAbort); _abortButton ctrlShow true; - private ["_editTitle","_titleEdit","_editDescription","_descriptionEdit","_taskEditingDisabled","_map","_createButton","_editButton"]; + private ["_editTitle","_titleEdit","_editDescription","_descriptionEdit","_taskEditingDisabled","_map","_createButton","_editButton","_toggleTextureButton"]; _editTitle = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddTitleEditTitle); _editTitle ctrlShow true; @@ -3332,9 +3400,13 @@ switch(_operation) do { _taskEditingDisabled = [_logic,"taskEditingDisabled"] call MAINCLASS; - _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMap); + _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapTextured); _map ctrlShow true; + _toggleTexturesButton = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_ToggleTexturesButton); + _toggleTexturesButton ctrlShow true; + _toggleTextureButton ctrlSetEventHandler ["MouseButtonDown", "['TOGGLE_MAP_TEXTURES',[_this]] call ALIVE_fnc_C2TabletOnAction"]; + if!(_taskEditingDisabled) then { _map ctrlSetEventHandler ["MouseButtonDown", "['TASK_ADD_MAP_CLICK',[_this]] call ALIVE_fnc_C2TabletOnAction"]; }else{ @@ -3441,9 +3513,15 @@ switch(_operation) do { _parentList = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddParentEdit); _parentList ctrlShow false; - _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMap); + _map = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapTextured); _map ctrlShow false; + _mapNonTextured = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddMapNonTextured); + _mapNonTextured ctrlShow false; + + _toggleTexturesButton = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_ToggleTexturesButton); + _toggleTexturesButton ctrlShow false; + _statusText = C2_getControl(C2Tablet_CTRL_MainDisplay,C2Tablet_CTRL_TaskAddStatusText); _statusText ctrlShow false;