Map Gestures - Add Briefingscreen support, Different Camera Range, Improve Responsiveness, and Toggles for Curators and Spectators Maps (#7782)

* Add Variable Range for Camera Users (Zeus, Spectator) + Settings

Add Setting to Disable Zeus and/or Spectator Map Draws
Add Ability to use Map Gestures on Briefing screen
Add Setting for Briefing Screen mode (All, Only Group, Only Side, Proximity, Disabled)

* disable DISABLE_COMPILE_CACHE

* minor cleanup and add some translations

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
Joko 2020-08-18 19:44:16 +02:00 committed by GitHub
parent d72555ab0c
commit bddf74cbb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 184 additions and 51 deletions

View File

@ -23,7 +23,12 @@ class Extended_DisplayLoad_EventHandlers {
class RscDisplayEGSpectator { class RscDisplayEGSpectator {
ADDON = QUOTE((((_this select 0) displayCtrl ID_EG_MAP_CONTROL) controlsGroupCtrl ID_EG_MAP_CONTROLGROUP) call FUNC(initDisplaySpectator)); ADDON = QUOTE((((_this select 0) displayCtrl ID_EG_MAP_CONTROL) controlsGroupCtrl ID_EG_MAP_CONTROLGROUP) call FUNC(initDisplaySpectator));
}; };
class RscDiary { // for loading saves use uiNamespace because missionNamespace is not restored before map is loaded class RscDiary { // for loading saves use uiNamespace because missionNamespace is not restored before map is loaded
ADDON = QUOTE(((_this select 0) displayCtrl ID_DIARY_MAP) call (uiNamespace getVariable 'DFUNC(initDisplayDiary)')); #ifdef DISABLE_COMPILE_CACHE
ADDON = QUOTE(((_this select 0) displayCtrl ID_DIARY_MAP) call (missionNamespace getVariable [ARR_2('DFUNC(initDisplayDiary)', uiNamespace getVariable 'DFUNC(initDisplayDiary)')]););
#else
ADDON = QUOTE(((_this select 0) displayCtrl ID_DIARY_MAP) call (uiNamespace getVariable 'DFUNC(initDisplayDiary)'););
#endif
}; };
}; };

View File

