mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2226 from acemod/codeCleanupMarker
Code Cleanup Marker Module
This commit is contained in:
commit
58f4ef5b62
@ -46,7 +46,8 @@ if (isNil QGVAR(MarkerColorsCache)) then {
|
|||||||
_rgba set [_forEachIndex, call compile _x];
|
_rgba set [_forEachIndex, call compile _x];
|
||||||
};
|
};
|
||||||
} forEach _rgba;
|
} forEach _rgba;
|
||||||
_icon = format ["#(argb,8,8,3)color(%1,%2,%3,%4)", _rgba select 0, _rgba select 1, _rgba select 2, _rgba select 3];
|
_rgba params ["_red", "_green", "_blue", "_alpha"];
|
||||||
|
_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];
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* 0: RscDisplayInsertMarker <DISPLAY>
|
* 0: RscDisplayInsertMarker <DISPLAY>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Nothing
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [onLoad] call ace_markers_fnc_initInsertMarker;
|
* [onLoad] call ace_markers_fnc_initInsertMarker;
|
||||||
@ -19,10 +19,11 @@
|
|||||||
#define BORDER 0.005
|
#define BORDER 0.005
|
||||||
|
|
||||||
[{
|
[{
|
||||||
private ["_display", "_text", "_picture", "_channel", "_buttonOK", "_buttonCancel", "_description", "_title", "_descriptionChannel", "_sizeX", "_sizeY", "_aceShapeLB", "_aceColorLB", "_aceAngleSlider", "_aceAngleSliderText", "_mapIDD", "_pos", "_posX", "_posY", "_posW", "_posH", "_offsetButtons", "_buttonOk", "_curSelShape", "_curSelColor", "_curSelAngle"];
|
private ["_text", "_picture", "_channel", "_buttonOK", "_buttonCancel", "_description", "_title", "_descriptionChannel", "_sizeX", "_sizeY", "_aceShapeLB", "_aceColorLB", "_aceAngleSlider", "_aceAngleSliderText", "_mapIDD", "_pos", "_offsetButtons", "_buttonOk", "_curSelShape", "_curSelColor", "_curSelAngle"];
|
||||||
|
|
||||||
disableserialization;
|
disableserialization;
|
||||||
PARAMS_1(_display);
|
params ["_display"];
|
||||||
|
TRACE_1("params",_display);
|
||||||
|
|
||||||
//Can't place markers when can't interact
|
//Can't place markers when can't interact
|
||||||
if (!([ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith))) exitWith {
|
if (!([ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith))) exitWith {
|
||||||
@ -76,10 +77,8 @@
|
|||||||
|
|
||||||
//--- Background
|
//--- Background
|
||||||
_pos = ctrlposition _text;
|
_pos = ctrlposition _text;
|
||||||
_posX = (_pos select 0) + 0.01;
|
_pos params ["_posX", "_posY", "_posW", "_posH"];
|
||||||
_posY = _pos select 1;
|
_posX = _posX + 0.01;
|
||||||
_posW = _pos select 2;
|
|
||||||
_posH = _pos select 3;
|
|
||||||
_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
|
||||||
_pos set [0,_posX];
|
_pos set [0,_posX];
|
||||||
_pos set [1,_posY];
|
_pos set [1,_posY];
|
||||||
@ -173,9 +172,10 @@
|
|||||||
// init marker shape lb
|
// init marker shape lb
|
||||||
lbClear _aceShapeLB;
|
lbClear _aceShapeLB;
|
||||||
{
|
{
|
||||||
_aceShapeLB lbAdd (_x select 0);
|
_x params ["_add", "_set", "_pic"];
|
||||||
_aceShapeLB lbSetValue [_forEachIndex, _x select 1];
|
_aceShapeLB lbAdd _add;
|
||||||
_aceShapeLB lbSetPicture [_forEachIndex, _x select 2];
|
_aceShapeLB lbSetValue [_forEachIndex, _set];
|
||||||
|
_aceShapeLB lbSetPicture [_forEachIndex, _pic];
|
||||||
} forEach GVAR(MarkersCache);
|
} forEach GVAR(MarkersCache);
|
||||||
_curSelShape = GETGVAR(curSelMarkerShape,0);
|
_curSelShape = GETGVAR(curSelMarkerShape,0);
|
||||||
_aceShapeLB lbSetCurSel _curSelShape;
|
_aceShapeLB lbSetCurSel _curSelShape;
|
||||||
@ -188,9 +188,10 @@
|
|||||||
// init marker color lb
|
// init marker color lb
|
||||||
lbClear _aceColorLB;
|
lbClear _aceColorLB;
|
||||||
{
|
{
|
||||||
_aceColorLB lbAdd (_x select 0);
|
_x params ["_add", "_set", "_pic"];
|
||||||
_aceColorLB lbSetValue [_forEachIndex, _x select 1];
|
_aceColorLB lbAdd _add;
|
||||||
_aceColorLB lbSetPicture [_forEachIndex, _x select 2];
|
_aceColorLB lbSetValue [_forEachIndex, _set];
|
||||||
|
_aceColorLB lbSetPicture [_forEachIndex, _pic];
|
||||||
} forEach GVAR(MarkerColorsCache);
|
} forEach GVAR(MarkerColorsCache);
|
||||||
_curSelColor = GETGVAR(curSelMarkerColor,0);
|
_curSelColor = GETGVAR(curSelMarkerColor,0);
|
||||||
_aceColorLB lbSetCurSel _curSelColor;
|
_aceColorLB lbSetCurSel _curSelColor;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* 0: TheMap <Control>
|
* 0: TheMap <Control>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Nothing
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [theMapControl] call ace_markers_fnc_mapDrawEH;
|
* [theMapControl] call ace_markers_fnc_mapDrawEH;
|
||||||
@ -15,9 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_theMap", "_sizeX", "_sizeY", "_textureConfig", "_texture", "_markerSize", "_markerShadow", "_colorConfig", "_drawColor"];
|
private ["_sizeX", "_sizeY", "_textureConfig", "_texture", "_markerSize", "_markerShadow", "_colorConfig", "_drawColor"];
|
||||||
|
|
||||||
PARAMS_1(_theMap);
|
params ["_theMap"];
|
||||||
|
// TRACE_1("params",_theMap);
|
||||||
|
|
||||||
//Only show if marker place is open:
|
//Only show if marker place is open:
|
||||||
if (isNull (findDisplay 54)) exitWith {};
|
if (isNull (findDisplay 54)) exitWith {};
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* 1: Selected Index <NUMBER>
|
* 1: Selected Index <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Nothing
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [ColorLB, 5] call ace_markers_fnc_onLBSelChangedColor;
|
* [ColorLB, 5] call ace_markers_fnc_onLBSelChangedColor;
|
||||||
@ -18,7 +18,9 @@
|
|||||||
|
|
||||||
private ["_data", "_config"];
|
private ["_data", "_config"];
|
||||||
|
|
||||||
PARAMS_2(_ctrl,_index);
|
params ["_ctrl", "_index"];
|
||||||
|
TRACE_2("params",_ctrl,_index);
|
||||||
|
|
||||||
_data = _ctrl lbValue _index;
|
_data = _ctrl lbValue _index;
|
||||||
|
|
||||||
GVAR(curSelMarkerColor) = _index;
|
GVAR(curSelMarkerColor) = _index;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* 1: Selected Index <NUMBER>
|
* 1: Selected Index <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Nothing
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [ColorLB, 5] call ace_markers_fnc_onLBSelChangedShape;
|
* [ColorLB, 5] call ace_markers_fnc_onLBSelChangedShape;
|
||||||
@ -18,7 +18,9 @@
|
|||||||
|
|
||||||
private ["_data", "_config"];
|
private ["_data", "_config"];
|
||||||
|
|
||||||
PARAMS_2(_ctrl,_index);
|
params ["_ctrl", "_index"];
|
||||||
|
TRACE_2("params",_ctrl,_index);
|
||||||
|
|
||||||
_data = _ctrl lbValue _index;
|
_data = _ctrl lbValue _index;
|
||||||
|
|
||||||
GVAR(curSelMarkerShape) = _index;
|
GVAR(curSelMarkerShape) = _index;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* 1: Slider Data (angle: -180..180) <NUMBER>
|
* 1: Slider Data (angle: -180..180) <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Nothing
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [Slider, 2] call ace_markers_fnc_onSliderPosChangedAngle;
|
* [Slider, 2] call ace_markers_fnc_onSliderPosChangedAngle;
|
||||||
@ -18,7 +18,8 @@
|
|||||||
|
|
||||||
private ["_direction"];
|
private ["_direction"];
|
||||||
|
|
||||||
PARAMS_2(_ctrl,_data);
|
params ["_ctrl", "_data"];
|
||||||
|
TRACE_2("params",_ctrl,_data);
|
||||||
|
|
||||||
_direction = round _data;
|
_direction = round _data;
|
||||||
if (_direction < 0) then {
|
if (_direction < 0) then {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* 1: CloseNumber (1 = ButtonOk) <NUMBER>
|
* 1: CloseNumber (1 = ButtonOk) <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Nothing
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [onUnloadEvent] call ace_markers_fnc_placeMarker;
|
* [onUnloadEvent] call ace_markers_fnc_placeMarker;
|
||||||
@ -17,7 +17,8 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
disableserialization;
|
disableserialization;
|
||||||
PARAMS_2(_display,_closeNum);
|
params ["_display", "_closeNum"];
|
||||||
|
TRACE_2("params",_display,_closeNum);
|
||||||
|
|
||||||
if (_closeNum == 1) then {
|
if (_closeNum == 1) then {
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* 0: Logic <OBJECT>
|
* 0: Logic <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Nothing
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [onUnloadEvent] call ace_markers_fnc_sendMarkerJIP;
|
* [onUnloadEvent] call ace_markers_fnc_sendMarkerJIP;
|
||||||
@ -15,11 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_1(_logic);
|
params ["_logic"];
|
||||||
|
TRACE_1("params",_logic);
|
||||||
|
|
||||||
[QGVAR(setMarkerJIP), [_logic], [
|
[
|
||||||
GETGVAR(allMapMarkers,[]),
|
QGVAR(setMarkerJIP),
|
||||||
GETGVAR(allMapMarkersProperties,[]),
|
[_logic],
|
||||||
_logic
|
[GETGVAR(allMapMarkers,[]), GETGVAR(allMapMarkersProperties,[]), _logic]
|
||||||
]
|
|
||||||
] call EFUNC(common,targetEvent);
|
] call EFUNC(common,targetEvent);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* 2: Logic <OBJECT>
|
* 2: Logic <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Nothing
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [[],[],dummyLogic] call ace_markers_fnc_setMarkerJIP;
|
* [[],[],dummyLogic] call ace_markers_fnc_setMarkerJIP;
|
||||||
@ -17,32 +17,34 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_index", "_data", "_config"];
|
params ["_allMapMarkers", "_allMapMarkersProperties", "_logic"];
|
||||||
|
TRACE_3("params",_allMapMarkers,_allMapMarkersProperties,_logic);
|
||||||
PARAMS_3(_allMapMarkers,_allMapMarkersProperties,_logic);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
private ["_index", "_data", "_config"];
|
||||||
|
|
||||||
_index = _allMapMarkers find _x;
|
_index = _allMapMarkers find _x;
|
||||||
|
|
||||||
if (_index != -1) then {
|
if (_index != -1) then {
|
||||||
_data = _allMapMarkersProperties select _index;
|
_data = _allMapMarkersProperties select _index;
|
||||||
|
_data params ["_name", "_color", "_pos", "_dir"];
|
||||||
|
|
||||||
_config = (configfile >> "CfgMarkers") >> (_data select 0);
|
_config = (configfile >> "CfgMarkers") >> _name;
|
||||||
if (!isClass _config) then {
|
if (!isClass _config) then {
|
||||||
WARNING("CfgMarker not found, changed to milDot");
|
WARNING("CfgMarker not found, changed to milDot");
|
||||||
_config == (configFile >> "CfgMarkers" >> "MilDot");
|
_config == (configFile >> "CfgMarkers" >> "MilDot");
|
||||||
};
|
};
|
||||||
_x setMarkerTypeLocal (configName _config);
|
_x setMarkerTypeLocal (configName _config);
|
||||||
|
|
||||||
_config = (configfile >> "CfgMarkerColors") >> (_data select 1);
|
_config = (configfile >> "CfgMarkerColors") >> _color;
|
||||||
if (!isClass _config) then {
|
if (!isClass _config) then {
|
||||||
WARNING("CfgMarkerColors not found, changed to Default");
|
WARNING("CfgMarkerColors not found, changed to Default");
|
||||||
_config == (configFile >> "CfgMarkerColors" >> "Default");
|
_config == (configFile >> "CfgMarkerColors" >> "Default");
|
||||||
};
|
};
|
||||||
_x setMarkerColorLocal (configName _config);
|
_x setMarkerColorLocal (configName _config);
|
||||||
|
|
||||||
_x setMarkerPosLocal (_data select 2);
|
_x setMarkerPosLocal _pos;
|
||||||
_x setMarkerDirLocal (_data select 3);
|
_x setMarkerDirLocal _dir;
|
||||||
};
|
};
|
||||||
} forEach allMapMarkers;
|
} forEach allMapMarkers;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* 1: Marker Data <ARRAY>
|
* 1: Marker Data <ARRAY>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Nothing
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [[],[],dummyLogic] call ace_markers_fnc_setMarkerJIP;
|
* [[],[],dummyLogic] call ace_markers_fnc_setMarkerJIP;
|
||||||
@ -19,8 +19,10 @@
|
|||||||
|
|
||||||
private ["_config"];
|
private ["_config"];
|
||||||
|
|
||||||
PARAMS_2(_marker,_data);
|
params ["_marker", "_data"];
|
||||||
EXPLODE_4_PVT(_data,_markerClassname,_colorClassname,_markerPos,_markerDir);
|
_data params ["_markerClassname", "_colorClassname", "_markerPos", "_markerDir"];
|
||||||
|
TRACE_2("params",_marker,_data);
|
||||||
|
|
||||||
|
|
||||||
_config = (configfile >> "CfgMarkers") >> _markerClassname;
|
_config = (configfile >> "CfgMarkers") >> _markerClassname;
|
||||||
if (!isClass _config) then {
|
if (!isClass _config) then {
|
||||||
|
Loading…
Reference in New Issue
Block a user