code cleanup markers

This commit is contained in:
commy2 2015-12-10 15:32:31 +01:00
parent f64f4f4c4b
commit 7748131e73
15 changed files with 303 additions and 207 deletions

View File

@ -1,3 +1,4 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));

View File

@ -1,3 +1,4 @@
class RscPicture;
class RscText;
class RscStructuredText;
@ -12,21 +13,9 @@ class RscXSliderH;
class RscDisplayInsertMarker {
onLoad = QUOTE(_this call DFUNC(initInsertMarker););
onUnload = QUOTE(_this call DFUNC(placeMarker););
// idd = 54;
movingEnable = 1;
class controlsBackground {
// class RscText_1000: RscText {idc = 1000;};
};
class controls {
// class ButtonMenuOK: RscButtonMenuOK {idc = 1;};
// class ButtonMenuCancel: RscButtonMenuCancel {idc = 2;};
// class Title: RscText {idc = 1001;};
// class Description: RscStructuredText {idc = 1100;};
// class DescriptionChannel: RscStructuredText {idc = 1101;};
// class MarkerPicture: RscPicture {idc = 102;};
// class MarkerText: RscEdit {idc = 101;};
// class MarkerChannel: RscCombo {idc = 103;};
class controls {
class MarkerShape: RscCombo {
idc = 1210;
};
@ -39,22 +28,5 @@ class RscDisplayInsertMarker {
class MarkerAngleText: RscText {
idc = 1221;
};
/*class SizeX: RscEdit {
idc = 1200;
text = "10";
x = "14 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX)";
y = "12.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))";
w = "5 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
class SizeY: RscEdit {
idc = 1201;
text = "10";
x = "19 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX)";
y = "12.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))";
w = "5 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};*/
};
};

View File

@ -9,12 +9,11 @@
// request marker data for JIP
if (isMultiplayer && {!isServer} && {hasInterface}) then {
private "_logic";
_logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"];
private _logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"];
[QGVAR(sendMarkersJIP), [_logic]] call EFUNC(common,serverEvent);
};
GVAR(mapDisplaysWithDrawEHs) = [];
GVAR(currentMarkerPosition) = [];
GVAR(currentMarkerAngle) = 0;

View File

@ -2,8 +2,10 @@
ADDON = false;
PREP(getEnabledChannels);
PREP(initInsertMarker);
PREP(mapDrawEH);
PREP(onLBSelChangedChannel);
PREP(onLBSelChangedColor);
PREP(onLBSelChangedShape);
PREP(onSliderPosChangedAngle);
@ -12,19 +14,19 @@ PREP(sendMarkersJIP);
PREP(setMarkerJIP);
PREP(setMarkerNetwork);
private ["_config", "_marker", "_a", "_scope", "_icon", "_rgba", "_name"];
// init marker types
if (isNil QGVAR(MarkersCache)) then {
_config = configfile >> "CfgMarkers";
GVAR(MarkersCache) = [];
private _config = configfile >> "CfgMarkers";
for "_a" from 0 to (count _config - 1) do {
_marker = _config select _a;
_scope = getNumber (_marker >> "scope");
if (_scope == 2) then {
_name = getText (_marker >> "name");
_icon = getText (_marker >> "icon");
private _marker = _config select _a;
if (getNumber (_marker >> "scope") == 2) then {
private _name = getText (_marker >> "name");
private _icon = getText (_marker >> "icon");
GVAR(MarkersCache) pushBack [_name, _a, _icon];
};
};
@ -32,22 +34,25 @@ if (isNil QGVAR(MarkersCache)) then {
// init marker colors
if (isNil QGVAR(MarkerColorsCache)) then {
_config = configfile >> "CfgMarkerColors";
GVAR(MarkerColorsCache) = [];
private _config = configfile >> "CfgMarkerColors";
for "_a" from 0 to (count _config - 1) do {
_marker = _config select _a;
_scope = getNumber (_marker >> "scope");
if (_scope == 2) then {
_name = getText (_marker >> "name");
_rgba = getArray (_marker >> "color");
private _marker = _config select _a;
if (getNumber (_marker >> "scope") == 2) then {
private _name = getText (_marker >> "name");
private _rgba = getArray (_marker >> "color");
{
if (!( _x isEqualType 0)) then {
if !( _x isEqualType 0) then {
_rgba set [_forEachIndex, call compile _x];
};
} forEach _rgba;
_rgba params ["_red", "_green", "_blue", "_alpha"];
_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];
};

View File

@ -0,0 +1,54 @@
/*
* Author: commy2
* Return enabled channels.
*
* Arguments:
* 0: false - use channel id, true - use localized channel names <BOOl> (default: false)
*
* Return Value:
* Enabled Channels <ARRAY>
*
* Public: No
*/
#include "script_component.hpp"
params [["_localize", false, [false]]];
private _currentChannel = currentChannel;
private _enabledChannels = [];
if (_localize) then {
if (setCurrentChannel 0) then {
_enabledChannels pushBack localize "str_channel_global";
};
if (setCurrentChannel 1) then {
_enabledChannels pushBack localize "str_channel_side";
};
if (setCurrentChannel 2) then {
_enabledChannels pushBack localize "str_channel_command";
};
if (setCurrentChannel 3) then {
_enabledChannels pushBack localize "str_channel_group";
};
if (setCurrentChannel 4) then {
_enabledChannels pushBack localize "str_channel_vehicle";
};
if (setCurrentChannel 5) then {
_enabledChannels pushBack localize "str_channel_direct";
};
} else {
for "_i" from 0 to 5 do {
if (setCurrentChannel _i) then {
_enabledChannels pushBack _i;
};
};
};
setCurrentChannel _currentChannel;
_enabledChannels

View File

@ -19,50 +19,58 @@
#define BORDER 0.005
[{
private ["_text", "_picture", "_channel", "_buttonOK", "_buttonCancel", "_description", "_title", "_descriptionChannel", "_sizeX", "_sizeY", "_aceShapeLB", "_aceColorLB", "_aceAngleSlider", "_aceAngleSliderText", "_mapIDD", "_pos", "_offsetButtons", "_buttonOk", "_curSelShape", "_curSelColor", "_curSelAngle"];
disableserialization;
params ["_display"];
TRACE_1("params",_display);
//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 {
_display closeDisplay 2; //emulate "Cancel" button
};
//BIS Controls:
_text = _display displayctrl 101;
_picture = _display displayctrl 102;
_channel = _display displayctrl 103;
_buttonOK = _display displayctrl 1;
_buttonCancel = _display displayctrl 2;
_description = _display displayctrl 1100;
_title = _display displayctrl 1001;
_descriptionChannel = _display displayctrl 1101;
private _text = _display displayctrl 101;
private _picture = _display displayctrl 102;
private _channel = _display displayctrl 103;
private _buttonOK = _display displayctrl 1;
private _buttonCancel = _display displayctrl 2;
private _description = _display displayctrl 1100;
private _title = _display displayctrl 1001;
private _descriptionChannel = _display displayctrl 1101;
//ACE Controls:
// _sizeX = _display displayctrl 1200;
// _sizeY = _display displayctrl 1201;
_aceShapeLB = _display displayctrl 1210;
_aceColorLB = _display displayctrl 1211;
_aceAngleSlider = _display displayctrl 1220;
_aceAngleSliderText = _display displayctrl 1221;
private _aceShapeLB = _display displayctrl 1210;
private _aceColorLB = _display displayctrl 1211;
private _aceAngleSlider = _display displayctrl 1220;
private _aceAngleSliderText = _display displayctrl 1221;
////////////////////
// Install MapDrawEH on current map
private _mapIDD = -1;
//Install MapDrawEH on current map
_mapIDD = -1;
{
if (!isNull (findDisplay _x)) exitWith {_mapIDD = _x};
} forEach [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)}];
if (!isNull (findDisplay _x)) exitWith {
_mapIDD = _x;
};
false
} count [12, 37, 52, 53, 160];
if (_mapIDD == -1) exitWith {
ERROR("No Map?");
};
//Calculate center position of the marker placement ctrl
_pos = ctrlPosition _picture;
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
private _pos = ctrlPosition _picture;
_pos = [(_pos select 0) + (_pos select 2) / 2, (_pos select 1) + (_pos select 3) / 2];
GVAR(currentMarkerPosition) = ((findDisplay _mapIDD) displayCtrl 51) ctrlMapScreenToWorld _pos;
//Hide the bis picture:
@ -80,95 +88,113 @@
_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
_pos set [0,_posX];
_pos set [1,_posY];
_text ctrlsetposition _pos;
_text ctrlcommit 0;
_pos set [0, _posX];
_pos set [1, _posY];
_text ctrlSetPosition _pos;
_text ctrlCommit 0;
//--- Title
_pos set [1,_posY - 2*_posH - BORDER];
_pos set [3,_posH];
_title ctrlsetposition _pos;
_title ctrlcommit 0;
_pos set [1, _posY - 2 * _posH - BORDER];
_pos set [3, _posH];
_title ctrlSetPosition _pos;
_title ctrlCommit 0;
//--- Description
_pos set [1,_posY - 1*_posH];
_pos set [3,6*_posH + 6 * BORDER];
_description ctrlenable false;
_description ctrlsetposition _pos;
_description ctrlsetstructuredtext parsetext format ["<t size='0.8'>%1</t>", (localize "str_lib_label_description")];
_description ctrlcommit 0;
_pos set [1, _posY - 1 * _posH];
_pos set [3,6 * _posH + 6 * BORDER];
_description ctrlEnable false;
_description ctrlSetPosition _pos;
_description ctrlSetStructuredText parseText format ["<t size='0.8'>%1</t>", localize "str_lib_label_description"];
_description ctrlCommit 0;
//--- Shape
_pos set [1,_posY + 1 * _posH + 2 * BORDER];
_pos set [2,_posW];
_pos set [3,_posH];
_aceShapeLB ctrlsetposition _pos;
_aceShapeLB ctrlcommit 0;
_pos set [1, _posY + 1 * _posH + 2 * BORDER];
_pos set [2, _posW];
_pos set [3, _posH];
_aceShapeLB ctrlSetPosition _pos;
_aceShapeLB ctrlCommit 0;
//--- Color
_pos set [1,_posY + 2 * _posH + 3 * BORDER];
_pos set [2,_posW];
_aceColorLB ctrlsetposition _pos;
_aceColorLB ctrlcommit 0;
_pos set [1, _posY + 2 * _posH + 3 * BORDER];
_pos set [2, _posW];
_aceColorLB ctrlSetPosition _pos;
_aceColorLB ctrlCommit 0;
//--- Angle
_pos set [1,_posY + 3 * _posH + 4 * BORDER];
_pos set [2,_posW];
_aceAngleSlider ctrlsetposition _pos;
_aceAngleSlider ctrlcommit 0;
_pos set [1, _posY + 3 * _posH + 4 * BORDER];
_pos set [2, _posW];
_aceAngleSlider ctrlSetPosition _pos;
_aceAngleSlider ctrlCommit 0;
//--- Angle Text
_pos set [1,_posY + 4 * _posH + 5 * BORDER];
_pos set [2,_posW];
_aceAngleSliderText ctrlsetposition _pos;
_aceAngleSliderText ctrlcommit 0;
_pos set [1, _posY + 4 * _posH + 5 * BORDER];
_pos set [2, _posW];
_aceAngleSliderText ctrlSetPosition _pos;
_aceAngleSliderText ctrlCommit 0;
private _offsetButtons = 0;
_offsetButtons = 0;
if (isMultiplayer) then {
_pos set [1,_posY + 5 * _posH + 7 * BORDER];
_pos set [3,_posH];
_descriptionChannel ctrlsetstructuredtext parsetext format ["<t size='0.8'>%1</t>", (localize "str_a3_cfgvehicles_modulerespawnposition_f_arguments_marker_0") + ":"];
_descriptionChannel ctrlsetposition _pos;
_descriptionChannel ctrlcommit 0;
_descriptionChannel ctrlSetStructuredText parseText format ["<t size='0.8'>%1:</t>", localize "str_a3_cfgvehicles_modulerespawnposition_f_arguments_marker_0"];
_descriptionChannel ctrlSetPosition _pos;
_descriptionChannel ctrlCommit 0;
_pos set [1,_posY + 6 * _posH + 7 * BORDER];
_pos set [3,_posH];
_channel ctrlsetposition _pos;
_channel ctrlcommit 0;
_channel ctrlSetPosition _pos;
_channel ctrlCommit 0;
// channels are added by engine and not script. we have to manually delete them. requires channel names to be unique?
private _enabledChannels = true call FUNC(getEnabledChannels);
private _i = 0;
while {_i < lbSize _channel} do {
private _channelName = _channel lbText _i;
// _enabledChannels can not include custom channels names. Therefore also check if it's a custom one. Blame BI if the unit should not access the channel.
if (_channelName in _enabledChannels || {!(_channelName in CHANNEL_NAMES)}) then {
_i = _i + 1;
} else {
_channel lbDelete _i;
};
};
private _currentChannelName = CHANNEL_NAMES param [currentChannel, localize "str_channel_group"];
// select current channel in list box, must be done after lbDelete
for "_j" from 0 to (lbSize _channel - 1) do {
if (_channel lbText _j == _currentChannelName) then {
_channel lbSetCurSel _j;
};
};
_channel ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChangedChannel)}];
_offsetButtons = 7 * _posH + 8 * BORDER;
} else {
_descriptionChannel ctrlshow false;
_channel ctrlshow false;
_descriptionChannel ctrlShow false;
_channel ctrlShow false;
_offsetButtons = 5 * _posH + 7 * BORDER;
};
//--- ButtonOK
_pos set [1,_posY + _offsetButtons];
_pos set [2,_posW / 2 - BORDER];
_pos set [3,_posH];
_buttonOk ctrlsetposition _pos;
_buttonOk ctrlcommit 0;
_pos set [1, _posY + _offsetButtons];
_pos set [2, _posW / 2 - BORDER];
_pos set [3, _posH];
_buttonOk ctrlSetPosition _pos;
_buttonOk ctrlCommit 0;
//--- ButtonCancel
_pos set [0,_posX + _posW / 2];
_pos set [1,_posY + _offsetButtons];
_pos set [2,_posW / 2];
_pos set [3,_posH];
_buttonCancel ctrlsetposition _pos;
_buttonCancel ctrlcommit 0;
//--- PositionX
/*_pos set [1,_posY + 2 * _posH + 3 * BORDER];
_sizeX ctrlsetposition _pos;
_sizeX ctrlcommit 0;*/
//--- PositionY
/*_pos set [1,_posY + 2 * _posH + 3 * BORDER];
_sizeY ctrlsetposition _pos;
_sizeY ctrlcommit 0;*/
_pos set [0, _posX + _posW / 2];
_pos set [1, _posY + _offsetButtons];
_pos set [2, _posW / 2];
_pos set [3, _posH];
_buttonCancel ctrlSetPosition _pos;
_buttonCancel ctrlCommit 0;
////////////////////
// init marker shape lb
lbClear _aceShapeLB;
{
@ -177,14 +203,15 @@
_aceShapeLB lbSetValue [_forEachIndex, _set];
_aceShapeLB lbSetPicture [_forEachIndex, _pic];
} forEach GVAR(MarkersCache);
_curSelShape = GETGVAR(curSelMarkerShape,0);
private _curSelShape = GETGVAR(curSelMarkerShape,0);
_aceShapeLB lbSetCurSel _curSelShape;
//Update now and add eventHandler:
[_aceShapeLB, _curSelShape] call FUNC(onLBSelChangedShape);
_aceShapeLB ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChangedShape)}];
////////////////////
// init marker color lb
lbClear _aceColorLB;
{
@ -193,20 +220,22 @@
_aceColorLB lbSetValue [_forEachIndex, _set];
_aceColorLB lbSetPicture [_forEachIndex, _pic];
} forEach GVAR(MarkerColorsCache);
_curSelColor = GETGVAR(curSelMarkerColor,0);
private _curSelColor = GETGVAR(curSelMarkerColor,0);
_aceColorLB lbSetCurSel _curSelColor;
//Update now and add eventHandler:
[_aceColorLB, _curSelColor] call FUNC(onLBSelChangedColor);
_aceColorLB ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChangedColor)}];
////////////////////
// init marker angle slider
_aceAngleSlider sliderSetRange [-180, 180];
_curSelAngle = GETGVAR(currentMarkerAngle,0);
private _curSelAngle = GETGVAR(currentMarkerAngle,0);
_aceAngleSlider sliderSetPosition _curSelAngle;
//Update now and add eventHandler:
[_aceAngleSlider, _curSelAngle] call FUNC(onSliderPosChangedAngle);
_aceAngleSlider ctrlAddEventHandler ["SliderPosChanged", {_this call FUNC(onSliderPosChangedAngle)}];
}, _this] call EFUNC(common,execNextFrame);