@ -5,13 +5,13 @@
* *
* Arguments: * Arguments:
* 0: Map Handle <CONTROL> * 0: Map Handle <CONTROL>
* 1: Positions (objects or posAGLs) <ARRAY> * 1: Positions (objects or posAGLs) with render distance <ARRAY<ARRAY<OBJECT,NUMBER>>>
* *
* Return Value: * Return Value:
* None * None
* *
* Example: * Example:
* [findDisplay 12 displayCtrl 51, [player]] call ace_map_gestures_fnc_drawMapGestures * [findDisplay 12 displayCtrl 51, [[player, 0]]] call ace_map_gestures_fnc_drawMapGestures
* *
* Public: No * Public: No
*/ */
@ -29,10 +29,8 @@ BEGIN_COUNTER(draw);
#define TEXT_SHADOW 0 #define TEXT_SHADOW 0
if (!GVAR(enabled)) exitWith {}; if (!GVAR(enabled)) exitWith {};
params ["_mapHandle", "_positions"]; params ["_mapHandle", "_positions"];
private _players = [_positions, FUNC(getProximityPlayers), missionNamespace, QGVAR(proximityPlayersCache), 1] call EFUNC(common,cachedCall);
private _players = [[_positions, GVAR(maxRange)], FUNC(getProximityPlayers), missionNamespace, QGVAR(proximityPlayersCache), 1] call EFUNC(common,cachedCall);
// Iterate over all nearby players and render their pointer if player is transmitting. // Iterate over all nearby players and render their pointer if player is transmitting.
{ {
private _pos = _x getVariable QGVAR(pointPosition); private _pos = _x getVariable QGVAR(pointPosition);

View File

@ -8,31 +8,49 @@
* 1: Range <NUMBER> * 1: Range <NUMBER>
* *
* Return Value: * Return Value:
* All units in proximity <ARRAY<OBJECT>> * All units in proximity with Distances to render from <ARRAY<ARRAY<OBJECT,NUMBER>>>
* *
* Example: * Example:
* [[player], 7] call ace_map_gestures_fnc_getProximityPlayers * [[[player, 6]]] call ace_map_gestures_fnc_getProximityPlayers
* *
* Public: No * Public: No
*/ */
params ["_positions", "_range"];
private _proximityPlayers = []; private _proximityPlayers = [];
{ private _fnc_getProximitsPlayers = {
_proximityPlayers append (_x nearEntities [["CAMAnBase"], _range]); {
if (_x isEqualType objNull) then { _x params ["_position", ["_range", GVAR(maxRange)]];
_proximityPlayers append (crew vehicle _x); private _temp = (_position nearEntities [["CAMAnBase"], _range]);
}; if (_position isEqualType objNull) then {
} forEach _positions; _temp append (crew vehicle _position);
if (GVAR(onlyShowFriendlys)) then {
_proximityPlayers = _proximityPlayers arrayIntersect _proximityPlayers; _temp = _temp select { [side group _position, side _x] call BIS_fnc_areFriendly; };
};
_proximityPlayers = _proximityPlayers select { [_x, false] call EFUNC(common,isPlayer); }; };
_proximityPlayers append _temp;
if (GVAR(onlyShowFriendlys)) then { } forEach _this;
_proximityPlayers = _proximityPlayers select { [side group ace_player, side _x] call BIS_fnc_areFriendly; };
}; };
switch (_this) do {
case (0): { // All
_proximityPlayers append allUnits;
};
case (1): { // Players in Group
_proximityPlayers append group ace_player;
};
case (2): { // Players on Side
_proximityPlayers append (allUnits select {side (group _x) == side (group ace_player)});
};
case (3): { // Proximity
[[ace_player, GVAR(maxRange)]] call _fnc_getProximitsPlayers;
};
case (4): {}; // Disabled
default {
_this call _fnc_getProximitsPlayers;
};
};
_proximityPlayers = _proximityPlayers arrayIntersect _proximityPlayers;
_proximityPlayers = _proximityPlayers select { [_x, false] call EFUNC(common,isPlayer); };
_proximityPlayers _proximityPlayers

View File

@ -17,4 +17,7 @@
params ["_mapCtrl"]; params ["_mapCtrl"];
TRACE_1("initDisplayCurator",_mapCtrl); TRACE_1("initDisplayCurator",_mapCtrl);
_mapCtrl ctrlAddEventHandler ["Draw", { [_this select 0, [ACE_player, positionCameraToWorld [0, 0, 0]]] call FUNC(drawMapGestures);}]; _mapCtrl ctrlAddEventHandler ["Draw", {
if (!GVAR(allowCurator)) exitWith {};
[_this select 0, [[ACE_player, GVAR(maxRange)], [positionCameraToWorld [0, 0, 0], GVAR(maxRangeCamera)]]] call FUNC(drawMapGestures);
}];

View File

@ -17,39 +17,44 @@
params ["_mapCtrl"]; params ["_mapCtrl"];
TRACE_1("initDisplayDiary",_mapCtrl); TRACE_1("initDisplayDiary",_mapCtrl);
_mapCtrl ctrlAddEventHandler ["Draw", { [_this select 0, [ACE_player]] call FUNC(drawMapGestures); }]; _mapCtrl ctrlAddEventHandler ["Draw", {
if (!GVAR(enabled)) exitWith {};
if (getClientStateNumber < 10) then {
[_this select 0, GVAR(briefingMode)] call FUNC(drawMapGestures);
} else {
[_this select 0, [[ACE_player, GVAR(maxRange)]]] call FUNC(drawMapGestures);
};
}];
// MouseMoving EH. // MouseMoving EH.
_mapCtrl ctrlAddEventHandler ["MouseMoving", { _mapCtrl ctrlAddEventHandler ["MouseMoving", {
if (!GVAR(enabled)) exitWith {}; if (!GVAR(enabled)) exitWith {};
params ["_control", "_posX", "_posY"]; params ["_control", "_posX", "_posY"];
private _position = _control ctrlMapScreenToWorld [_posX, _posY]; GVAR(cursorPosition) = _control ctrlMapScreenToWorld [_posX, _posY];
GVAR(cursorPosition) = _position;
// Don't transmit any data if we're using the map tools // Don't transmit any data if we're using the map tools
if (!GVAR(EnableTransmit) || {(["ace_maptools"] call EFUNC(common,isModLoaded)) && {EGVAR(maptools,mapTool_isDragging) || EGVAR(maptools,mapTool_isRotating)}}) exitWith {}; if (!GVAR(EnableTransmit) || {(["ace_maptools"] call EFUNC(common,isModLoaded)) && {EGVAR(maptools,mapTool_isDragging) || EGVAR(maptools,mapTool_isRotating)}}) exitWith {};
if (_position distance2D (ACE_player getVariable [QGVAR(pointPosition), [0, 0, 0]]) >= 1) then { if (GVAR(cursorPosition) distance2D (ACE_player getVariable [QGVAR(pointPosition), [0, 0, 0]]) >= 1) then {
[ACE_player, QGVAR(pointPosition), _position, GVAR(interval)] call EFUNC(common,setVariablePublic); [ACE_player, QGVAR(pointPosition), GVAR(cursorPosition), GVAR(interval)] call EFUNC(common,setVariablePublic);
}; };
}]; }];
// MouseDown EH // MouseDown EH
_mapCtrl ctrlAddEventHandler ["MouseButtonDown", { _mapCtrl ctrlAddEventHandler ["MouseButtonDown", {
if (getClientStateNumber < 10) exitWith {};
if (!GVAR(enabled)) exitWith {}; if (!GVAR(enabled)) exitWith {};
params ["", "_button", "_x", "_y", "_shift", "_ctrl", "_alt"]; params ["", "_button", "_x", "_y", "_shift", "_ctrl", "_alt"];
if (_button == 0 && {[_shift, _ctrl, _alt] isEqualTo [false, false, false]}) then { if (_button == 0 && {[_shift, _ctrl, _alt] isEqualTo [false, false, false]}) then {
GVAR(EnableTransmit) = true; GVAR(EnableTransmit) = true;
[ACE_player, QGVAR(pointPosition), GVAR(cursorPosition), GVAR(interval)] call EFUNC(common,setVariablePublic);
}; };
}]; }];
// MouseUp EH // MouseUp EH
_mapCtrl ctrlAddEventHandler ["MouseButtonUp", { _mapCtrl ctrlAddEventHandler ["MouseButtonUp", {
if (getClientStateNumber < 10) exitWith {};
if (!GVAR(enabled)) exitWith {}; if (!GVAR(enabled)) exitWith {};
params ["", "_button"]; params ["", "_button"];
if (_button == 0) then { if (_button == 0) then {
GVAR(EnableTransmit) = false; GVAR(EnableTransmit) = false;
ACE_player setVariable [QGVAR(pointPosition), nil, true]; // Instantly transmit nil to stop drawing icon ACE_player setVariable [QGVAR(pointPosition), nil, true]; // Instantly transmit nil to stop drawing icon
GVAR(cursorPosition) = nil;
}; };
}]; }];

View File

@ -18,15 +18,16 @@ params ["_mapCtrl"];
TRACE_1("initDisplaySpectator",_mapCtrl); TRACE_1("initDisplaySpectator",_mapCtrl);
_mapCtrl ctrlAddEventHandler ["Draw", { _mapCtrl ctrlAddEventHandler ["Draw", {
private _targets = [positionCameraToWorld [0, 0, 0]]; if (!GVAR(allowSpectator)) exitWith {};
private _targets = [[positionCameraToWorld [0, 0, 0], GVAR(maxRangeCamera)]];
private _aceSpectatorFocus = missionNamespace getVariable [QEGVAR(spectator,camFocus), objNull]; private _aceSpectatorFocus = missionNamespace getVariable [QEGVAR(spectator,camFocus), objNull];
if (!isNull _aceSpectatorFocus) then { if (!isNull _aceSpectatorFocus) then {
_targets pushback _aceSpectatorFocus; _targets pushback [_aceSpectatorFocus, GVAR(maxRange)];
}; };
private _vanillaSpectatorFocus = uiNamespace getVariable ["RscEGSpectator_focus", objNull]; private _vanillaSpectatorFocus = uiNamespace getVariable ["RscEGSpectator_focus", objNull];
if (!isNull _vanillaSpectatorFocus) then { if (!isNull _vanillaSpectatorFocus) then {
_targets pushback _vanillaSpectatorFocus; _targets pushback [_vanillaSpectatorFocus, GVAR(maxRange)];
}; };
[_this select 0, _targets] call FUNC(drawMapGestures); [_this select 0, _targets] call FUNC(drawMapGestures);
}]; }];

View File

@ -14,6 +14,35 @@
true true
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;
[
QGVAR(maxRangeCamera), "SLIDER",
[LSTRING(maxRangeCamera_displayName), LSTRING(maxRangeCamera_description)],
LSTRING(mapGestures_category),
[0,50,14,1],
true
] call CBA_fnc_addSetting;
[
QGVAR(allowSpectator), "CHECKBOX",
[LSTRING(allowSpectator_displayName), LSTRING(allowSpectator_description)],
LSTRING(mapGestures_category),
true
] call CBA_fnc_addSetting;
[
QGVAR(allowCurator), "CHECKBOX",
[LSTRING(allowCurator_displayName), LSTRING(allowCurator_description)],
LSTRING(mapGestures_category),
true
] call CBA_fnc_addSetting;
[
QGVAR(briefingMode), "LIST",
[LSTRING(allowCurator_displayName), LSTRING(allowCurator_description)],
LSTRING(mapGestures_category),
[[0, 1, 2, 3, 4], [LSTRING(briefingMode_All), LSTRING(briefingMode_Group), LSTRING(briefingMode_Side), LSTRING(briefingMode_Proximity), LSTRING(briefingMode_Disabled)], 0]
] call CBA_fnc_addSetting;
[ [
QGVAR(onlyShowFriendlys), QGVAR(onlyShowFriendlys),
"CHECKBOX", "CHECKBOX",
@ -34,7 +63,7 @@
[ [
QGVAR(nameTextColor), "COLOR", QGVAR(nameTextColor), "COLOR",
[LSTRING(nameTextColor_displayName), LSTRING(nameTextColor_description)], [LSTRING(nameTextColor_displayName), LSTRING(nameTextColor_description)],
LSTRING(mapGestures_category), [LSTRING(mapGestures_category), LSTRING(mapGestures_subcategory_colors)],
[0.2,0.2,0.2,0.3], [0.2,0.2,0.2,0.3],
false false
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;
@ -42,7 +71,7 @@
[ [
QGVAR(defaultLeadColor), "COLOR", QGVAR(defaultLeadColor), "COLOR",
[LSTRING(defaultLeadColor_displayName), LSTRING(defaultLeadColor_description)], [LSTRING(defaultLeadColor_displayName), LSTRING(defaultLeadColor_description)],
LSTRING(mapGestures_category), [LSTRING(mapGestures_category), LSTRING(mapGestures_subcategory_colors)],
[1,0.88,0,0.95], [1,0.88,0,0.95],
false false
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;
@ -50,7 +79,7 @@
[ [
QGVAR(defaultColor), "COLOR", QGVAR(defaultColor), "COLOR",
[LSTRING(defaultColor_displayName), LSTRING(defaultColor_description)], [LSTRING(defaultColor_displayName), LSTRING(defaultColor_description)],
LSTRING(mapGestures_category), [LSTRING(mapGestures_category), LSTRING(mapGestures_subcategory_colors)],
[1,0.88,0,0.7], [1,0.88,0,0.7],
false false
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;

View File

@ -66,19 +66,19 @@
<Turkish>Harita Hareketi Max Uzaklık</Turkish> <Turkish>Harita Hareketi Max Uzaklık</Turkish>
</Key> </Key>
<Key ID="STR_ACE_Map_Gestures_maxRange_description"> <Key ID="STR_ACE_Map_Gestures_maxRange_description">
<English>Max range between players to show the map gesture indicator [default: 7 meters]</English> <English>Max range between players to show the map gesture indicator</English>
<Portuguese>Distância max. entre os jogadores para mostrar o indicador de gesto no mapa [padrão: 7 metros]</Portuguese> <Portuguese>Distância max. entre os jogadores para mostrar o indicador de gesto no mapa</Portuguese>
<Polish>Maksymalny zasięg, w obrębie którego gesty będą widoczne dla graczy [domyślnie: 7 metrów]</Polish> <Polish>Maksymalny zasięg, w obrębie którego gesty będą widoczne dla graczy</Polish>
<Russian>Макс. дистанция между игроками для отображения жестов на карте [по-умолчанию: 7 метров]</Russian> <Russian>Макс. дистанция между игроками для отображения жестов на карте</Russian>
<Czech>Maximální vzdálenost mezi hráči pro zobrazení indikátoru ukázání v mapě [výchozí: 7 metrů] </Czech> <Czech>Maximální vzdálenost mezi hráči pro zobrazení indikátoru ukázání v mapě</Czech>
<Italian>Distanza massima tra giocatori per mostrare i gesti in mappa [default: 7 metri]</Italian> <Italian>Distanza massima tra giocatori per mostrare i gesti in mappa</Italian>
<German>Maximale Reichweite zwischen Spielern um Kartenzeichen anzuzeigen (Standard: 7 Meter)</German> <German>Maximale Reichweite zwischen Spielern um Kartenzeichen anzuzeigen</German>
<Spanish>Máxima distancia a la cual pueden verse el indicador de gestos [defecto: 7 m]</Spanish> <Spanish>Máxima distancia a la cual pueden verse el indicador de gestos</Spanish>
<French>Définit le rayon au-delà duquel les joueurs ne verront plus l'indicateur de pointage de leurs alliés. Valeur par défaut : 7 mètres.</French> <French>Définit le rayon au-delà duquel les joueurs ne verront plus l'indicateur de pointage de leurs alliés.</French>
<Japanese>プレイヤーによるマップ ジェスチャーの表示範囲を設定します [標準7 メートル]</Japanese> <Japanese>プレイヤーによるマップ ジェスチャーの表示範囲を設定します</Japanese>
<Korean>플레이어간에 지도 신호 표시거리를 설정합니다. [기본: 7 미터]</Korean> <Korean>플레이어간에 지도 신호 표시거리를 설정합니다.</Korean>
<Chinesesimp>设定地图标识器显示的最大范围距离 [预设: 7公尺]</Chinesesimp> <Chinesesimp>设定地图标识器显示的最大范围距离</Chinesesimp>
<Chinese>設定地圖指示器顯示的最大範圍距離 [預設: 7公尺]</Chinese> <Chinese>設定地圖指示器顯示的最大範圍距離</Chinese>
</Key> </Key>
<Key ID="STR_ACE_Map_Gestures_interval_displayName"> <Key ID="STR_ACE_Map_Gestures_interval_displayName">
<English>Update Interval</English> <English>Update Interval</English>
@ -276,6 +276,69 @@
<Russian>Показывать жесты только от игроков союзной стороны.</Russian> <Russian>Показывать жесты только от игроков союзной стороны.</Russian>
<French>Affiche uniquement les pointages effectués par des unités qui sont du même camp, ou d'un camp allié.</French> <French>Affiche uniquement les pointages effectués par des unités qui sont du même camp, ou d'un camp allié.</French>
</Key> </Key>
<Key ID="STR_ACE_Map_Gestures_maxRangeCamera_displayName">
<English>Max range Camera</English>
</Key>
<Key ID="STR_ACE_Map_Gestures_maxRangeCamera_description">
<English>Max range between a Camera and players to show the map gesture indicator</English>
</Key>
<Key ID="STR_ACE_Map_Gestures_allowSpectator_displayName">
<English>Allow Spectator</English>
</Key>
<Key ID="STR_ACE_Map_Gestures_allowSpectator_description">
<English>Allows Spectator to See Map Gestures</English>
</Key>
<Key ID="STR_ACE_Map_Gestures_allowCurator_displayName">
<English>Allow Curator</English>
</Key>
<Key ID="STR_ACE_Map_Gestures_allowCurator_description">
<English>Allows Curator to See Map Gestures</English>
</Key>
<Key ID="STR_ACE_Map_Gestures_briefingMode_displayName">
<English>Briefing Mode</English>
</Key>
<Key ID="STR_ACE_Map_Gestures_briefingMode_description">
<English>What player can see what</English>
</Key>
<Key ID="STR_ACE_Map_Gestures_briefingMode_Disabled">
<English>Disabled</English>
</Key>
<Key ID="STR_ACE_Map_Gestures_briefingMode_Group">
<English>Group</English>
<Czech>Skupina</Czech>
<French>Groupement</French>
<German>Gruppe</German>
<Italian>Gruppo</Italian>
<Polish>Grupa</Polish>
<Portuguese>Grupo</Portuguese>
<Russian>Группа</Russian>
<Spanish>Grupo</Spanish>
</Key>
<Key ID="STR_ACE_Map_Gestures_briefingMode_Side">
<English>Side</English>
<Czech>Strana</Czech>
<French>Camp</French>
<German>Seite</German>
<Italian>Fazione</Italian>
<Polish>Strona</Polish>
<Portuguese>Lado</Portuguese>
<Russian>Сторона</Russian>
<Spanish>Bando</Spanish>
</Key>
<Key ID="STR_ACE_Map_Gestures_briefingMode_Proximity">
<English>Proximity</English>
</Key>
<Key ID="STR_ACE_Map_Gestures_briefingMode_All">
<English>All</English>
<Czech>Vše</Czech>
<French>Tous</French>
<German>Alle</German>
<Italian>Tutte</Italian>
<Polish>Wszystko</Polish>
<Portuguese>Tudo</Portuguese>
<Russian>Все</Russian>
<Spanish>Todas</Spanish>
</Key>
<Key ID="STR_ACE_Map_Gestures_moduleGroupSettings_displayName"> <Key ID="STR_ACE_Map_Gestures_moduleGroupSettings_displayName">
<English>Map Gestures - Group Settings</English> <English>Map Gestures - Group Settings</English>
<Portuguese>Gestos no mapa - Definições de Grupo</Portuguese> <Portuguese>Gestos no mapa - Definições de Grupo</Portuguese>
@ -307,5 +370,16 @@
<Chinese>ACE 地圖指示器</Chinese> <Chinese>ACE 地圖指示器</Chinese>
<Turkish>ACE Harita Hareketleri</Turkish> <Turkish>ACE Harita Hareketleri</Turkish>
</Key> </Key>
<Key ID="STR_ACE_Map_Gestures_mapGestures_subcategory_colors">
<English>Colors</English>
<Czech>Barvy</Czech>
<French>Couleurs</French>
<German>Farben</German>
<Italian>Colori</Italian>
<Polish>Kolory</Polish>
<Portuguese>Cores</Portuguese>
<Russian>Цвета</Russian>
<Spanish>Colores</Spanish>
</Key>
</Package> </Package>
</Project> </Project>