Hodges 10 Posted April 27, 2014 on the curved lines, might think about having it be a three point line placement. first click beginning the curve, the second being the mid point of the curve and the last click being the end of the curve. might also consider having an option (hold left alt and click) to close your line segments in case you were creating on the map. This could be used to designate a route for patrol and then looping it. This would come in handy having multiple fire teams patrol areas, designating their routes in color in the event that their designated patrols overlap or intersect each other. It's just the small detail of closing it that would get under some of our skins. (not being nit-picky) I do like your mod and would like to know if you have a potential release date for the update? I am particularly waiting for the delete option. Share this post Link to post Share on other sites
PVT Watt.J 14 Posted April 27, 2014 I'm thinking about how to effectively implement this. There are potentially a lot of lines that need storing, and in order to delete them, they will also need to be effectively identified. But the feature is certainly on my "wanted" list. Deletion doesn't necessarily involve identification. It can simply be based on location. Define each segment by its endpoints. Then, when the user hits delete: 1. Get coordinates of mouse 2. Loop through all line segments, if line segment passes through a box of arbitrary dimensions centered on the cursor, then delete that segment. Of course, this is more complicated for anything other than nice straight line segments. Share this post Link to post Share on other sites
Alwarren 2767 Posted April 27, 2014 2. Loop through all line segments, if line segment passes through a box of arbitrary dimensions centered on the cursor, then delete that segment. I am not sure how much of a strain that puts on the server communication. I'm thinking of a simple "clear all" function that removes all line segments, that one's not going to too much of a network issue. going through all segments and finding the nearest is potentially going to introduce lag. Share this post Link to post Share on other sites
arziben 23 Posted June 5, 2014 Any news on this wonderful addon ? Share this post Link to post Share on other sites
Alwarren 2767 Posted June 5, 2014 Any news on this wonderful addon ? No, too busy with other stuff ATM Share this post Link to post Share on other sites
terox 316 Posted November 19, 2014 (edited) I am currently working on a server admin tool, as part of that addon i have a system within it that identifies the creator of a marker and the ability to delete that markers from within the GUI. The B.I markers that are created by players when queried return something like "_USER_DEFINED #2/0" All markers placed in the usual manner by players clicking on the map all use this preceding string as part of the marker name #2 denotes their UserID as returned by the admin with #Userlist and by using this i can check through an array and return the creator of the marker. Now a problem arises with your markers as there is no way to track down the creator of the marker in a simple way. I have no problem listing the markers and being able to delete them with the GUI, but I cannot define the creator of the marker. If you are at any time going to rework this addon, would it be possible to add the player's name into the marker name string. Something like _mrk = createMarker [format ["FHQ_mapDraw_%1_%2", name player, FHQ_mapDraw_curretnMarkerName], _realPos]; I could then query the string and filter out the players name and you no longer need the random number generator part of the marker name This simple edit would really help to stop the spamming that can occur with those who have this addon installed. Should you be interested I took the liberty of editing the files and also removed the CBA and extended eventhandler requirements by defining a cfgfunctions preinit Config.cpp #define _ARMA_ class CfgPatches { class FHQ_MapDraw { units[] = {}; weapons[] = {}; requiredAddons[] = {}; author[] = {"Alwarren"}; authorUrl = "http://www.friedenhq.org"; }; }; class CfgFunctions { class FHQ { class MapDraw { class MapDraw_Init { file = "FHQ_MapDraw\preInit.sqf"; preInit = 1; }; }; }; }; class IGUIBack; class RscStructuredText; class RscTitles { class FHQ_mapDraw_GUI { onload = "uinamespace setvariable ['FHQ_mapDraw_GUI',_this select 0];"; moving = "false"; duration = 4; idd = -1; movingEnable = 0; enableSimulation = 1; x = "safeZoneX"; y = "safeZoneY"; w = "safeZoneW"; h = "safeZoneH"; fadein = 0; class ControlsBackground { class IGUIBack_2200: IGUIBack { idc = -1; x = "0.835156 * safezoneW + safezoneX"; y = "0.676 * safezoneH + safezoneY"; w = "0.159844 * safezoneW"; h = "0.077 * safezoneH"; }; class RscStructuredText_1100: RscStructuredText { idc = 10687; x = "0.845469 * safezoneW + safezoneX"; y = "0.687 * safezoneH + safezoneY"; w = "0.139219 * safezoneW"; h = "0.055 * safezoneH"; colorBackground[] = {0,0,0,0}; }; }; }; }; preInit.sqf [] execVM "FHQ_MapDraw\Init.sqf"; Init.sqf #define DIK_ESCAPE 0x01 #define DIK_1 0x02 #define DIK_2 0x03 #define DIK_3 0x04 #define DIK_4 0x05 #define DIK_5 0x06 #define DIK_6 0x07 #define DIK_7 0x08 #define DIK_8 0x09 #define DIK_9 0x0A #define DIK_0 0x0B #define DIK_MINUS 0x0C /* - on main keyboard */ #define DIK_EQUALS 0x0D #define DIK_BACK 0x0E /* backspace */ #define DIK_TAB 0x0F #define DIK_Q 0x10 #define DIK_W 0x11 #define DIK_E 0x12 #define DIK_R 0x13 #define DIK_T 0x14 #define DIK_Y 0x15 #define DIK_U 0x16 #define DIK_I 0x17 #define DIK_O 0x18 #define DIK_P 0x19 #define DIK_LBRACKET 0x1A #define DIK_RBRACKET 0x1B #define DIK_RETURN 0x1C /* Enter on main keyboard */ #define DIK_LCONTROL 0x1D #define DIK_A 0x1E #define DIK_S 0x1F #define DIK_D 0x20 #define DIK_F 0x21 #define DIK_G 0x22 #define DIK_H 0x23 #define DIK_J 0x24 #define DIK_K 0x25 #define DIK_L 0x26 #define DIK_SEMICOLON 0x27 #define DIK_APOSTROPHE 0x28 #define DIK_GRAVE 0x29 /* accent grave */ #define DIK_LSHIFT 0x2A #define DIK_BACKSLASH 0x2B #define DIK_Z 0x2C #define DIK_X 0x2D #define DIK_C 0x2E #define DIK_V 0x2F #define DIK_B 0x30 #define DIK_N 0x31 #define DIK_M 0x32 #define DIK_COMMA 0x33 #define DIK_PERIOD 0x34 /* . on main keyboard */ #define DIK_SLASH 0x35 /* / on main keyboard */ #define DIK_RSHIFT 0x36 #define DIK_MULTIPLY 0x37 /* * on numeric keypad */ #define DIK_LMENU 0x38 /* left Alt */ #define DIK_SPACE 0x39 #define DIK_CAPITAL 0x3A #define DIK_F1 0x3B #define DIK_F2 0x3C #define DIK_F3 0x3D #define DIK_F4 0x3E #define DIK_F5 0x3F #define DIK_F6 0x40 #define DIK_F7 0x41 #define DIK_F8 0x42 #define DIK_F9 0x43 #define DIK_F10 0x44 #define DIK_NUMLOCK 0x45 #define DIK_SCROLL 0x46 /* Scroll Lock */ #define DIK_NUMPAD7 0x47 #define DIK_NUMPAD8 0x48 #define DIK_NUMPAD9 0x49 #define DIK_SUBTRACT 0x4A /* - on numeric keypad */ #define DIK_NUMPAD4 0x4B #define DIK_NUMPAD5 0x4C #define DIK_NUMPAD6 0x4D #define DIK_ADD 0x4E /* + on numeric keypad */ #define DIK_NUMPAD1 0x4F #define DIK_NUMPAD2 0x50 #define DIK_NUMPAD3 0x51 #define DIK_NUMPAD0 0x52 #define DIK_DECIMAL 0x53 /* . on numeric keypad */ #define DIK_OEM_102 0x56 /* < > | on UK/Germany keyboards */ #define DIK_F11 0x57 #define DIK_NUMPADENTER 0x9C /* Enter on numeric keypad */ #define DIK_HOME 0xC7 /* Home on arrow keypad */ #define DIK_UP 0xC8 /* UpArrow on arrow keypad */ #define DIK_PRIOR 0xC9 /* PgUp on arrow keypad */ #define DIK_LEFT 0xCB /* LeftArrow on arrow keypad */ #define DIK_RIGHT 0xCD /* RightArrow on arrow keypad */ #define DIK_END 0xCF /* End on arrow keypad */ #define DIK_DOWN 0xD0 /* DownArrow on arrow keypad */ #define DIK_NEXT 0xD1 /* PgDn on arrow keypad */ #define DIK_INSERT 0xD2 /* Insert on arrow keypad */ #define DIK_DELETE 0xD3 /* Delete on arrow keypad */ #define DIK_UPARROW DIK_UP /* UpArrow on arrow keypad */ #define DIK_PGUP DIK_PRIOR /* PgUp on arrow keypad */ #define DIK_LEFTARROW DIK_LEFT /* LeftArrow on arrow keypad */ #define DIK_RIGHTARROW DIK_RIGHT /* RightArrow on arrow keypad */ #define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */ #define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */ #define IDC_MAPDRAW_DRAWMODE 4280 #define IDC_MAPDRAW_COLOR 4281 #define DRAW_KEY DIK_LCONTROL #define COLOR_UP DIK_RIGHT #define COLOR_DOWN DIK_LEFT #define SHAPE_UP DIK_UP #define SHAPE_DOWN DIK_DOWN #define WIDTH_UP DIK_PRIOR #define WIDTH_DOWN DIK_NEXT //#define IDC_BACKGROUND 1124 //#define IDC_FOREGROUND 1125 FHQ_mapdraw_fnc_vectdir = { private ["_angle"]; _angle = ((_this select 0) atan2 (_this select 1)); while {_angle < 0} do { _angle = _angle + 360; }; if (_angle > 360) then {_angle = _angle mod 360}; _angle }; FHQ_mapDraw_setTooltip = { private ["_xx", "_yy", "_ww", "_hh", "_text", "_idd", "_tooltip", "_tooltip_back"]; _text = _this select 0; _idd = _this select 1; disableSerialization; _display = findDisplay _idd; _tooltip = _display displayctrl 2350; _tooltipBackground = _display displayctrl 235000; _tooltipInfoBackground = _display displayctrl 235001; _tooltipText = _display displayctrl 235002; _tooltipAssetsBackground = _display displayctrl 235003; _tooltipAssets = _display displayctrl 235004; _tooltipPictureBackground = _display displayctrl 235005; _tooltipPicture = _display displayctrl 235006; if (_text != "") then { _xx = 0.835156 * safezoneW + safezoneX; _yy = 0.676 * safezoneH + safezoneY; _ww = 0.159844 * safezoneW; //_hh = 0.15; //0.077 * safezoneH; _tooltipText ctrlsetstructuredtext parsetext format ["<t align=""center"">%1</t>", _text]; _hh = ctrltextheight _tooltipText + 0.0005; _tooltip ctrlenable false; _tooltip ctrlsetposition [ _xx, _yy, _ww, _hh ]; _tooltip ctrlsetfade 0; _tooltip ctrlcommit 0; _tooltipInfoBackground ctrlsetposition [ 0,0,0,0 ]; _tooltipInfoBackground ctrlcommit 0; //--- Set text _tooltipText ctrlsetposition [ 0, 0, _ww, _hh ]; _tooltipText ctrlcommit 0; _tooltipBackground ctrlsetposition [ 0, 0, _ww, _hh ]; _tooltipBackground ctrlcommit 0; _tooltipPictureBackground ctrlsetposition [1,1,1,1]; _tooltipPictureBackground ctrlcommit 0; _tooltipPicture ctrlsettext ""; } else { _tooltip ctrlsetposition [ -1, -1, 0, 0 ]; _tooltip ctrlSetFade 1; _tooltip ctrlcommit 0; }; }; FHQ_mapDraw_notifyTask = { [_this, 12] call FHQ_mapDraw_setToolTip; [_this, FHQ_mapDraw_readyIDD] call FHQ_mapDraw_setToolTip; FHQ_mapDraw_endTime = time + 2; waitUntil { sleep 0.2; time > FHQ_mapDraw_endTime;}; ["", 12] call FHQ_mapDraw_setToolTip; ["", FHQ_mapDraw_readyIDD] call FHQ_mapDraw_setToolTip; FHQ_mapDraw_endTime = -1; }; FHQ_mapDraw_notify = { if (FHQ_mapDraw_endTime >= 0) then { [_this, 12] call FHQ_mapDraw_setToolTip; [_this, FHQ_mapDraw_readyIDD] call FHQ_mapDraw_setToolTip; FHQ_mapDraw_endTime = time + 2; } else { _this spawn FHQ_mapDraw_notifyTask; }; // Will queue up when in briefing.... playSound "Click"; }; /* * Called with: * _this select 0: Start position * _this select 1: End position * _this select 2: Color * _this select 3: Width */ FHQ_mapDraw_createMarkerLine = { private ["_tmp", "_start", "_end", "_realPos", "_color", "_width", "_mrk", "_length", "_angle"]; _start = _this select 0; _end = _this select 1; _color = _this select 2; _width = [_this, 3, FHQ_mapDraw_currentWidth] call BIS_fnc_param; _realPos = [ ((_start select 0) + (_end select 0)) / 2, ((_start select 1) + (_end select 1)) / 2, ((_start select 2) + (_end select 2)) / 2 ]; _tmp = [ ((_end select 0) - (_start select 0)), ((_end select 1) - (_start select 1)) ]; _length = (_tmp select 0) * (_tmp select 0) + (_tmp select 1) * (_tmp select 1); _length = sqrt _length; _angle = _tmp call FHQ_mapdraw_fnc_vectdir; _mrk = createMarker [format ["FHQ_mapDraw_%1_%2", name player, FHQ_mapDraw_curretnMarkerName], _realPos]; FHQ_mapDraw_curretnMarkerName = FHQ_mapDraw_curretnMarkerName + 1; _mrk setMarkerShape "RECTANGLE"; _mrk setMarkerSize [_width, _length/2]; _mrk setMarkerDir _angle; _mrk setMarkerColor _color; }; FHQ_mapDraw_mouseMove = { private ["_control", "_xPos", "_yPos", "_start", "_end"]; //player sideChat format ["mouseMove: %1",_this]; _control = _this select 0; _xPos = _this select 1; _yPos = _this select 2; if (FHQ_mapDraw_drawing) then { FHQ_mapDraw_currentDrawEnd = _control ctrlMapScreenToWorld [_xPos, _yPos]; }; }; FHQ_mapDraw_key = { private ["_dir", "_control", "_code", "_ctrlKey", "_map", "_handled"]; _dir = _this select 0; _conrol = (_this select 1) select 0; _code = (_this select 1) select 1; _ctrlKey = (_this select 1) select 3; _map = ((finddisplay 12) displayctrl 51); _handled = false; //player sideChat format ["_dir = %1, _ctrlKey = %2, _code %3", _dir, _ctrlKey, _code]; if (_code == DRAW_KEY) then { if (_dir == 0) then { private "_dlg"; FHQ_mapDraw_currentDrawEnd = []; FHQ_mapDraw_currentDrawStart = []; FHQ_mapDraw_drawing = false; "End drawing" call FHQ_mapDraw_notify; } else { if (!FHQ_mapDraw_drawing) then { private "_string"; _string = format ["Line Drawing<br/>Color: %1<br/>Width: %2", (FHQ_mapDraw_Colors select FHQ_mapDraw_currentColor) select 2, FHQ_mapDraw_currentWidth]; _string call FHQ_mapDraw_notify; }; FHQ_mapDraw_drawing = true; }; _handled = true; }; if (_ctrlKey && _dir == 1) then { if (_code == COLOR_UP) then { FHQ_mapDraw_currentColor = FHQ_mapDraw_currentColor + 1; if (FHQ_mapDraw_currentColor == 7) then { FHQ_mapDraw_currentColor = 0; }; format ["Color: %1", (FHQ_mapDraw_Colors select FHQ_mapDraw_currentColor) select 2] call FHQ_mapDraw_notify; }; if (_code == COLOR_DOWN) then { FHQ_mapDraw_currentColor = FHQ_mapDraw_currentColor - 1; if (FHQ_mapDraw_currentColor == 0) then { FHQ_mapDraw_currentColor = 6; }; format ["Color: %1", (FHQ_mapDraw_Colors select FHQ_mapDraw_currentColor) select 2] call FHQ_mapDraw_notify; }; if (_code == WIDTH_UP) then { FHQ_mapDraw_currentWidth = FHQ_mapDraw_currentWidth + 1; format ["Line Width: %1", FHQ_mapDraw_currentWidth] call FHQ_mapDraw_notify; }; if (_code == WIDTH_DOWN) then { FHQ_mapDraw_currentWidth = FHQ_mapDraw_currentWidth - 1; if (FHQ_mapDraw_currentWidth < 1) then { FHQ_mapDraw_currentWidth = 1; }; format ["Line Width: %1", FHQ_mapDraw_currentWidth] call FHQ_mapDraw_notify; }; }; _handled }; FHQ_mapDraw_mouseButton = { private ["_dir", "_control", "_button", "_xPos", "_yPos", "_handled"]; _dir = _this select 0; _control = (_this select 1) select 0; _button = (_this select 1) select 1; _xPos = (_this select 1) select 2; _yPos = (_this select 1) select 3; _ctrlKey = (_this select 1) select 5; _handled = false; if (_button != 0) exitWith {false}; if (FHQ_mapDraw_drawing) then { // While drawing, every mouse click draws a new element while ctrl is pressed if (_dir == 1) then { if (count FHQ_mapDraw_currentDrawStart > 0 && count FHQ_mapDraw_currentDrawEnd > 0) then { [FHQ_mapDraw_currentDrawStart, FHQ_mapDraw_currentDrawEnd, (FHQ_mapDraw_Colors select FHQ_mapDraw_currentColor) select 1 ] call FHQ_mapDraw_createMarkerLine; }; FHQ_mapDraw_currentDrawStart = FHQ_mapDraw_currentDrawEnd; }; } else { if (_dir == 1 && _ctrlKey) then { // Start a drawing operation FHQ_mapDraw_currentDrawStart = _control ctrlMapScreenToWorld [_xPos, _yPos]; FHQ_mapDraw_drawing = true; }; }; _handled }; FHQ_mapDraw_draw = { _control = _this select 0; if (FHQ_mapDraw_drawing && count FHQ_mapDraw_currentDrawStart > 0 && count FHQ_mapDraw_currentDrawEnd > 0) then { //player sideChat format ["%1 - %2", FHQ_mapDraw_currentDrawStart, FHQ_mapDraw_currentDrawEnd]; _control drawLine [FHQ_mapDraw_currentDrawStart, FHQ_mapDraw_currentDrawEnd, (FHQ_mapDraw_Colors select FHQ_mapDraw_currentColor) select 0 ]; }; }; FHQ_mapDraw_currentDrawStart = []; FHQ_mapDraw_currentDrawEnd = []; FHQ_mapDraw_curretnMarkerName = 0; FHQ_mapDraw_drawing = false; FHQ_mapDraw_currentWidth = 1; FHQ_mapDraw_Colors = [ [[0,0,0,1], "ColorBlack", "black"], [[1,0,0,1], "ColorRed", "red"], [[0,1,0,1], "ColorGreen", "green"], [[0,0,1,1], "ColorBlue", "blue"], [[1,1,0,1], "ColorYellow", "yellow"], [[1, 0.5, 0,1], "ColorOrange", "orange"], [[1,1,1,1], "ColorWhite", "white"] ]; FHQ_mapDraw_currentColor = 0; FHQ_mapDraw_endTime = -1; /******************************** Okay, this took me a while to figure out. During the game, the IDD for the map screen is 12. However, the briefing is different, since it has the additional buttons to cancel and continue, so they are using different displays for that. And to make it even worse, it is different whether you are the server or the client. So: display 12 is the ingame map. display 52 is IDD_SERVER_GET_READY (Server-side briefing) display 53 is IDD_CLIENT_GET_READY (Client-side briefing) So here's how we do it: Depending on whether we are server or client, use _idd to wait for a specific display or display 12. If _idd display is non-null, install our handlers there. Wait for display 12 to become ready install our handlers there, too. */ #define IDD_SERVER_GET_READY 52 #define IDD_CLIENT_GET_READY 53 #define IDD_MAIN_MAP 12 #define IDC_MAP 51 private ["_idd"]; _idd = IDD_CLIENT_GET_READY; if (isserver && ismultiplayer) then { _idd = IDD_SERVER_GET_READY; }; waitUntil { !(isNull (findDisplay _idd)) || !(isNull (findDisplay IDD_MAIN_MAP)) }; if (!isNull (findDisplay _idd)) then { // Install on get ready screen ((findDisplay _idd) displayctrl IDC_MAP) ctrlAddEventHandler ["draw", {_this call FHQ_mapDraw_draw;}]; ((finddisplay _idd) displayctrl IDC_MAP) ctrlAddEventHandler ["mousemoving", {_this call FHQ_mapDraw_mouseMove;}]; ((finddisplay _idd) displayctrl IDC_MAP) ctrlAddEventHandler ["mousebuttondown", {[1, _this] call FHQ_mapDraw_mouseButton;}]; ((finddisplay _idd) displayctrl IDC_MAP)ctrlAddEventHandler ["mousebuttonup", {[0, _this] call FHQ_mapDraw_mouseButton;}]; (finddisplay _idd) displayAddEventHandler ["keydown", {[1, _this] call FHQ_mapDraw_key;}]; (finddisplay _idd) displayAddEventHandler ["keyup", {[0, _this] call FHQ_mapDraw_key;}]; }; FHQ_mapDraw_readyIDD = _idd; waitUntil { !(isNull (findDisplay IDD_MAIN_MAP)) }; // Install on main map screen ((findDisplay IDD_MAIN_MAP) displayctrl IDC_MAP) ctrlAddEventHandler ["draw", {_this call FHQ_mapDraw_draw;}]; ((finddisplay IDD_MAIN_MAP) displayctrl IDC_MAP) ctrlAddEventHandler ["mousemoving", {_this call FHQ_mapDraw_mouseMove;}]; ((finddisplay IDD_MAIN_MAP) displayctrl IDC_MAP) ctrlAddEventHandler ["mousebuttondown", {[1, _this] call FHQ_mapDraw_mouseButton;}]; ((finddisplay IDD_MAIN_MAP) displayctrl IDC_MAP)ctrlAddEventHandler ["mousebuttonup", {[0, _this] call FHQ_mapDraw_mouseButton;}]; (finddisplay IDD_MAIN_MAP) displayAddEventHandler ["keydown", {[1, _this] call FHQ_mapDraw_key;}]; (finddisplay IDD_MAIN_MAP) displayAddEventHandler ["keyup", {[0, _this] call FHQ_mapDraw_key;}]; apart from the BiKey, thats good to go, tested etc Edited November 21, 2014 by Terox Share this post Link to post Share on other sites
Alwarren 2767 Posted November 19, 2014 Ah, actually, I have a new version ready for release since some time now that has the ability to delete lines. I'll take a look at your code and see what I can do before I release it :) Share this post Link to post Share on other sites
terox 316 Posted November 19, 2014 I messed up with the CBA, it requires CBA_fnc_vectDir However that could easily be imported then you dont have a CBA dependancy. The most important line is just simply adding the players name to the markername. Simply listing the markers then gives you all the info you need. Thanks for the reply Share this post Link to post Share on other sites
terox 316 Posted November 21, 2014 (edited) This is an exported working version of the CBA function that is called from the init.sqf. (I updated the init.sqf in my preceding post, now it's completely CBA free. FHQ_mapdraw_fnc_vectdir = { private ["_angle"]; _angle = ((_this select 0) atan2 (_this select 1)); while {_angle < 0} do { _angle = _angle + 360; }; if (_angle > 360) then {_angle = _angle mod 360}; _angle }; Edited November 21, 2014 by Terox Share this post Link to post Share on other sites
terox 316 Posted April 14, 2015 any news on this update ? Share this post Link to post Share on other sites
--mastermind-- 10 Posted April 14, 2015 whoa. this was indeed special...hope to hear back from it! Share this post Link to post Share on other sites
Alwarren 2767 Posted April 15, 2015 Sorry for the silence around this mod, too much going on right now. I plan to overhaul the UI significantly for the next release, which I hope won't be too long. Send from my tablet, so pardon any autocorrect bollocks Share this post Link to post Share on other sites
domokun 515 Posted January 17, 2016 Hey mate, I realise that you're often busy but any news? Share this post Link to post Share on other sites
Alwarren 2767 Posted January 17, 2016 Hey mate, I realise that you're often busy but any news? Not yet, too much stuff going on. I really need to find the time to tie up a few lose ends here and there, but CUP right now is my number one time eater. Share this post Link to post Share on other sites