fn_drawUserMarkers.sqf 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. Name: cTab_fnc_drawUserMarkers
  3. Author(s):
  4. Gundy, Riouken
  5. Description:
  6. Draw userMarkers held in cTabUserMarkerList to map control
  7. List format:
  8. Index 0: ARRAY - marker position
  9. Index 1: STRING - path to marker icon
  10. Index 2: STRING - path to marker size icon
  11. Index 3: STRING - direction of reported movement
  12. Index 4: ARRAY - marker color
  13. Index 5: STRING - marker time
  14. Index 6: STRING - text alignment
  15. Parameters:
  16. 0: OBJECT - Map control to draw BFT icons on
  17. 1: BOOLEAN - Highlight marker under cursor
  18. Returns:
  19. BOOLEAN - Always TRUE
  20. Example:
  21. [_ctrlScreen] call cTab_fnc_drawUserMarkers;
  22. */
  23. private ["_ctrlScreen","_arrowLength","_pos","_secondPos","_texture1","_texture2","_dir","_color","_text","_align","_cursorMarkerIndex","_markerData"];
  24. _ctrlScreen = _this select 0;
  25. _arrowLength = cTabUserMarkerArrowSize * ctrlMapScale _ctrlScreen;
  26. _cursorMarkerIndex = if (_this select 1) then {[_ctrlScreen,cTabMapCursorPos] call cTab_fnc_findUserMarker} else {-1};
  27. {
  28. _markerData = _x select 1;
  29. _pos = _markerData select 0;
  30. _texture1 = _markerData select 1;
  31. _texture2 = _markerData select 2;
  32. _dir = _markerData select 3;
  33. _color = if (_x select 0 != _cursorMarkerIndex) then {_markerData select 4} else {cTabTADhighlightColour};
  34. _text = "";
  35. if (_dir < 360) then {
  36. _secondPos = [_pos,_arrowLength,_dir] call BIS_fnc_relPos;
  37. _ctrlScreen drawArrow [_pos, _secondPos, _color];
  38. };
  39. if (cTabBFTtxt) then {_text = _markerData select 5;};
  40. _ctrlScreen drawIcon [_texture1,_color,_pos, cTabIconSize, cTabIconSize, 0, _text, 0, cTabTxtSize,"TahomaB",_markerData select 6];
  41. if (_texture2 != "") then {
  42. _ctrlScreen drawIcon [_texture2,_color,_pos, cTabGroupOverlayIconSize, cTabGroupOverlayIconSize, 0, "", 0, cTabTxtSize,"TahomaB","right"];
  43. };
  44. } count cTabUserMarkerList;
  45. true