View File

@ -15,32 +15,42 @@
*/
#include "script_component.hpp"
private ["_sizeX", "_sizeY", "_textureConfig", "_texture", "_markerSize", "_markerShadow", "_colorConfig", "_drawColor"];
params ["_theMap"];
// TRACE_1("params",_theMap);
//Only show if marker place is open:
if (isNull (findDisplay 54)) exitWith {};
if (isNull findDisplay 54) exitWith {};
//Error checking:
if ((GVAR(currentMarkerConfigName) == "") || {GVAR(currentMarkerColorConfigName) == ""} || {GVAR(currentMarkerPosition) isEqualTo []}) exitWith {ERROR("Bad Data");};
if (GVAR(currentMarkerConfigName) == "" || {GVAR(currentMarkerColorConfigName) == ""} || {GVAR(currentMarkerPosition) isEqualTo []}) exitWith {
ERROR("Bad Data");
};
_sizeX = 1;
_sizeY = 1;
private _sizeX = 1;
private _sizeY = 1;
_textureConfig = configFile >> "CfgMarkers" >> GVAR(currentMarkerConfigName);
_texture = getText (_textureConfig >> "icon");
_markerSize = getNumber (_textureConfig >> "size");
_markerShadow = getNumber (_textureConfig >> "shadow");
_colorConfig = (configFile >> "CfgMarkerColors" >> GVAR(currentMarkerColorConfigName));
_drawColor = getArray (_colorConfig >> "color");
private _textureConfig = configFile >> "CfgMarkers" >> GVAR(currentMarkerConfigName);
private _texture = getText (_textureConfig >> "icon");
private _markerSize = getNumber (_textureConfig >> "size");
private _markerShadow = getNumber (_textureConfig >> "shadow");
private _colorConfig = (configFile >> "CfgMarkerColors" >> GVAR(currentMarkerColorConfigName));
private _drawColor = getArray (_colorConfig >> "color");
//Convert possible code into numbers
{
if (_x isEqualType "") then {
_drawColor set [_forEachIndex, (call compile _x)];
_drawColor set [_forEachIndex, call compile _x];
};
} forEach _drawColor;
_drawColor set [3, ((_drawColor select 3) * 0.875)]; //Arma adds a slight transparency
_theMap drawIcon [_texture, _drawColor, GVAR(currentMarkerPosition), (_sizeX * _markerSize), (_sizeY * _markerSize), GVAR(currentMarkerAngle), "", _markerShadow];
_drawColor set [3, (_drawColor select 3) * 0.875]; //Arma adds a slight transparency
_theMap drawIcon [
_texture,
_drawColor,
GVAR(currentMarkerPosition),
_sizeX * _markerSize,
_sizeY * _markerSize,
GVAR(currentMarkerAngle),
"",
_markerShadow
];

