Skip to content

Commit

Permalink
#698 Added texture Toggle to Tasks Map
Browse files Browse the repository at this point in the history
 Texture toggle added to C2ISTAR Tasks
  • Loading branch information
GunnyDev committed Jun 17, 2020
1 parent 5c51aa3 commit a20b9c9
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 21 deletions.
18 changes: 15 additions & 3 deletions addons/mil_c2istar/data/ui/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -300,7 +298,6 @@ class C2Tablet_RscMap
fontLevel = "TahomaB";
fontNames = "PuristaMedium";
fontUnits = "TahomaB";
maxSatelliteAlpha = 0.85; //maxSatelliteAlpha = 0;
moveOnEdges = 1;
ptsPerSquareSea = 8;
ptsPerSquareTxt = 10;
Expand Down Expand Up @@ -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;
};

26 changes: 25 additions & 1 deletion addons/mil_c2istar/data/ui/main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
112 changes: 95 additions & 17 deletions addons/mil_c2istar/fnc_C2ISTAR.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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];
Expand Down Expand Up @@ -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;
Expand All @@ -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];

Expand Down Expand Up @@ -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"];

Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit a20b9c9

Please sign in to comment.