mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add the ability to edit user placed markers (#6564)
* add the ability to edit user placed markers * remove direct channel from valid channels * add author * optimize get map display replace old method of getting the map display with displayParent * optimize code by adding isEqualTo * correct some spelling mistakes
This commit is contained in:
parent
75f8a35d3d
commit
7988622635
@ -130,6 +130,7 @@ System98
|
|||||||
SzwedzikPL <szwedzikpl@gmail.com>
|
SzwedzikPL <szwedzikpl@gmail.com>
|
||||||
Tachi <zaveruha007@gmail.com>
|
Tachi <zaveruha007@gmail.com>
|
||||||
Tessa Elieff <Fastroping Sound - CreativeCommons Attributions 3.0>
|
Tessa Elieff <Fastroping Sound - CreativeCommons Attributions 3.0>
|
||||||
|
Timi007 <timi007@gmx.net>
|
||||||
Toaster <jonathan.pereira@gmail.com>
|
Toaster <jonathan.pereira@gmail.com>
|
||||||
Tonic
|
Tonic
|
||||||
Tourorist <tourorist@gmail.com>
|
Tourorist <tourorist@gmail.com>
|
||||||
|
@ -17,11 +17,12 @@ if (isNil QGVAR(MarkersCache)) then {
|
|||||||
for "_a" from 0 to (count _config - 1) do {
|
for "_a" from 0 to (count _config - 1) do {
|
||||||
private _marker = _config select _a;
|
private _marker = _config select _a;
|
||||||
|
|
||||||
if (getNumber (_marker >> "scope") == 2) then {
|
if (getNumber (_marker >> "scope") isEqualTo 2) then {
|
||||||
|
private _class = configName _marker;
|
||||||
private _name = getText (_marker >> "name");
|
private _name = getText (_marker >> "name");
|
||||||
private _icon = getText (_marker >> "icon");
|
private _icon = getText (_marker >> "icon");
|
||||||
|
|
||||||
GVAR(MarkersCache) pushBack [_name, _a, _icon];
|
GVAR(MarkersCache) pushBack [_name, _a, _icon, _class];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -35,7 +36,8 @@ if (isNil QGVAR(MarkerColorsCache)) then {
|
|||||||
for "_a" from 0 to (count _config - 1) do {
|
for "_a" from 0 to (count _config - 1) do {
|
||||||
private _marker = _config select _a;
|
private _marker = _config select _a;
|
||||||
|
|
||||||
if (getNumber (_marker >> "scope") == 2) then {
|
if (getNumber (_marker >> "scope") isEqualTo 2) then {
|
||||||
|
private _class = configName _marker;
|
||||||
private _name = getText (_marker >> "name");
|
private _name = getText (_marker >> "name");
|
||||||
private _rgba = getArray (_marker >> "color");
|
private _rgba = getArray (_marker >> "color");
|
||||||
|
|
||||||
@ -48,7 +50,7 @@ if (isNil QGVAR(MarkerColorsCache)) then {
|
|||||||
_rgba params ["_red", "_green", "_blue", "_alpha"];
|
_rgba params ["_red", "_green", "_blue", "_alpha"];
|
||||||
private _icon = format ["#(argb,8,8,3)color(%1,%2,%3,%4)", _red, _green, _blue, _alpha];
|
private _icon = format ["#(argb,8,8,3)color(%1,%2,%3,%4)", _red, _green, _blue, _alpha];
|
||||||
|
|
||||||
GVAR(MarkerColorsCache) pushBack [_name, _a, _icon];
|
GVAR(MarkerColorsCache) pushBack [_name, _a, _icon, _class];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2, Timi007
|
||||||
* Return enabled channels.
|
* Return enabled channels.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -40,12 +40,8 @@ if (_localize) then {
|
|||||||
if (setCurrentChannel 4) then {
|
if (setCurrentChannel 4) then {
|
||||||
_enabledChannels pushBack localize "str_channel_vehicle";
|
_enabledChannels pushBack localize "str_channel_vehicle";
|
||||||
};
|
};
|
||||||
|
|
||||||
if (setCurrentChannel 5) then {
|
|
||||||
_enabledChannels pushBack localize "str_channel_direct";
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
for "_i" from 0 to 5 do {
|
for "_i" from 0 to 4 do {
|
||||||
if (setCurrentChannel _i) then {
|
if (setCurrentChannel _i) then {
|
||||||
_enabledChannels pushBack _i;
|
_enabledChannels pushBack _i;
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Author: BIS, commy2
|
* Author: BIS, commy2, Timi007
|
||||||
* Sets up the marker placement
|
* Sets up the marker placement
|
||||||
* Run instead of \a3\ui_f\scripts\GUI\RscDisplayInsertMarker.sqf
|
* Run instead of \a3\ui_f\scripts\GUI\RscDisplayInsertMarker.sqf
|
||||||
*
|
*
|
||||||
@ -46,32 +46,39 @@
|
|||||||
private _aceAngleSlider = _display displayctrl 1220;
|
private _aceAngleSlider = _display displayctrl 1220;
|
||||||
private _aceAngleSliderText = _display displayctrl 1221;
|
private _aceAngleSliderText = _display displayctrl 1221;
|
||||||
|
|
||||||
|
private _mapDisplay = displayParent _display;
|
||||||
|
if (isNull _mapDisplay) exitWith {ERROR("No Map");};
|
||||||
|
private _mapCtrl = _mapDisplay displayCtrl 51;
|
||||||
|
|
||||||
|
GVAR(editingMarker) = "";
|
||||||
|
(ctrlMapMouseOver _mapCtrl) params ["_mouseOverType", "_marker"];
|
||||||
|
|
||||||
|
//check if entity under mouse is a user marker
|
||||||
|
if (_mouseOverType isEqualTo "marker") then {
|
||||||
|
if !((_marker find "_USER_DEFINED") isEqualTo -1) then {
|
||||||
|
GVAR(editingMarker) = _marker;
|
||||||
|
//hide marker which is being edited because if the user cancels editing, it will still exist unchanged
|
||||||
|
GVAR(editingMarker) setMarkerAlphaLocal 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
// Install MapDrawEH on current map
|
// Install MapDrawEH on current map
|
||||||
private _mapIDD = -1;
|
if !((ctrlIDD _mapDisplay) in GVAR(mapDisplaysWithDrawEHs)) then {
|
||||||
|
GVAR(mapDisplaysWithDrawEHs) pushBack (ctrlIDD _mapDisplay);
|
||||||
{
|
_mapCtrl ctrlAddEventHandler ["Draw", {_this call FUNC(mapDrawEH)}]; // @todo check if persistent
|
||||||
if (!isNull (findDisplay _x)) exitWith {
|
|
||||||
_mapIDD = _x;
|
|
||||||
};
|
|
||||||
false
|
|
||||||
} count [12, 37, 52, 53, 160];
|
|
||||||
|
|
||||||
if (_mapIDD == -1) exitWith {
|
|
||||||
ERROR("No Map?");
|
|
||||||
};
|
|
||||||
|
|
||||||
if !(_mapIDD in GVAR(mapDisplaysWithDrawEHs)) then {
|
|
||||||
GVAR(mapDisplaysWithDrawEHs) pushBack _mapIDD;
|
|
||||||
((finddisplay _mapIDD) displayctrl 51) ctrlAddEventHandler ["Draw", {_this call FUNC(mapDrawEH)}]; // @todo check if persistent
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
// Calculate center position of the marker placement ctrl
|
// Calculate center position of the marker placement ctrl
|
||||||
|
if !(GVAR(editingMarker) isEqualTo "") then {
|
||||||
|
//prevent changing the original marker position
|
||||||
|
GVAR(currentMarkerPosition) = markerPos GVAR(editingMarker);
|
||||||
|
} else {
|
||||||
private _pos = ctrlPosition _picture;
|
private _pos = ctrlPosition _picture;
|
||||||
_pos = [(_pos select 0) + (_pos select 2) / 2, (_pos select 1) + (_pos select 3) / 2];
|
_pos = [(_pos select 0) + (_pos select 2) / 2, (_pos select 1) + (_pos select 3) / 2];
|
||||||
|
GVAR(currentMarkerPosition) = _mapCtrl ctrlMapScreenToWorld _pos;
|
||||||
GVAR(currentMarkerPosition) = ((findDisplay _mapIDD) displayCtrl 51) ctrlMapScreenToWorld _pos;
|
};
|
||||||
|
|
||||||
//Hide the bis picture:
|
//Hide the bis picture:
|
||||||
_picture ctrlShow false;
|
_picture ctrlShow false;
|
||||||
@ -79,12 +86,16 @@
|
|||||||
// prevent vanilla key input
|
// prevent vanilla key input
|
||||||
_display displayAddEventHandler ["KeyDown", {(_this select 1) in [200, 208]}];
|
_display displayAddEventHandler ["KeyDown", {(_this select 1) in [200, 208]}];
|
||||||
|
|
||||||
|
if !((markerText GVAR(editingMarker)) isEqualTo "") then {
|
||||||
|
//fill text input with text from marker which is being edited
|
||||||
|
_text ctrlSetText (markerText GVAR(editingMarker));
|
||||||
|
};
|
||||||
|
|
||||||
//Focus on the text input
|
//Focus on the text input
|
||||||
ctrlSetFocus _text;
|
ctrlSetFocus _text;
|
||||||
|
|
||||||
//--- Background
|
//--- Background
|
||||||
_pos = ctrlposition _text;
|
private _pos = ctrlposition _text;
|
||||||
_pos params ["_posX", "_posY", "_posW", "_posH"];
|
_pos params ["_posX", "_posY", "_posW", "_posH"];
|
||||||
_posX = _posX + 0.01;
|
_posX = _posX + 0.01;
|
||||||
_posY = _posY min ((safeZoneH + safeZoneY) - (8 * _posH + 8 * BORDER)); //prevent buttons being placed below bottom edge of screen
|
_posY = _posY min ((safeZoneH + safeZoneY) - (8 * _posH + 8 * BORDER)); //prevent buttons being placed below bottom edge of screen
|
||||||
@ -161,12 +172,20 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
private _currentChannelName = CHANNEL_NAMES param [currentChannel, localize "str_channel_group"];
|
private _selectChannel = if !(GVAR(editingMarker) isEqualTo "") then {
|
||||||
|
//get the channel where the marker was placed in
|
||||||
|
parseNumber ((GVAR(editingMarker) splitString "/") param [2, "3"])
|
||||||
|
} else {
|
||||||
|
currentChannel
|
||||||
|
};
|
||||||
|
|
||||||
|
private _currentChannelName = CHANNEL_NAMES param [_selectChannel, localize "str_channel_group"];
|
||||||
|
|
||||||
// select current channel in list box, must be done after lbDelete
|
// select current channel in list box, must be done after lbDelete
|
||||||
for "_j" from 0 to (lbSize _channel - 1) do {
|
for "_j" from 0 to (lbSize _channel - 1) do {
|
||||||
if (_channel lbText _j == _currentChannelName) then {
|
if (_channel lbText _j == _currentChannelName) then {
|
||||||
_channel lbSetCurSel _j;
|
_channel lbSetCurSel _j;
|
||||||
|
setCurrentChannel (CHANNEL_NAMES find _currentChannelName);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -198,10 +217,15 @@
|
|||||||
// init marker shape lb
|
// init marker shape lb
|
||||||
lbClear _aceShapeLB;
|
lbClear _aceShapeLB;
|
||||||
{
|
{
|
||||||
_x params ["_add", "_set", "_pic"];
|
_x params ["_add", "_set", "_pic", "_classname"];
|
||||||
_aceShapeLB lbAdd _add;
|
_aceShapeLB lbAdd _add;
|
||||||
_aceShapeLB lbSetValue [_forEachIndex, _set];
|
_aceShapeLB lbSetValue [_forEachIndex, _set];
|
||||||
_aceShapeLB lbSetPicture [_forEachIndex, _pic];
|
_aceShapeLB lbSetPicture [_forEachIndex, _pic];
|
||||||
|
|
||||||
|
if ((markerType GVAR(editingMarker)) isEqualTo _classname) then {
|
||||||
|
//if the marker is being edited then get the original shape
|
||||||
|
GVAR(curSelMarkerShape) = _forEachIndex;
|
||||||
|
};
|
||||||
} forEach GVAR(MarkersCache);
|
} forEach GVAR(MarkersCache);
|
||||||
|
|
||||||
private _curSelShape = GETGVAR(curSelMarkerShape,0);
|
private _curSelShape = GETGVAR(curSelMarkerShape,0);
|
||||||
@ -215,10 +239,15 @@
|
|||||||
// init marker color lb
|
// init marker color lb
|
||||||
lbClear _aceColorLB;
|
lbClear _aceColorLB;
|
||||||
{
|
{
|
||||||
_x params ["_add", "_set", "_pic"];
|
_x params ["_add", "_set", "_pic", "_classname"];
|
||||||
_aceColorLB lbAdd _add;
|
_aceColorLB lbAdd _add;
|
||||||
_aceColorLB lbSetValue [_forEachIndex, _set];
|
_aceColorLB lbSetValue [_forEachIndex, _set];
|
||||||
_aceColorLB lbSetPicture [_forEachIndex, _pic];
|
_aceColorLB lbSetPicture [_forEachIndex, _pic];
|
||||||
|
|
||||||
|
if ((markerColor GVAR(editingMarker)) isEqualTo _classname) then {
|
||||||
|
//if the marker is being edited then get the original color
|
||||||
|
GVAR(curSelMarkerColor) = _forEachIndex;
|
||||||
|
};
|
||||||
} forEach GVAR(MarkerColorsCache);
|
} forEach GVAR(MarkerColorsCache);
|
||||||
|
|
||||||
private _curSelColor = GETGVAR(curSelMarkerColor,0);
|
private _curSelColor = GETGVAR(curSelMarkerColor,0);
|
||||||
@ -232,6 +261,11 @@
|
|||||||
// init marker angle slider
|
// init marker angle slider
|
||||||
_aceAngleSlider sliderSetRange [-180, 180];
|
_aceAngleSlider sliderSetRange [-180, 180];
|
||||||
|
|
||||||
|
if !(GVAR(editingMarker) isEqualTo "") then {
|
||||||
|
//get the original direction
|
||||||
|
GVAR(currentMarkerAngle) = markerDir GVAR(editingMarker);
|
||||||
|
};
|
||||||
|
|
||||||
private _curSelAngle = GETGVAR(currentMarkerAngle,0);
|
private _curSelAngle = GETGVAR(currentMarkerAngle,0);
|
||||||
_aceAngleSlider sliderSetPosition _curSelAngle;
|
_aceAngleSlider sliderSetPosition _curSelAngle;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2, Timi007
|
||||||
* MarkerPlacement closed
|
* MarkerPlacement closed
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -20,7 +20,11 @@ disableserialization;
|
|||||||
params ["_display", "_closeNum"];
|
params ["_display", "_closeNum"];
|
||||||
TRACE_2("params",_display,_closeNum);
|
TRACE_2("params",_display,_closeNum);
|
||||||
|
|
||||||
if (_closeNum == 1) then {
|
if (_closeNum isEqualTo 1) then {
|
||||||
|
if !(GVAR(editingMarker) isEqualTo "") then {
|
||||||
|
//delete "old" marker
|
||||||
|
deleteMarker GVAR(editingMarker);
|
||||||
|
};
|
||||||
// set and send marker data the next frame. the actual marker isn't created yet
|
// set and send marker data the next frame. the actual marker isn't created yet
|
||||||
[{
|
[{
|
||||||
[QGVAR(setMarkerNetwork), [
|
[QGVAR(setMarkerNetwork), [
|
||||||
@ -33,4 +37,11 @@ if (_closeNum == 1) then {
|
|||||||
]] call CBA_fnc_globalEvent;
|
]] call CBA_fnc_globalEvent;
|
||||||
|
|
||||||
}, []] call CBA_fnc_execNextFrame;
|
}, []] call CBA_fnc_execNextFrame;
|
||||||
|
} else {
|
||||||
|
if !(GVAR(editingMarker) isEqualTo "") then {
|
||||||
|
//editing was canceled show the original marker again
|
||||||
|
GVAR(editingMarker) setMarkerAlphaLocal 1;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
GVAR(editingMarker) = "";
|
||||||
|
@ -21,8 +21,7 @@
|
|||||||
localize "str_channel_side", \
|
localize "str_channel_side", \
|
||||||
localize "str_channel_command", \
|
localize "str_channel_command", \
|
||||||
localize "str_channel_group", \
|
localize "str_channel_group", \
|
||||||
localize "str_channel_vehicle", \
|
localize "str_channel_vehicle" \
|
||||||
localize "str_channel_direct" \
|
|
||||||
]
|
]
|
||||||
|
|
||||||
#define MOVE_RESTRICTION_NOBODY -1
|
#define MOVE_RESTRICTION_NOBODY -1
|
||||||
|
Loading…
Reference in New Issue
Block a user