work on port markers

This commit is contained in:
commy2
2015-01-18 17:17:06 +01:00
parent cb8945a879
commit a545efe02c
19 changed files with 548 additions and 558 deletions

View File

@ -12,13 +12,13 @@
*/
#include "script_component.hpp"
EXPLODE_4_PVT(_this,_func,_params,_delay,_interval);
EXPLODE_3_PVT(_this,_func,_params,_delay,_interval);
[
{
EXPLODE_2_PVT(_this,_params,_pfhId);
EXPLODE_2_PVT(_params,_delayedExecParams,_startFrame);
EXPLODE_3_PVT(_delayedExecParams,_func,_funcParams);
EXPLODE_2_PVT(_delayedExecParams,_func,_funcParams);
// Exit if we are still on the same frame
if (diag_frameno == _startFrame) exitWith {};

View File

@ -11,8 +11,8 @@ class RscSlider;
class RscXSliderH;
class RscDisplayInsertMarker {
onLoad = "_this call compile preprocessFileLineNumbers 'AGM_Markers\scripts\initInsertMarker.sqf'";
onUnload = "_this call compile preprocessFileLineNumbers 'AGM_Markers\scripts\placeMarker.sqf'";
onLoad = QUOTE(_this call FUNC(initInsertMarker););
onUnload = QUOTE(_this call FUNC(placeMarker););
idd = 54;
movingEnable = 1;
class controlsBackground {

View File

@ -1,7 +1,16 @@
// by commy2
#include "script_component.hpp"
// recieve remote marker data
[QGVAR(setMarkerNetwork), FUNC(setMarkerNetwork)] call EFUNC(common,addEventHandler);
// recieve marker data for JIP
[QGVAR(setMarkerJIP), FUNC(setMarkerJIP)] call EFUNC(common,addEventHandler);
// request marker data for JIP
if (isMultiplayer && {!isServer}) then {
if (isMultiplayer && {!isServer} && {hasInterface}) then {
private "_logic";
_logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"];
[_logic, "AGM_Markers_fnc_sendMarkersJIP", 1] call AGM_Core_fnc_execRemoteFnc;
[QGVAR(sendMarkersJIP), _logic] call EFUNC(common,serverEvent);
};

View File

@ -6,6 +6,69 @@ PREP(onLBSelChangedShape);
PREP(onSliderPosChangedAngle);
PREP(placeMarker);
PREP(sendMarkersJIP);
PREP(setMarker);
PREP(setMarkerJIP);
PREP(setMarkerNetwork);
// init marker types
if (isNil QGVAR(MarkersCache)) then {
_config = configfile >> "CfgMarkers";
_index = 0;
GVAR(MarkersCache) = [];
for "_a" from 0 to (count _config - 1) do {
_marker = _config select _a;
_scope = getNumber (_marker >> "scope");
_name = getText (_marker >> "name");
_icon = getText (_marker >> "icon");
if (_scope == 2) then {
_shape lbAdd _name;
_shape lbSetValue [_index, _a];
_shape lbSetPicture [_index, _icon];
GVAR(MarkersCache) pushBack [_name, _a, _icon];
_index = _index + 1;
};
};
};
// init marker colors
if (isNil QGVAR(MarkerColorsCache)) then {
_config = configfile >> "CfgMarkerColors";
_index = 0;
GVAR(MarkerColorsCache) = [];
for "_a" from 0 to (count _config - 1) do {
_marker = _config select _a;
_scope = getNumber (_marker >> "scope");
_name = getText (_marker >> "name");
if (_scope == 2) then {
_color lbAdd _name;
_color lbSetValue [_index, _a];
_rgba = getArray (_marker >> "color");
{
if (typeName _x != "SCALAR") then {
_rgba set [_forEachIndex, call compile _x];
};
} 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];
_color lbSetPicture [_index, _icon];
GVAR(MarkerColorsCache) pushBack [_name, _a, _icon];
_index = _index + 1;
};
};
};
[QGVAR(sendMarkersJIP), FUNC(sendMarkersJIP)] call EFUNC(common,addEventHandler);

View File

@ -1,15 +0,0 @@
// by commy2
private "_logic";
_logic = _this;
[
[
missionNamespace getVariable ["AGM_allMapMarkers", []],
missionNamespace getVariable ["AGM_allMapMarkersProperties", []],
_logic
],
"AGM_Markers_fnc_setMarkerJIP",
_logic
] call AGM_Core_fnc_execRemoteFnc;

View File

@ -1,15 +0,0 @@
// by commy2
private ["_marker", "_data", "_config"];
_marker = _this select 0;
_data = _this select 1;
_config = (configfile >> "CfgMarkers") select (_data select 0);
[[_marker, configName _config], "{if ((_this select 0) in allMapMarkers) then {(_this select 0) setMarkerTypeLocal (_this select 1)};}", 2] call AGM_Core_fnc_execRemoteFnc;
_config = (configfile >> "CfgMarkerColors") select (_data select 1);
[[_marker, configName _config], "{if ((_this select 0) in allMapMarkers) then {(_this select 0) setMarkerColorLocal (_this select 1)};}", 2] call AGM_Core_fnc_execRemoteFnc;
[[_marker, _data select 2], "{if ((_this select 0) in allMapMarkers) then {(_this select 0) setMarkerPosLocal (_this select 1)};}", 2] call AGM_Core_fnc_execRemoteFnc;
[[_marker, _data select 3], "{if ((_this select 0) in allMapMarkers) then {(_this select 0) setMarkerDirLocal (_this select 1)};}", 2] call AGM_Core_fnc_execRemoteFnc;

View File

@ -1,26 +0,0 @@
// by commy2
private ["_allMapMarkers", "_allMapMarkersProperties", "_index", "_data", "_config"];
_allMapMarkers = _this select 0;
_allMapMarkersProperties = _this select 1;
_logic = _this select 2;
{
_index = _allMapMarkers find _x;
if (_index != -1) then {
_data = _allMapMarkersProperties select _index;
_config = (configfile >> "CfgMarkers") select (_data select 0);
_x setMarkerTypeLocal configName _config;
_config = (configfile >> "CfgMarkerColors") select (_data select 1);
_x setMarkerColorLocal configName _config;
_x setMarkerPosLocal (_data select 2);
_x setMarkerDirLocal (_data select 3);
};
} forEach allMapMarkers;
deleteVehicle _logic;

View File

@ -1,36 +0,0 @@
// by commy2
private ["_marker", "_data", "_config"];
_marker = _this select 0;
_data = _this select 1;
_config = (configfile >> "CfgMarkers") select (_data select 0);
_marker setMarkerTypeLocal configName _config;
_config = (configfile >> "CfgMarkerColors") select (_data select 1);
_marker setMarkerColorLocal configName _config;
_marker setMarkerPosLocal (_data select 2);
_marker setMarkerDirLocal (_data select 3);
// save properties on server machine for JIP, marker editing ready
if (isMultiplayer && {isServer}) then {
private ["_allMapMarkers", "_allMapMarkersProperties", "_index"];
_allMapMarkers = missionNamespace getVariable ["AGM_allMapMarkers", []];
_allMapMarkersProperties = missionNamespace getVariable ["AGM_allMapMarkersProperties", []];
_index = _allMapMarkers find _marker;
if (_index == -1) then {
_allMapMarkers pushBack _marker;
_allMapMarkersProperties pushBack _data;
} else {
_allMapMarkers set [_index, _marker];
_allMapMarkersProperties set [_index, _data];
};
AGM_allMapMarkers = _allMapMarkers;
AGM_allMapMarkersProperties = _allMapMarkersProperties;
};

View File

@ -0,0 +1,201 @@
// stuff taken from bohemia, edited by commy2
#include "script_component.hpp"
#define BORDER 0.005
[{
with uinamespace do {
disableserialization;
_display = _this select 0;
//Prevent Captive Players from placing markers
/*if (ACE_player getVariable ["ACE_isCaptive", false]) exitWith {
_display closeDisplay 2; //emulate "Cancel" button
};*/
// prevent vanilla key input
_display displayAddEventHandler ["KeyDown", {(_this select 1) in [200, 208]}];
_text = _display displayctrl 101;
_picture = _display displayctrl 102;
_buttonOK = _display displayctrl 1;
_buttonCancel = _display displayctrl 2;
_description = _display displayctrl 1100;
_title = _display displayctrl 1001;
_sizeX = _display displayctrl 1200;
_sizeY = _display displayctrl 1201;
_shape = _display displayctrl 1210;
_color = _display displayctrl 1211;
_angle = _display displayctrl 1220;
_angleText = _display displayctrl 1221;
ctrlSetFocus _text;
//Change ok button's text based on current channel
if (isNull _buttonOK) exitWith {true};
_textColor = [1,1,1,1];
switch (call EFUNC(common,currentChannel)) do {
case ("global"): {
_channel = localize "str_channel_global";
_textColor = [(216/255),(216/255),(216/255),1];
};
case ("side"): {
_channel = localize "str_channel_side";
_textColor = [(70/255),(211/255),(252/255),1];
};
case ("group"): {
_channel = localize "str_channel_group";
_textColor = [(181/255),(248/255),(98/255),1];
};
case ("vehicle"): {
_channel = localize "str_channel_vehicle";
_textColor = [(255/255),(208/255),(0/255),1];
};
case ("direct"): {
_channel = localize "str_channel_direct";
_textColor = [(255/255),(255/255),(255/255),1];
};
case ("command"): {
_channel = localize "str_channel_command";
_textColor = [(255/255),(255/255),(70/255),1];
};
};
//If localization not found, then don't touch anything (default is RscButtonMenuOK's localized text)
if (_channel != "") then {
_buttonOK ctrlSetTextColor _textColor;
_buttonOK ctrlSetText format [localize "STR_ACE_Markers_PlaceIn", _channel];
};
//--- Background
_pos = ctrlposition _text;
_posX = (_pos select 0) + 0.01;
_posY = _pos select 1;
_posW = _pos select 2;
_posH = _pos select 3;
_posY = _posY min ((safeZoneH + safeZoneY) - (6 * _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;
//--- Title
_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 ctrlsetposition _pos;
_description ctrlsetstructuredtext parsetext format ["<t size='0.8'>%1</t>","Description:"]; //--- ToDo: Localze
_description ctrlcommit 0;
_activeColor = (["IGUI","WARNING_RGB"] call bis_fnc_displaycolorget) call bis_fnc_colorRGBtoHTML;
//--- Shape
_pos set [1,_posY + 1 * _posH + 2 * BORDER];
_pos set [2,_posW];
_pos set [3,_posH];
_shape ctrlsetposition _pos;
_shape ctrlcommit 0;
//--- Color
_pos set [1,_posY + 2 * _posH + 3 * BORDER];
_pos set [2,_posW];
_color ctrlsetposition _pos;
_color ctrlcommit 0;
//--- Angle
_pos set [1,_posY + 3 * _posH + 4 * BORDER];
_pos set [2,_posW];
_angle ctrlsetposition _pos;
_angle ctrlcommit 0;
//--- Angle Text
_pos set [1,_posY + 4 * _posH + 5 * BORDER];
_pos set [2,_posW];
_angleText ctrlsetposition _pos;
_angleText ctrlcommit 0;
//--- ButtonOK
_pos set [1,_posY + 5 * _posH + 7 * BORDER];
_pos set [2,_posW * (8.9/10) - BORDER];
_buttonOk ctrlsetposition _pos;
_buttonOk ctrlcommit 0;
//--- ButtonCancel
_pos set [0,_posX + _posW * (8.9 / 10)];
_pos set [2,_posW * (1.1 / 10)];
_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;*/
// init marker shape lb
{
_shape lbAdd (_x select 0);
_shape lbSetValue [_forEachIndex, _x select 1];
_shape lbSetPicture [_forEachIndex, _x select 2];
} forEach GVAR(MarkersCache);
_shape ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChangedShape)}];
_curSelShape = GETMVAR(curSelMarkerShape,0);
_shape lbSetCurSel _curSelShape;
_data = _shape lbValue _curSelShape;
_config = (configfile >> "CfgMarkers") select _data;
_icon = getText (_config >> "icon");
_picture ctrlSetText _icon;
// init marker color lb
{
_color lbAdd (_x select 0);
_color lbSetValue [_forEachIndex, _x select 1];
_color lbSetPicture [_forEachIndex, _x select 2];
} forEach GVAR(MarkerColorsCache);
_color ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChangedColor)}];
_curSelColor = GETMVAR(curSelMarkerColor,0);
_color lbSetCurSel _curSelColor;
_data = _color lbValue _curSelColor;
_config = (configfile >> "CfgMarkerColors") select _data;
_rgba = getArray (_config >> "color");
{
if (typeName _x != "SCALAR") then {
_rgba set [_forEachIndex, call compile _x];
};
} forEach _rgba;
_picture ctrlSetTextColor _rgba;
// init marker angle slider
_angle sliderSetRange [-180, 180];
_angle ctrlAddEventHandler ["SliderPosChanged", {_this call FUNC(onSliderPosChangedAngle)}];
_curSelAngle = GETMVAR(curSelMarkerAngle,0);
_angle sliderSetPosition _curSelAngle;
_curSelAngle = round _curSelAngle;
if (_curSelAngle < 0) then {
_curSelAngle = _curSelAngle + 360;
};
_angleText ctrlSetText format [localize "STR_ACE_Markers_MarkerDirection", _curSelAngle];
};
}, _this] call EFUNC(common,execNextFrame);