View File

@ -0,0 +1,21 @@
/*
* Author: commy2
* When the channel list box is changed.
*
* Arguments:
* 0: Channel ListBox (idc 103) <CONTROL>
* 1: Selected Index <NUMBER>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
params ["_ctrl", "_index"];
TRACE_2("params",_ctrl,_index);
private _channelName = _ctrl lbText _index;
setCurrentChannel (CHANNEL_NAMES find _channelName);

View File

@ -16,15 +16,13 @@
*/
#include "script_component.hpp"
private ["_data", "_config"];
params ["_ctrl", "_index"];
TRACE_2("params",_ctrl,_index);
_data = _ctrl lbValue _index;
private _data = _ctrl lbValue _index;
GVAR(curSelMarkerColor) = _index;
_config = (configfile >> "CfgMarkerColors") select _data;
private _config = (configfile >> "CfgMarkerColors") select _data;
GVAR(currentMarkerColorConfigName) = (configName _config);
GVAR(currentMarkerColorConfigName) = configName _config;

View File

@ -16,15 +16,13 @@
*/
#include "script_component.hpp"
private ["_data", "_config"];
params ["_ctrl", "_index"];
TRACE_2("params",_ctrl,_index);
_data = _ctrl lbValue _index;
private _data = _ctrl lbValue _index;
GVAR(curSelMarkerShape) = _index;
_config = (configfile >> "CfgMarkers") select _data;
private _config = (configfile >> "CfgMarkers") select _data;
GVAR(currentMarkerConfigName) = (configName _config);
GVAR(currentMarkerConfigName) = configName _config;

