mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Cleanup / Params
This commit is contained in:
parent
980fc7a235
commit
1f9a98f77d
@ -26,11 +26,11 @@ GVAR(drawing_controls) = [36732, 36733, 36734, 36735, 36736, 36737];
|
||||
_fnc_installMapEvents = {
|
||||
private "_d";
|
||||
_d = _this;
|
||||
((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["MouseMoving", {_this call FUNC(handleMouseMove);}];
|
||||
((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["MouseButtonDown", {[1, _this] call FUNC(handleMouseButton);}];
|
||||
((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["MouseButtonUp", {[0, _this] call FUNC(handleMouseButton)}];
|
||||
((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["Draw", {_this call FUNC(updateMapToolMarkers);}];
|
||||
(finddisplay _d) displayAddEventHandler ["KeyDown", {_this call FUNC(handleKeyDown);}];
|
||||
((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["MouseMoving", {_this call FUNC(handleMouseMove);}];
|
||||
((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["MouseButtonDown", {[1, _this] call FUNC(handleMouseButton);}];
|
||||
((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["MouseButtonUp", {[0, _this] call FUNC(handleMouseButton)}];
|
||||
((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["Draw", {_this call FUNC(updateMapToolMarkers);}];
|
||||
(findDisplay _d) displayAddEventHandler ["KeyDown", {_this call FUNC(handleKeyDown);}];
|
||||
};
|
||||
|
||||
// Wait until the briefing map is detected
|
||||
@ -70,8 +70,6 @@ GVAR(drawing_controls) = [36732, 36733, 36734, 36735, 36736, 36737];
|
||||
};
|
||||
|
||||
["mapOpened", {
|
||||
// Show and update map tools if required
|
||||
[] call FUNC(updateMapToolMarkers);
|
||||
// Show GPS if required
|
||||
[GVAR(mapGpsShow)] call FUNC(openMapGps);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_4(_name,_startPos,_endPos,_color);
|
||||
params ["_name", "_startPos", "_endPos", "_color"];
|
||||
|
||||
private ["_marker", "_difPos", "_mag"];
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
private ["_screenOffset", "_pos"];
|
||||
|
||||
_pos = ((finddisplay 12) displayctrl 51) ctrlMapScreenToWorld [0.5, 0.5];
|
||||
_screenOffset = ((finddisplay 12) displayctrl 51) posWorldToScreen [(_pos select 0) + 100, (_pos select 1)];
|
||||
_pos = ((findDisplay 12) displayCtrl 51) ctrlMapScreenToWorld [0.5, 0.5];
|
||||
_screenOffset = ((findDisplay 12) displayCtrl 51) posWorldToScreen [(_pos select 0) + 100, (_pos select 1)];
|
||||
|
||||
(_screenOffset select 0) - 0.5
|
||||
|
@ -12,7 +12,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_lineMarkers);
|
||||
params ["_lineMarkers"];
|
||||
|
||||
{
|
||||
private "_marker";
|
||||
|
@ -12,6 +12,6 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_requester);
|
||||
params ["_requester"];
|
||||
|
||||
["drawing_sendbackMarkers", _requester, [GVAR(drawing_lineMarkers)]] call EFUNC(common,targetEvent);
|
||||
|
@ -17,6 +17,6 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_player,_target);
|
||||
params ["_player", "_target"];
|
||||
|
||||
["drawing_requestMarkers", _target, [_player]] call EFUNC(common,targetEvent);
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_5(_display,_code,_shiftKey,_ctrlKey,_altKey);
|
||||
params ["", "_code"];
|
||||
|
||||
private ["_handled", "_relPos", "_diffVector", "_magDiffVector", "_lambdaLong", "_lambdaTrasAbs"];
|
||||
|
||||
@ -30,6 +30,7 @@ if (_code == DIK_ESCAPE) exitWith {
|
||||
call FUNC(cancelDrawing);
|
||||
_handled = true;
|
||||
};
|
||||
_handled
|
||||
};
|
||||
|
||||
if (_code == DIK_DELETE) exitWith {
|
||||
@ -65,6 +66,7 @@ if (_code == DIK_DELETE) exitWith {
|
||||
};
|
||||
} forEach GVAR(drawing_lineMarkers);
|
||||
};
|
||||
_handled
|
||||
};
|
||||
|
||||
_handled
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* Handle mouse buttons.
|
||||
*
|
||||
* Argument:
|
||||
@ -13,23 +12,18 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_control", "_button", "_screenPos", "_shiftKey", "_ctrlKey", "_handled", "_pos", "_altKey", "_gui", "_marker"];
|
||||
params ["_dir", "_params"];
|
||||
_params params ["_control", "_button", "_screenPosX", "_screenPosY", "_shiftKey", "_ctrlKey", "_altKey"];
|
||||
|
||||
PARAMS_2(_dir,_params);
|
||||
_control = _params select 0;
|
||||
_button = _params select 1;
|
||||
_screenPos = [_params select 2, _params select 3];
|
||||
_shiftKey = _params select 4;
|
||||
_ctrlKey = _params select 5;
|
||||
_altKey = _params select 6;
|
||||
_handled = false;
|
||||
private["_gui", "_handled", "_marker", "_pos"];
|
||||
|
||||
_handled = false;
|
||||
|
||||
// If it's not a left button event, exit
|
||||
if (_button != 0) exitWith {};
|
||||
if (_button != 0) exitWith {_handled};
|
||||
|
||||
// If releasing
|
||||
if (_dir != 1 && (GVAR(mapTool_isDragging) or GVAR(mapTool_isRotating))) exitWith {
|
||||
if ((_dir != 1) && {(GVAR(mapTool_isDragging) || GVAR(mapTool_isRotating))}) exitWith {
|
||||
GVAR(mapTool_isDragging) = false;
|
||||
GVAR(mapTool_isRotating) = false;
|
||||
_handled = true;
|
||||
@ -42,7 +36,7 @@ if (_dir == 1) exitWith {
|
||||
if !(call FUNC(canDraw)) exitWith {_handled = false;};
|
||||
|
||||
// Transform mouse screen position to coordinates
|
||||
_pos = _control ctrlMapScreenToWorld _screenPos;
|
||||
_pos = _control ctrlMapScreenToWorld [_screenPosX, _screenPosY];
|
||||
_pos set [count _pos, 0];
|
||||
|
||||
if (GVAR(drawing_isDrawing)) exitWith {
|
||||
@ -52,7 +46,7 @@ if (_dir == 1) exitWith {
|
||||
// [GVAR(drawing_tempLineMarker), "FUNC(addLineMarker)", 2] call EFUNC(common,execRemoteFnc);
|
||||
["drawing_addLineMarker", GVAR(drawing_tempLineMarker)] call EFUNC(common,globalEvent);
|
||||
// Log who drew on the briefing screen
|
||||
(text format ["[ACE] Server: Player %1 drew on the briefing screen", name player]) call EFUNC(common,serverLog);
|
||||
(text format ["[ACE] Server: Player %1 drew on the briefing screen", profileName]) call EFUNC(common,serverLog);
|
||||
} else {
|
||||
GVAR(drawing_tempLineMarker) call FUNC(updateLineMarker);
|
||||
GVAR(drawing_lineMarkers) pushBack (+GVAR(drawing_tempLineMarker));
|
||||
@ -96,6 +90,8 @@ if (_dir == 1) exitWith {
|
||||
};
|
||||
_handled = true;
|
||||
};
|
||||
|
||||
_handled
|
||||
};
|
||||
|
||||
_handled
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* Handle mouse movement over the map tool.
|
||||
*
|
||||
* Argument:
|
||||
@ -13,11 +12,11 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_control", "_mousePosX", "_mousePosY"];
|
||||
|
||||
private ["_control", "_pos"];
|
||||
|
||||
_control = _this select 0;
|
||||
_pos = [_this select 1, _this select 2];
|
||||
GVAR(mousePosition) = _control ctrlMapScreenToWorld _pos;
|
||||
GVAR(mousePosition) = _control ctrlMapScreenToWorld [_mousePosX, _mousePosY];
|
||||
GVAR(mousePosition) set [2, 0]; //convert 2d pos to 3d
|
||||
|
||||
// If cannot draw then exit
|
||||
|
@ -12,7 +12,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_shouldOpenGps);
|
||||
params ["_shouldOpenGps"];
|
||||
|
||||
private ["_isOpen"];
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_name);
|
||||
params ["_name"];
|
||||
|
||||
deleteMarkerLocal _name;
|
||||
{
|
||||
|
@ -13,7 +13,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_4(_name,_startPos,_endPos,_color);
|
||||
params ["_name", "_startPos", "_endPos", "_color"];
|
||||
|
||||
private ["_difPos", "_mag"];
|
||||
|
||||
|
@ -16,15 +16,15 @@
|
||||
#define CENTER_OFFSET_Y_PERC 0.1606
|
||||
#define CONSTANT_SCALE 0.2
|
||||
|
||||
PARAMS_1(_theMap);
|
||||
params ["_theMap"];
|
||||
|
||||
private ["_rotatingTexture", "_textureWidth", "_scale", "_xPos", "_yPos"];
|
||||
|
||||
// Show/Hide draw buttons
|
||||
if ("ACE_MapTools" in items ACE_player) then {
|
||||
{ ((finddisplay 12) displayctrl _x) ctrlShow true; } forEach GVAR(drawing_controls);
|
||||
{ ((findDisplay 12) displayCtrl _x) ctrlShow true; } forEach GVAR(drawing_controls);
|
||||
} else {
|
||||
{ ((finddisplay 12) displayctrl _x) ctrlShow false; } forEach GVAR(drawing_controls);
|
||||
{ ((findDisplay 12) displayCtrl _x) ctrlShow false; } forEach GVAR(drawing_controls);
|
||||
if (GVAR(drawing_isDrawing)) then {
|
||||
call FUNC(cancelDrawing);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user