View File

@ -1,11 +1,12 @@
// by commy2
#include "script_component.hpp"
private ["_ctrl", "_data", "_config", "_color"];
_ctrl = _this select 0;
_data = _ctrl lbValue (_this select 1);
uiNamespace setVariable ["AGM_Markers_curSelMarkerColor", _this select 1];
GVAR(curSelMarkerColor) = _this select 1;
_config = (configfile >> "CfgMarkerColors") select _data;
@ -19,4 +20,4 @@ _color = getArray (_config >> "color");
((ctrlParent _ctrl) displayCtrl 102) ctrlSetTextColor _color;
uiNamespace setVariable ["AGM_Markers_currentMarkerColor", _data];
GVAR(currentMarkerColor) = _data;

View File

@ -1,11 +1,12 @@
// by commy2
#include "script_component.hpp"
private ["_ctrl", "_data", "_config", "_icon"];
_ctrl = _this select 0;
_data = _ctrl lbValue (_this select 1);
uiNamespace setVariable ["AGM_Markers_curSelMarkerShape", _this select 1];
GVAR(curSelMarkerShape) = _this select 1;
_config = (configfile >> "CfgMarkers") select _data;
@ -13,4 +14,4 @@ _icon = getText (_config >> "icon");
((ctrlParent _ctrl) displayCtrl 102) ctrlSetText _icon;
uiNamespace setVariable ["AGM_Markers_currentMarkerShape", _data];
GVAR(currentMarkerShape) = _data;