View File

@ -16,12 +16,11 @@
*/
#include "script_component.hpp"
private ["_direction"];
params ["_ctrl", "_data"];
TRACE_2("params",_ctrl,_data);
_direction = round _data;
private _direction = round _data;
if (_direction < 0) then {
_direction = _direction + 360;
};

View File

@ -21,7 +21,6 @@ params ["_display", "_closeNum"];
TRACE_2("params",_display,_closeNum);
if (_closeNum == 1) then {
// set and send marker data the next frame. the actual marker isn't created yet
[{
[QGVAR(setMarkerNetwork), [

View File

@ -21,31 +21,34 @@ params ["_allMapMarkers", "_allMapMarkersProperties", "_logic"];
TRACE_3("params",_allMapMarkers,_allMapMarkersProperties,_logic);
{
private ["_index", "_data", "_config"];
_index = _allMapMarkers find _x;
private _index = _allMapMarkers find _x;
if (_index != -1) then {
_data = _allMapMarkersProperties select _index;
_data params ["_name", "_color", "_pos", "_dir"];
private _data = _allMapMarkersProperties select _index;
_data params ["_markerClassname", "_colorClassname", "_pos", "_dir"];
private _config = (configfile >> "CfgMarkers") >> _markerClassname;
_config = (configfile >> "CfgMarkers") >> _name;
if (!isClass _config) then {
WARNING("CfgMarker not found, changed to milDot");
_config == (configFile >> "CfgMarkers" >> "MilDot");
_config = configFile >> "CfgMarkers" >> "MilDot";
};
_x setMarkerTypeLocal (configName _config);
_config = (configfile >> "CfgMarkerColors") >> _color;
_x setMarkerTypeLocal configName _config;
_config = configfile >> "CfgMarkerColors" >> _colorClassname;
if (!isClass _config) then {
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 _pos;
_x setMarkerDirLocal _dir;
};
} forEach allMapMarkers;
false
} count allMapMarkers;
deleteVehicle _logic;

View File

@ -17,38 +17,37 @@
*/
#include "script_component.hpp"
private ["_config"];
params ["_marker", "_data"];
_data params ["_markerClassname", "_colorClassname", "_markerPos", "_markerDir"];
TRACE_2("params",_marker,_data);
_data params ["_markerClassname", "_colorClassname", "_pos", "_dir"];
private _config = configfile >> "CfgMarkers" >> _markerClassname;
_config = (configfile >> "CfgMarkers") >> _markerClassname;
if (!isClass _config) then {
WARNING("CfgMarker not found, changed to milDot");
_config == (configFile >> "CfgMarkers" >> "MilDot");
_config = configFile >> "CfgMarkers" >> "MilDot";
};
_marker setMarkerTypeLocal (configName _config);
_config = (configfile >> "CfgMarkerColors") >> _colorClassname;
_marker setMarkerTypeLocal configName _config;
_config = configfile >> "CfgMarkerColors" >> _colorClassname;
if (!isClass _config) then {
WARNING("CfgMarkerColors not found, changed to Default");
_config == (configFile >> "CfgMarkerColors" >> "Default");
_config = configFile >> "CfgMarkerColors" >> "Default";
};
_marker setMarkerColorLocal configName _config;
_marker setMarkerPosLocal _markerPos;
_marker setMarkerDirLocal _markerDir;
_marker setMarkerPosLocal _pos;
_marker setMarkerDirLocal _dir;
// save properties on server machine for JIP, marker editing ready
if (isMultiplayer && {isServer}) then {
private ["_allMapMarkers", "_allMapMarkersProperties", "_index"];
private _allMapMarkers = GETGVAR(allMapMarkers,[]);
private _allMapMarkersProperties = GETGVAR(allMapMarkersProperties,[]);
_allMapMarkers = GETGVAR(allMapMarkers,[]);
_allMapMarkersProperties = GETGVAR(allMapMarkersProperties,[]);
_index = _allMapMarkers find _marker;
private _index = _allMapMarkers find _marker;
if (_index == -1) then {
_allMapMarkers pushBack _marker;

View File

@ -10,3 +10,12 @@
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#define CHANNEL_NAMES [ \
localize "str_channel_global", \
localize "str_channel_side", \
localize "str_channel_command", \
localize "str_channel_group", \
localize "str_channel_vehicle", \
localize "str_channel_direct" \
]