diff --git a/AUTHORS.txt b/AUTHORS.txt index 402b13b8e63..d6ad6c67afb 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -167,3 +167,4 @@ xrufix Zakant zGuba Fyuran +Frank diff --git a/addons/markers/InsertMarker.hpp b/addons/markers/InsertMarker.hpp index ed2d562220d..9dd8005ce05 100644 --- a/addons/markers/InsertMarker.hpp +++ b/addons/markers/InsertMarker.hpp @@ -35,5 +35,11 @@ class RscDisplayInsertMarker { class MarkerAngleText: RscText { idc = IDC_ACE_INSERT_MARKER_ANGLE_TEXT; }; + class MarkerScale: RscXSliderH { + idc = IDC_ACE_INSERT_MARKER_SCALE; + }; + class MarkerScaleText: RscText { + idc = IDC_ACE_INSERT_MARKER_SCALE_TEXT; + }; }; }; diff --git a/addons/markers/XEH_PREP.hpp b/addons/markers/XEH_PREP.hpp index 9d358e2f8ab..02214231ecb 100644 --- a/addons/markers/XEH_PREP.hpp +++ b/addons/markers/XEH_PREP.hpp @@ -6,6 +6,7 @@ PREP(onLBSelChangedChannel); PREP(onLBSelChangedColor); PREP(onLBSelChangedShape); PREP(onSliderPosChangedAngle); +PREP(onSliderPosChangedScale); PREP(placeMarker); PREP(sendMarkersJIP); PREP(setMarkerJIP); diff --git a/addons/markers/XEH_postInit.sqf b/addons/markers/XEH_postInit.sqf index 7f644691d3f..25e8317b75b 100644 --- a/addons/markers/XEH_postInit.sqf +++ b/addons/markers/XEH_postInit.sqf @@ -15,6 +15,7 @@ if (isMultiplayer && {!isServer} && {hasInterface}) then { GVAR(mapDisplaysWithDrawEHs) = []; GVAR(currentMarkerPosition) = []; GVAR(currentMarkerAngle) = 0; +GVAR(currentMarkerScale) = 1; GVAR(currentMarkerColorConfigName) = ""; GVAR(currentMarkerConfigName) = ""; diff --git a/addons/markers/functions/fnc_initInsertMarker.sqf b/addons/markers/functions/fnc_initInsertMarker.sqf index 7d91173c878..5c34027efb9 100644 --- a/addons/markers/functions/fnc_initInsertMarker.sqf +++ b/addons/markers/functions/fnc_initInsertMarker.sqf @@ -45,6 +45,8 @@ private _aceColorLB = _display displayctrl IDC_ACE_INSERT_MARKER_COLOR; private _aceAngleSlider = _display displayctrl IDC_ACE_INSERT_MARKER_ANGLE; private _aceAngleSliderText = _display displayctrl IDC_ACE_INSERT_MARKER_ANGLE_TEXT; + private _aceScaleSlider = _display displayctrl IDC_ACE_INSERT_MARKER_SCALE; + private _aceScaleSliderText = _display displayctrl IDC_ACE_INSERT_MARKER_SCALE_TEXT; private _mapDisplay = displayParent _display; if (isNull _mapDisplay) exitWith {ERROR("No Map");}; @@ -103,7 +105,8 @@ private _pos = ctrlposition _text; _pos params ["_posX", "_posY", "_posW", "_posH"]; _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) - (11 * _posH + 11 * BORDER)); //prevent buttons being placed below bottom edge of screen + _pos set [0, _posX]; _pos set [1, _posY]; _text ctrlSetPosition _pos; @@ -118,9 +121,9 @@ //--- Description _pos set [1, _posY - 1 * _posH]; if (GVAR(timestampEnabled)) then { - _pos set [3,7 * _posH + 7 * BORDER]; + _pos set [3,9 * _posH + 9 * BORDER]; } else { - _pos set [3,6 * _posH + 6 * BORDER]; + _pos set [3,10 * _posH + 10 * BORDER]; }; _description ctrlEnable false; _description ctrlSetPosition _pos; @@ -187,16 +190,28 @@ _aceAngleSliderText ctrlSetPosition _pos; _aceAngleSliderText ctrlCommit 0; + //--- Scale + _pos set [1, _posY + 5 * _posH + 6 * BORDER + _timestampOffset]; + _pos set [2, _posW]; + _aceScaleSlider ctrlSetPosition _pos; + _aceScaleSlider ctrlCommit 0; + + //--- Scale Text + _pos set [1, _posY + 6 * _posH + 7 * BORDER + _timestampOffset]; + _pos set [2, _posW]; + _aceScaleSliderText ctrlSetPosition _pos; + _aceScaleSliderText ctrlCommit 0; + private _offsetButtons = 0; if (isMultiplayer) then { - _pos set [1,_posY + 5 * _posH + 7 * BORDER + _timestampOffset]; + _pos set [1,_posY + 7 * _posH + 9 * BORDER + _timestampOffset]; _pos set [3,_posH]; _descriptionChannel ctrlSetStructuredText parseText format ["%1:", localize "str_a3_cfgvehicles_modulerespawnposition_f_arguments_marker_0"]; _descriptionChannel ctrlSetPosition _pos; _descriptionChannel ctrlCommit 0; - _pos set [1,_posY + 6 * _posH + 7 * BORDER + _timestampOffset]; + _pos set [1,_posY + 8 * _posH + 9 * BORDER + _timestampOffset]; _pos set [3,_posH]; _channel ctrlSetPosition _pos; _channel ctrlCommit 0; @@ -235,11 +250,11 @@ _channel ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChangedChannel)}]; - _offsetButtons = 7 * _posH + 8 * BORDER; + _offsetButtons = 9 * _posH + 10 * BORDER; } else { _descriptionChannel ctrlShow false; _channel ctrlShow false; - _offsetButtons = 5 * _posH + 7 * BORDER; + _offsetButtons = 7 * _posH + 9 * BORDER; }; //--- ButtonOK @@ -321,4 +336,20 @@ //Update now and add eventHandler: [_aceAngleSlider, _curSelAngle] call FUNC(onSliderPosChangedAngle); _aceAngleSlider ctrlAddEventHandler ["SliderPosChanged", {_this call FUNC(onSliderPosChangedAngle)}]; + + //////////////////// + // init marker scale slider + _aceScaleSlider sliderSetRange [0.5, 2.0]; + + if !(GVAR(editingMarker) isEqualTo "") then { + //get the original scale + GVAR(currentMarkerScale) = markerSize GVAR(editingMarker); + }; + + private _curSelScale = GETGVAR(currentMarkerScale,1); + _aceScaleSlider sliderSetPosition _curSelScale; + + //Update now and add eventHandler: + [_aceScaleSlider, _curSelScale] call FUNC(onSliderPosChangedScale); + _aceScaleSlider ctrlAddEventHandler ["SliderPosChanged", {_this call FUNC(onSliderPosChangedScale)}]; }, _this] call CBA_fnc_execNextFrame; diff --git a/addons/markers/functions/fnc_mapDrawEH.sqf b/addons/markers/functions/fnc_mapDrawEH.sqf index 5f3c6aed15b..02540b699fe 100644 --- a/addons/markers/functions/fnc_mapDrawEH.sqf +++ b/addons/markers/functions/fnc_mapDrawEH.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: PabstMirror - * Draws the current temp marker. Allows rotation. + * Draws the current temp marker. Allows rotation and scale. * * Arguments: * 0: TheMap @@ -25,8 +25,8 @@ if (GVAR(currentMarkerConfigName) == "" || {GVAR(currentMarkerColorConfigName) = ERROR("Bad Data"); }; -private _sizeX = 1; -private _sizeY = 1; +private _sizeX = GVAR(currentMarkerScale); +private _sizeY = GVAR(currentMarkerScale); private _textureConfig = configFile >> "CfgMarkers" >> GVAR(currentMarkerConfigName); private _texture = getText (_textureConfig >> "icon"); diff --git a/addons/markers/functions/fnc_onSliderPosChangedScale.sqf b/addons/markers/functions/fnc_onSliderPosChangedScale.sqf new file mode 100755 index 00000000000..8f386729d06 --- /dev/null +++ b/addons/markers/functions/fnc_onSliderPosChangedScale.sqf @@ -0,0 +1,28 @@ +#include "script_component.hpp" +/* + * Author: frankplow + * Applies scale from on slider position change. + * + * Arguments: + * 0: Slider (idc 1420) + * 1: Slider Data (scale: 0.5...2.0) + * + * Return Value: + * None + * + * Example: + * [slider, 1.5] call ace_markers_fnc_onSliderPosChangedScale + * + * Public: No + */ + +params ["_ctrl", "_data"]; +TRACE_2("params",_ctrl,_data); + +private _scale = _data * 100; +_scale = round _scale; +_scale = _scale / 100; + +((ctrlParent _ctrl) displayCtrl IDC_ACE_INSERT_MARKER_SCALE_TEXT) ctrlSetText format [localize LSTRING(MarkerScale), _scale]; + +GVAR(currentMarkerScale) = _data; diff --git a/addons/markers/functions/fnc_placeMarker.sqf b/addons/markers/functions/fnc_placeMarker.sqf index a1b136aad51..b4f38c42322 100644 --- a/addons/markers/functions/fnc_placeMarker.sqf +++ b/addons/markers/functions/fnc_placeMarker.sqf @@ -58,7 +58,8 @@ if (_closeNum isEqualTo 1) then { GETGVAR(currentMarkerConfigName,""), GETGVAR(currentMarkerColorConfigName,""), GETGVAR(currentMarkerPosition,[]), - GETGVAR(currentMarkerAngle,0) + GETGVAR(currentMarkerAngle,0), + GETGVAR(currentMarkerScale,1) ] ]] call CBA_fnc_globalEvent; diff --git a/addons/markers/functions/fnc_setMarkerJIP.sqf b/addons/markers/functions/fnc_setMarkerJIP.sqf index 9c9aea9fd71..b8d2d99dbc0 100644 --- a/addons/markers/functions/fnc_setMarkerJIP.sqf +++ b/addons/markers/functions/fnc_setMarkerJIP.sqf @@ -25,7 +25,7 @@ TRACE_2("params",_allMapMarkers,_allMapMarkersProperties); if (_index != -1) then { private _data = _allMapMarkersProperties select _index; - _data params ["_markerClassname", "_colorClassname", "_pos", "_dir"]; + _data params ["_markerClassname", "_colorClassname", "_pos", "_dir", "_scale"]; private _config = (configfile >> "CfgMarkers") >> _markerClassname; @@ -47,6 +47,7 @@ TRACE_2("params",_allMapMarkers,_allMapMarkersProperties); _x setMarkerPosLocal _pos; _x setMarkerDirLocal _dir; + _x setMarkerSizeLocal _scale; }; false } count allMapMarkers; diff --git a/addons/markers/functions/fnc_setMarkerNetwork.sqf b/addons/markers/functions/fnc_setMarkerNetwork.sqf index eb0b547bb0f..a8e8453525e 100644 --- a/addons/markers/functions/fnc_setMarkerNetwork.sqf +++ b/addons/markers/functions/fnc_setMarkerNetwork.sqf @@ -19,7 +19,7 @@ params ["_marker", "_data"]; TRACE_2("params",_marker,_data); -_data params ["_markerClassname", "_colorClassname", "_pos", "_dir"]; +_data params ["_markerClassname", "_colorClassname", "_pos", "_dir", "_scale"]; private _config = configfile >> "CfgMarkers" >> _markerClassname; @@ -41,6 +41,7 @@ _marker setMarkerColorLocal configName _config; _marker setMarkerPosLocal _pos; _marker setMarkerDirLocal _dir; +_marker setMarkerSizeLocal [_scale, _scale]; // save properties on server machine for JIP, marker editing ready if (isMultiplayer && {isServer}) then { diff --git a/addons/markers/script_component.hpp b/addons/markers/script_component.hpp index ab0a10961b9..8da334153d0 100644 --- a/addons/markers/script_component.hpp +++ b/addons/markers/script_component.hpp @@ -38,3 +38,5 @@ #define IDC_ACE_INSERT_MARKER_COLOR 1221 #define IDC_ACE_INSERT_MARKER_ANGLE 1230 #define IDC_ACE_INSERT_MARKER_ANGLE_TEXT 1231 +#define IDC_ACE_INSERT_MARKER_SCALE 1240 +#define IDC_ACE_INSERT_MARKER_SCALE_TEXT 1241 diff --git a/addons/markers/stringtable.xml b/addons/markers/stringtable.xml index 1848e4fa418..26a4109374c 100644 --- a/addons/markers/stringtable.xml +++ b/addons/markers/stringtable.xml @@ -1,6 +1,9 @@ + + Scale: %1 + Direction: %1° Drehung: %1°