View File

@ -1,17 +1,18 @@
// by commy2
#include "script_component.hpp"
private ["_ctrl", "_data", "_direction"];
_ctrl = _this select 0;
_data = _this select 1;
uiNamespace setVariable ["AGM_Markers_curSelMarkerAngle", _data];
GVAR(curSelMarkerAngle) = _data;
_direction = round _data;
if (_direction < 0) then {
_direction = _direction + 360;
};
((ctrlParent _ctrl) displayCtrl 1221) ctrlSetText format [localize "STR_AGM_Markers_MarkerDirection", _direction];
((ctrlParent _ctrl) displayCtrl 1221) ctrlSetText format [localize "STR_ACE_Markers_MarkerDirection", _direction];
uiNamespace setVariable ["AGM_Markers_currentMarkerAngle", _data];
GVAR(currentMarkerAngle) = _data;

View File

@ -0,0 +1,44 @@
// by commy2
#include "script_component.hpp"
if (_this select 1 == 1) then {
disableserialization;
_display = _this select 0;
_pos = ctrlPosition (_display displayCtrl 102);
_pos = [
(_pos select 0) + (_pos select 2) / 2,
(_pos select 1) + (_pos select 3) / 2
];
switch (true) do {
case (!isNull findDisplay 12): {
_pos = (findDisplay 12 displayCtrl 51) ctrlMapScreenToWorld _pos;
};
case (!isNull findDisplay 37): {
_pos = (findDisplay 37 displayCtrl 51) ctrlMapScreenToWorld _pos;
};
case (!isNull findDisplay 52): {
_pos = (findDisplay 52 displayCtrl 51) ctrlMapScreenToWorld _pos;
};
case (!isNull findDisplay 53): {
_pos = (findDisplay 53 displayCtrl 51) ctrlMapScreenToWorld _pos;
};
};
// set and send marker data the next frame. the actual marker isn't created yet
[
{
["setMarkerNetwork", [
GETMVAR(currentMarkerShape,0),
GETMVAR(currentMarkerColor,0),
_this,
GETMVAR(currentMarkerAngle,0)
]] call EFUNC(common,globalEvent);
},
_pos
] call EFUNC(common,execNextFrame);
};

View File

@ -0,0 +1,13 @@
// by commy2
#include "script_component.hpp"
private "_logic";
_logic = _this;
[QGVAR(setMarkerJIP), _logic, [
GETMVAR(allMapMarkers,[]),
GETMVAR(allMapMarkersProperties,[]),
_logic
]
] call EFUNC(common,targetEvent);

View File

@ -0,0 +1,27 @@
// by commy2
#include "script_component.hpp"
private ["_allMapMarkers", "_allMapMarkersProperties", "_index", "_data", "_config"];
_allMapMarkers = _this select 0;
_allMapMarkersProperties = _this select 1;
_logic = _this select 2;
{
_index = _allMapMarkers find _x;
if (_index != -1) then {
_data = _allMapMarkersProperties select _index;
_config = (configfile >> "CfgMarkers") select (_data select 0);
_x setMarkerTypeLocal configName _config;
_config = (configfile >> "CfgMarkerColors") select (_data select 1);
_x setMarkerColorLocal configName _config;
_x setMarkerPosLocal (_data select 2);
_x setMarkerDirLocal (_data select 3);
};
} forEach allMapMarkers;
deleteVehicle _logic;

View File

@ -0,0 +1,37 @@
// by commy2
#include "script_component.hpp"
private ["_marker", "_data", "_config"];
_marker = _this select 0;
_data = _this select 1;
_config = (configfile >> "CfgMarkers") select (_data select 0);
_marker setMarkerTypeLocal configName _config;
_config = (configfile >> "CfgMarkerColors") select (_data select 1);
_marker setMarkerColorLocal configName _config;
_marker setMarkerPosLocal (_data select 2);
_marker setMarkerDirLocal (_data select 3);
// save properties on server machine for JIP, marker editing ready
if (isMultiplayer && {isServer}) then {
private ["_allMapMarkers", "_allMapMarkersProperties", "_index"];
_allMapMarkers = GETMVAR(allMapMarkers,[]);
_allMapMarkersProperties = GETMVAR(allMapMarkersProperties,[]);
_index = _allMapMarkers find _marker;
if (_index == -1) then {
_allMapMarkers pushBack _marker;
_allMapMarkersProperties pushBack _data;
} else {
_allMapMarkers set [_index, _marker];
_allMapMarkersProperties set [_index, _data];
};
GVAR(allMapMarkers) = _allMapMarkers;
GVAR(allMapMarkersProperties) = _allMapMarkersProperties;
};

View File

@ -1,265 +0,0 @@
// stuff taken from bohemia, edited by commy2
#define BORDER 0.005
with uinamespace do {
_this spawn {
disableserialization;
_display = _this select 0;
//Prevent Captive Players from placing markers
if (AGM_player getVariable ["AGM_isCaptive", false]) exitWith {
_display closeDisplay 2; //emulate "Cancel" button
};
// display vanilla key input
_display displayAddEventHandler ["KeyDown", {(_this select 1) in [200, 208]}];
_text = _display displayctrl 101;
_picture = _display displayctrl 102;
_buttonOK = _display displayctrl 1;
_buttonCancel = _display displayctrl 2;
_description = _display displayctrl 1100;
_title = _display displayctrl 1001;
_sizeX = _display displayctrl 1200;
_sizeY = _display displayctrl 1201;
_shape = _display displayctrl 1210;
_color = _display displayctrl 1211;
_angle = _display displayctrl 1220;
_angleText = _display displayctrl 1221;
ctrlSetFocus _text;
//Change ok button's text based on current channel
[_buttonOK] spawn {
disableserialization;
private ["_buttonOK", "_channel", "_textColor"];
_buttonOK = _this select 0;
waitUntil {
if (isNull _buttonOK) exitWith {true};
_textColor = [1,1,1,1];
switch (call AGM_Core_fnc_currentChannel) do {
case ("global"): {
_channel = localize "str_channel_global";
_textColor = [(216/255),(216/255),(216/255),1];
};
case ("side"): {
_channel = localize "str_channel_side";
_textColor = [(70/255),(211/255),(252/255),1];
};
case ("group"): {
_channel = localize "str_channel_group";
_textColor = [(181/255),(248/255),(98/255),1];
};
case ("vehicle"): {
_channel = localize "str_channel_vehicle";
_textColor = [(255/255),(208/255),(0/255),1];
};
case ("direct"): {
_channel = localize "str_channel_direct";
_textColor = [(255/255),(255/255),(255/255),1];
};
case ("command"): {
_channel = localize "str_channel_command";
_textColor = [(255/255),(255/255),(70/255),1];
};
};
//If localization not found, then don't touch anything (default is RscButtonMenuOK's localized text)
if (_channel != "") then {
_buttonOK ctrlSetTextColor _textColor;
_buttonOK ctrlSetText format [localize "STR_AGM_Markers_PlaceIn", _channel];
};
false
};
};
//--- Background
_pos = ctrlposition _text;
_posX = (_pos select 0) + 0.01;
_posY = _pos select 1;
_posW = _pos select 2;
_posH = _pos select 3;
_posY = _posY min ((safeZoneH + safeZoneY) - (6 * _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;
//--- Title
_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 ctrlsetposition _pos;
_description ctrlsetstructuredtext parsetext format ["<t size='0.8'>%1</t>","Description:"]; //--- ToDo: Localze
_description ctrlcommit 0;
_activeColor = (["IGUI","WARNING_RGB"] call bis_fnc_displaycolorget) call bis_fnc_colorRGBtoHTML;
//--- Shape
_pos set [1,_posY + 1 * _posH + 2 * BORDER];
_pos set [2,_posW];
_pos set [3,_posH];
_shape ctrlsetposition _pos;
_shape ctrlcommit 0;
//--- Color
_pos set [1,_posY + 2 * _posH + 3 * BORDER];
_pos set [2,_posW];
_color ctrlsetposition _pos;
_color ctrlcommit 0;
//--- Angle
_pos set [1,_posY + 3 * _posH + 4 * BORDER];
_pos set [2,_posW];
_angle ctrlsetposition _pos;
_angle ctrlcommit 0;
//--- Angle Text
_pos set [1,_posY + 4 * _posH + 5 * BORDER];
_pos set [2,_posW];
_angleText ctrlsetposition _pos;
_angleText ctrlcommit 0;
//--- ButtonOK
_pos set [1,_posY + 5 * _posH + 7 * BORDER];
_pos set [2,_posW * (8.9/10) - BORDER];
_buttonOk ctrlsetposition _pos;
_buttonOk ctrlcommit 0;
//--- ButtonCancel
_pos set [0,_posX + _posW * (8.9 / 10)];
_pos set [2,_posW * (1.1 / 10)];
_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;*/
// init marker shape lb
_config = configfile >> "CfgMarkers";
_index = 0;
if (isNil "AGM_Markers_MarkersCache") then {
AGM_Markers_MarkersCache = [];
for "_a" from 0 to (count _config - 1) do {
_marker = _config select _a;
_scope = getNumber (_marker >> "scope");
_name = getText (_marker >> "name");
_icon = getText (_marker >> "icon");
if (_scope == 2) then {
_shape lbAdd _name;
_shape lbSetValue [_index, _a];
_shape lbSetPicture [_index, _icon];
AGM_Markers_MarkersCache pushBack [_name, _a, _icon];
_index = _index + 1;
};
};
} else {
{
_shape lbAdd (_x select 0);
_shape lbSetValue [_forEachIndex, _x select 1];
_shape lbSetPicture [_forEachIndex, _x select 2];
} forEach AGM_Markers_MarkersCache;
};
_shape ctrlAddEventHandler ["LBSelChanged", {_this call AGM_Markers_fnc_onLBSelChangedShape}];
_curSelShape = uiNamespace getVariable ["AGM_Markers_curSelMarkerShape", 0];
_shape lbSetCurSel _curSelShape;
_data = _shape lbValue _curSelShape;
_config = (configfile >> "CfgMarkers") select _data;
_icon = getText (_config >> "icon");
_picture ctrlSetText _icon;
// init marker color lb
_config = configfile >> "CfgMarkerColors";
_index = 0;
if (isNil "AGM_Markers_MarkerColorsCache") then {
AGM_Markers_MarkerColorsCache = [];
for "_a" from 0 to (count _config - 1) do {
_marker = _config select _a;
_scope = getNumber (_marker >> "scope");
_name = getText (_marker >> "name");
if (_scope == 2) then {
_color lbAdd _name;
_color lbSetValue [_index, _a];
_rgba = getArray (_marker >> "color");
{
if (typeName _x != "SCALAR") then {
_rgba set [_forEachIndex, call compile _x];
};
} 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];
_color lbSetPicture [_index, _icon];
AGM_Markers_MarkerColorsCache pushBack [_name, _a, _icon];
_index = _index + 1;
};
};
} else {
{
_color lbAdd (_x select 0);
_color lbSetValue [_forEachIndex, _x select 1];
_color lbSetPicture [_forEachIndex, _x select 2];
} forEach AGM_Markers_MarkerColorsCache;
};
_color ctrlAddEventHandler ["LBSelChanged", {_this call AGM_Markers_fnc_onLBSelChangedColor}];
_curSelColor = uiNamespace getVariable ["AGM_Markers_curSelMarkerColor", 0];
_color lbSetCurSel _curSelColor;
_data = _color lbValue _curSelColor;
_config = (configfile >> "CfgMarkerColors") select _data;
_rgba = getArray (_config >> "color");
{
if (typeName _x != "SCALAR") then {
_rgba set [_forEachIndex, call compile _x];
};
} forEach _rgba;
_picture ctrlSetTextColor _rgba;
// init marker angle slider
_angle sliderSetRange [-180, 180];
_angle ctrlAddEventHandler ["SliderPosChanged", {_this call AGM_Markers_fnc_onSliderPosChangedAngle}];
_curSelAngle = uiNamespace getVariable ["AGM_Markers_curSelMarkerAngle", 0];
_angle sliderSetPosition _curSelAngle;
_curSelAngle = round _curSelAngle;
if (_curSelAngle < 0) then {
_curSelAngle = _curSelAngle + 360;
};
_angleText ctrlSetText format [localize "STR_AGM_Markers_MarkerDirection", _curSelAngle];
};
};

View File

@ -1,51 +0,0 @@
// by commy2
if (_this select 1 == 1) then {
disableserialization;
_display = _this select 0;
_pos = ctrlPosition (_display displayCtrl 102);
_pos = [
(_pos select 0) + (_pos select 2) / 2,
(_pos select 1) + (_pos select 3) / 2
];
switch (true) do {
case (!isNull findDisplay 12) : {
_pos = (findDisplay 12 displayCtrl 51) ctrlMapScreenToWorld _pos;
};
case (!isNull findDisplay 37) : {
_pos = (findDisplay 37 displayCtrl 51) ctrlMapScreenToWorld _pos;
};
case (!isNull findDisplay 52) : {
_pos = (findDisplay 52 displayCtrl 51) ctrlMapScreenToWorld _pos;
};
case (!isNull findDisplay 53) : {
_pos = (findDisplay 53 displayCtrl 51) ctrlMapScreenToWorld _pos;
};
};
_pos spawn {
/*[
allMapMarkers select (count allMapMarkers - 1),
[
uiNamespace getVariable ['AGM_Markers_currentMarkerShape', 0],
uiNamespace getVariable ['AGM_Markers_currentMarkerColor', 0],
_this,
uiNamespace getVariable ['AGM_Markers_currentMarkerAngle', 0]
]
] call AGM_Markers_fnc_setMarker;*/
[
[
allMapMarkers select (count allMapMarkers - 1),
[
uiNamespace getVariable ['AGM_Markers_currentMarkerShape', 0],
uiNamespace getVariable ['AGM_Markers_currentMarkerColor', 0],
_this,
uiNamespace getVariable ['AGM_Markers_currentMarkerAngle', 0]
]
], "AGM_Markers_fnc_setMarkerNetwork", 2
] call AGM_Core_fnc_execRemoteFnc;
};
};

View File

@ -0,0 +1 @@
#include "\z\ace\addons\markers\script_component.hpp"