mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge remote-tracking branch 'origin/master' into allTheMissiles
This commit is contained in:
commit
87dac2c2ad
@ -28,3 +28,21 @@ class RscDisplayInventory {
|
||||
class RscDisplayChannel {
|
||||
onLoad = QUOTE(_this call FUNC(onLoadRscDisplayChannel));
|
||||
};
|
||||
|
||||
// map
|
||||
class RscDisplayMainMap {
|
||||
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'Ingame')])] call FUNC(localEvent););
|
||||
};
|
||||
|
||||
class RscDisplayGetReady: RscDisplayMainMap {
|
||||
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'Briefing')])] call FUNC(localEvent););
|
||||
};
|
||||
|
||||
class RscDisplayServerGetReady: RscDisplayGetReady {
|
||||
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'ServerBriefing')])] call FUNC(localEvent););
|
||||
};
|
||||
|
||||
|
||||
class RscDisplayClientGetReady: RscDisplayGetReady {
|
||||
onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'ClientBriefing')])] call FUNC(localEvent););
|
||||
};
|
||||
|
@ -19,7 +19,8 @@ if (!isLightOn _vehicle) exitWith {[]};
|
||||
|
||||
private ["_reflectorsWithSelections", "_lights", "_hitpoints"];
|
||||
|
||||
_reflectorsWithSelections = [_vehicle] call FUNC(getReflectorsWithSelections);
|
||||
_reflectorsWithSelections = [[_vehicle], FUNC(getReflectorsWithSelections), uiNamespace, format [QEGVAR(cache,%1_%2), QUOTE(DFUNC(getReflectorsWithSelections)), typeOf _vehicle], 1E11] call FUNC(cachedCall);
|
||||
//_reflectorsWithSelections = [_vehicle] call FUNC(getReflectorsWithSelections);
|
||||
|
||||
_lights = _reflectorsWithSelections select 0;
|
||||
_hitpoints = _reflectorsWithSelections select 1;
|
||||
|
@ -46,7 +46,8 @@ if (_lightSource isKindOf "CAManBase") then {
|
||||
default {""};
|
||||
};
|
||||
|
||||
_properties = [_flashlight] call FUNC(getLightPropertiesWeapon);
|
||||
_properties = [[_flashlight], FUNC(getLightPropertiesWeapon), uiNamespace, format [QEGVAR(cache,%1_%2), QUOTE(DFUNC(getLightPropertiesWeapon)), _flashlight], 1E11] call FUNC(cachedCall);
|
||||
//_properties = [_flashlight] call FUNC(getLightPropertiesWeapon);
|
||||
|
||||
_innerAngle = (_properties select 3) / 2;
|
||||
_outerAngle = (_properties select 4) / 2;
|
||||
@ -70,7 +71,8 @@ if (_lightSource isKindOf "CAManBase") then {
|
||||
{
|
||||
private ["_properties", "_intensity", "_innerAngle", "_outerAngle", "_position", "_direction", "_directionToUnit", "_distance", "_angle"];
|
||||
|
||||
_properties = [_lightSource, _x] call FUNC(getLightProperties);
|
||||
_properties = [[_lightSource, _x], FUNC(getLightProperties), uiNamespace, format [QEGVAR(cache,%1_%2_%3), QUOTE(DFUNC(getLightProperties)), typeOf _lightSource, _x], 1E11] call FUNC(cachedCall);
|
||||
//_properties = [_lightSource, _x] call FUNC(getLightProperties);
|
||||
|
||||
// @todo intensity affects range?
|
||||
//_intensity = _properties select 0;
|
||||
@ -94,6 +96,14 @@ if (_lightSource isKindOf "CAManBase") then {
|
||||
|
||||
} forEach _lights;
|
||||
|
||||
// handle campfires
|
||||
if (inflamed _lightSource) then {
|
||||
private "_distance";
|
||||
_distance = _unitPos distance position _lightSource;
|
||||
|
||||
_lightLevel = _lightLevel max linearConversion [0, 30, _distance, 0.5, 0, true];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
_lightLevel
|
||||
|
@ -81,7 +81,7 @@ if (!isServer) then {
|
||||
|
||||
_index = _files find _x;
|
||||
if (_index == -1) then {
|
||||
_missingAddons pushBack _x;
|
||||
if (_x != "ace_serverconfig") then {_missingAddons pushBack _x;};
|
||||
} else {
|
||||
|
||||
_clientVersion = _versions select _index;
|
||||
|
@ -36,6 +36,15 @@ class CfgVehicles {
|
||||
class No { name = "No"; value = 0; default = 1;};
|
||||
};
|
||||
};
|
||||
class MapShowCursorCoordinates {
|
||||
displayName = "Show cursor coordinates?";
|
||||
description = "Show the grid coordinates on the mouse pointer?";
|
||||
typeName = "BOOL";
|
||||
class values {
|
||||
class Yes { name = "Yes"; value = 1; };
|
||||
class No { name = "No"; value = 0; default = 1;};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -8,6 +8,7 @@ PREP(blueForceTrackingUpdate);
|
||||
PREP(determineMapLight);
|
||||
PREP(determineZoom);
|
||||
PREP(moduleMap);
|
||||
PREP(onDrawMap);
|
||||
PREP(updateMapEffects);
|
||||
|
||||
ADDON = true;
|
||||
|
@ -48,6 +48,10 @@ class ACE_Settings {
|
||||
value = 0;
|
||||
typeName = "BOOL";
|
||||
};
|
||||
class GVAR(mapShowCursorCoordinates) {
|
||||
value = 0;
|
||||
typeName = "BOOL";
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
@ -85,7 +89,8 @@ class RscMapControl {
|
||||
class RscDisplayMainMap {
|
||||
// Tweak map styling
|
||||
class controlsBackground {
|
||||
class CA_Map : RscMapControl {
|
||||
class CA_Map: RscMapControl {
|
||||
onDraw = QUOTE([ctrlParent (_this select 0)] call DFUNC(onDrawMap));
|
||||
#include "MapTweaks.hpp"
|
||||
};
|
||||
};
|
||||
@ -143,6 +148,13 @@ class RscDisplayDiary {
|
||||
|
||||
// BRIEFING SCREEN
|
||||
class RscDisplayGetReady: RscDisplayMainMap {
|
||||
// Tweak map styling
|
||||
class controlsBackground {
|
||||
class CA_Map: RscMapControl {
|
||||
onDraw = QUOTE([ctrlParent (_this select 0)] call DFUNC(onDrawMap));
|
||||
//#include "MapTweaks.hpp" @todo Shouldn't this apply to briefing too?
|
||||
};
|
||||
};
|
||||
// get rid of the "center to player position" - button (as it works even on elite)
|
||||
class controls {
|
||||
class TopRight: RscControlsGroup {
|
||||
|
@ -15,8 +15,9 @@ _activated = _this select 2;
|
||||
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
[_logic, QGVAR(mapIllumination), "MapIllumination"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(mapShake), "MapShake" ] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(mapLimitZoom), "MapLimitZoom" ] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(mapIllumination), "MapIllumination" ] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(mapShake), "MapShake" ] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(mapLimitZoom), "MapLimitZoom" ] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(mapShowCursorCoordinates), "MapShowCursorCoordinates"] call EFUNC(common,readSettingFromModule);
|
||||
|
||||
diag_log text "[ACE]: Interaction Module Initialized.";
|
||||
|
4
addons/map/functions/fnc_onDrawMap.sqf
Normal file
4
addons/map/functions/fnc_onDrawMap.sqf
Normal file
@ -0,0 +1,4 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
((_this select 0) displayCtrl 1016) ctrlShow GVAR(mapShowCursorCoordinates);
|
@ -1,26 +0,0 @@
|
||||
// MARKERS
|
||||
class CfgMarkers {
|
||||
class ACE_MapToolFixed {
|
||||
name = "MapToolFixed";
|
||||
icon = PATHTOF(data\mapToolFixed.paa);
|
||||
scope = 0;
|
||||
color[] = {1,1,1,1};
|
||||
size = 32;
|
||||
};
|
||||
|
||||
class ACE_MapToolRotatingNormal {
|
||||
name = "MapToolRotating";
|
||||
icon = PATHTOF(data\mapToolRotatingNormal.paa);
|
||||
scope = 0;
|
||||
color[] = {1,1,1,1};
|
||||
size = 32;
|
||||
};
|
||||
|
||||
class ACE_MapToolRotatingSmall {
|
||||
name = "MapToolRotating";
|
||||
icon = PATHTOF(data\mapToolRotatingSmall.paa);
|
||||
scope = 0;
|
||||
color[] = {1,1,1,1};
|
||||
size = 32;
|
||||
};
|
||||
};
|
@ -31,7 +31,7 @@ class RscTitles {
|
||||
};
|
||||
class heading: RscText{
|
||||
idc = 913590;
|
||||
x = X_gps + W_gps * 0.25;
|
||||
x = X_gps + W_gps * 0.225;
|
||||
y = Y_gps + H_gps * 0.12;
|
||||
w = W_gps * 0.2;
|
||||
h = H_gps * 0.16;
|
||||
@ -46,7 +46,7 @@ class RscTitles {
|
||||
};
|
||||
class altitude: RscText{
|
||||
idc = 913591;
|
||||
x = X_gps + W_gps * 0.55;
|
||||
x = X_gps + W_gps * 0.575;
|
||||
y = Y_gps + H_gps * 0.12;
|
||||
w = W_gps * 0.2;
|
||||
h = H_gps * 0.16;
|
||||
@ -61,9 +61,9 @@ class RscTitles {
|
||||
};
|
||||
class coordinates: RscText{
|
||||
idc = 913592;
|
||||
x = X_gps + W_gps * 0.2;
|
||||
x = X_gps + W_gps * 0.15;
|
||||
y = Y_gps + H_gps * 0.33;
|
||||
w = W_gps * 0.6;
|
||||
w = W_gps * 0.7;
|
||||
h = H_gps * 0.35;
|
||||
style = ST_CENTER;
|
||||
text = "012.3 115.1";
|
||||
|
Binary file not shown.
@ -28,7 +28,7 @@ GVAR(drawing_controls) = [36732, 36733, 36734, 36735, 36736, 36737];
|
||||
((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", {[] call FUNC(updateMapToolMarkers);}];
|
||||
((finddisplay _d) displayctrl 51) ctrlAddEventHandler ["Draw", {_this call FUNC(updateMapToolMarkers);}];
|
||||
(finddisplay _d) displayAddEventHandler ["KeyDown", {_this call FUNC(handleKeyDown);}];
|
||||
};
|
||||
|
||||
|
@ -32,7 +32,6 @@ class RscEdit;
|
||||
|
||||
#include "MapGpsUI.hpp"
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgMarkers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* Add the line marker
|
||||
*
|
||||
* Argument:
|
||||
* 0: Marker Name (string)
|
||||
* 1: Marker start pos (array)
|
||||
* 2: Marker end pos (array)
|
||||
* 3: Color index (Number)
|
||||
* Arguments:
|
||||
* 0: Marker Name <STRING>
|
||||
* 1: Marker start pos <ARRAY>
|
||||
* 2: Marker end pos <ARRAY>
|
||||
* 3: Color index <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* Return
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
_name = _this select 0;
|
||||
@ -27,16 +27,16 @@ _name setMarkerColorLocal _color;
|
||||
_name setMarkerPosLocal (_startPos vectorAdd (_difPos vectorMultiply 0.5));
|
||||
_mag = vectorMagnitude _difPos;
|
||||
if (_mag > 0) then {
|
||||
_name setMarkerSizeLocal [5, _mag / 2];
|
||||
_name setMarkerDirLocal (180 + (_difPos select 0) atan2 (_difPos select 1) mod 360);
|
||||
_name setMarkerSizeLocal [5, _mag / 2];
|
||||
_name setMarkerDirLocal (180 + (_difPos select 0) atan2 (_difPos select 1) mod 360);
|
||||
} else {
|
||||
_name setMarkerSizeLocal [5, 5];
|
||||
_name setMarkerDirLocal 0;
|
||||
_name setMarkerSizeLocal [5, 5];
|
||||
_name setMarkerDirLocal 0;
|
||||
};
|
||||
|
||||
GVAR(drawing_lineMarkers) pushBack (+_this);
|
||||
|
||||
if (isServer && GVAR(drawing_syncMarkers)) then {
|
||||
GVAR(drawing_serverLineMarkers) pushBack (+_this);
|
||||
publicVariable QGVAR(drawing_serverLineMarkers);
|
||||
GVAR(drawing_serverLineMarkers) pushBack (+_this);
|
||||
publicVariable QGVAR(drawing_serverLineMarkers);
|
||||
};
|
||||
|
@ -1,15 +1,15 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* Returns the equivalent of 100m in screen coordinates
|
||||
*
|
||||
* Argument:
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return value:
|
||||
* Return
|
||||
* No
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
_pos = ((finddisplay 12) displayctrl 51) ctrlMapScreenToWorld [0.5, 0.5];
|
||||
|
@ -1,5 +1,15 @@
|
||||
// by esteldunedain
|
||||
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
* canDraw
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return value:
|
||||
* <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
(missionNameSpace getVariable [QGVAR(drawing_syncMarkers), true] && {GVAR(EveryoneCanDrawOnBriefing)}) ||
|
||||
|
@ -1,5 +1,15 @@
|
||||
// by esteldunedain
|
||||
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
* canUseMapGPS
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return value:
|
||||
* <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
visibleMap &&
|
||||
|
@ -1,5 +1,15 @@
|
||||
// by esteldunedain
|
||||
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
* canUseMapTools
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return value:
|
||||
* <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
visibleMap &&
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* Cancel the drawing of the current line marker
|
||||
*
|
||||
* Argument:
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(drawing_isDrawing) = false;
|
||||
if (count GVAR(drawing_tempLineMarker) > 0) then {
|
||||
deleteMarkerLocal (GVAR(drawing_tempLineMarker) select 0);
|
||||
deleteMarkerLocal (GVAR(drawing_tempLineMarker) select 0);
|
||||
};
|
||||
GVAR(drawing_tempLineMarker) = [];
|
||||
|
@ -1,23 +1,23 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* Copy recieved markers to map
|
||||
*
|
||||
* Argument:
|
||||
* 0: Array of markers to copy (Array)
|
||||
* Arguments:
|
||||
* 0: Array of markers to copy <ARRAY>
|
||||
*
|
||||
* Return value:
|
||||
* Return
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_lineMarkers);
|
||||
|
||||
{
|
||||
_marker = _x;
|
||||
//Add marker if we don't already have it
|
||||
if (({(_x select 0) == (_marker select 0)} count GVAR(drawing_lineMarkers)) == 0) then {
|
||||
_marker call FUNC(addLineMarker);
|
||||
};
|
||||
_marker = _x;
|
||||
//Add marker if we don't already have it
|
||||
if (({(_x select 0) == (_marker select 0)} count GVAR(drawing_lineMarkers)) == 0) then {
|
||||
_marker call FUNC(addLineMarker);
|
||||
};
|
||||
} forEach _lineMarkers;
|
||||
|
@ -1,11 +1,10 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* Send request to remote player
|
||||
*
|
||||
* Argument:
|
||||
* 0: Player (Unit)
|
||||
* 0: Target player (Unit)
|
||||
* Arguments:
|
||||
* 0: Player <OBJECT>
|
||||
* 0: Target player <OBJECT>
|
||||
*
|
||||
* Code Chain:
|
||||
* START: copyMapStart: triggers event drawing_requestMarkers on remote
|
||||
|
@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* Handle key down on map.
|
||||
*
|
||||
* Argument:
|
||||
* Arguments:
|
||||
* 0: Display (display)
|
||||
* 1: Key code (number)
|
||||
* 2: Shift Key (boolean)
|
||||
@ -30,45 +29,45 @@ _handled = false;
|
||||
|
||||
// If pressed Esc while drawing
|
||||
if (_code == DIK_ESCAPE) exitWith {
|
||||
if (GVAR(drawing_isDrawing)) then {
|
||||
call FUNC(cancelDrawing);
|
||||
_handled = true;
|
||||
};
|
||||
if (GVAR(drawing_isDrawing)) then {
|
||||
call FUNC(cancelDrawing);
|
||||
_handled = true;
|
||||
};
|
||||
};
|
||||
|
||||
if (_code == DIK_DELETE) exitWith {
|
||||
if (GVAR(drawing_isDrawing)) then {
|
||||
call FUNC(cancelDrawing);
|
||||
_handled = true;
|
||||
} else {
|
||||
|
||||
// Check if a line marker needs to be deleted
|
||||
{
|
||||
_relPos = GVAR(mousePosition) vectorDiff (_x select 1);
|
||||
_diffVector = (_x select 2) vectorDiff (_x select 1);
|
||||
_magDiffVector = vectorMagnitude _diffVector;
|
||||
if (_magDiffVector == 0) then {
|
||||
_diffVector = [10,0,0];
|
||||
_magDiffVector = vectorMagnitude _diffVector;
|
||||
};
|
||||
_diffVector = _diffVector vectorMultiply (1/_magDiffVector);
|
||||
|
||||
// Projection of the relative position over the longitudinal axis
|
||||
_lambdaLong = _diffVector vectorDotProduct _relPos;
|
||||
// Projection of the relative position over the trasversal axis
|
||||
_lambdaTrasAbs = vectorMagnitude (_relPos vectorDiff (_diffVector vectorMultiply _lambdaLong));
|
||||
if (_lambdaLong >= 0 && _lambdaLong <= _magDiffVector && _lambdaTrasAbs <= 5) exitWith {
|
||||
// Delete the line marker
|
||||
if (GVAR(drawing_syncMarkers)) then {
|
||||
["drawing_removeLineMarker", [_x select 0]] call EFUNC(common,globalEvent);
|
||||
} else {
|
||||
deleteMarkerLocal (_x select 0);
|
||||
GVAR(drawing_lineMarkers) = GVAR(drawing_lineMarkers) - [_x];
|
||||
};
|
||||
if (GVAR(drawing_isDrawing)) then {
|
||||
call FUNC(cancelDrawing);
|
||||
_handled = true;
|
||||
};
|
||||
} forEach GVAR(drawing_lineMarkers);
|
||||
};
|
||||
} else {
|
||||
|
||||
// Check if a line marker needs to be deleted
|
||||
{
|
||||
_relPos = GVAR(mousePosition) vectorDiff (_x select 1);
|
||||
_diffVector = (_x select 2) vectorDiff (_x select 1);
|
||||
_magDiffVector = vectorMagnitude _diffVector;
|
||||
if (_magDiffVector == 0) then {
|
||||
_diffVector = [10,0,0];
|
||||
_magDiffVector = vectorMagnitude _diffVector;
|
||||
};
|
||||
_diffVector = _diffVector vectorMultiply (1/_magDiffVector);
|
||||
|
||||
// Projection of the relative position over the longitudinal axis
|
||||
_lambdaLong = _diffVector vectorDotProduct _relPos;
|
||||
// Projection of the relative position over the trasversal axis
|
||||
_lambdaTrasAbs = vectorMagnitude (_relPos vectorDiff (_diffVector vectorMultiply _lambdaLong));
|
||||
if (_lambdaLong >= 0 && _lambdaLong <= _magDiffVector && _lambdaTrasAbs <= 5) exitWith {
|
||||
// Delete the line marker
|
||||
if (GVAR(drawing_syncMarkers)) then {
|
||||
["drawing_removeLineMarker", [_x select 0]] call EFUNC(common,globalEvent);
|
||||
} else {
|
||||
deleteMarkerLocal (_x select 0);
|
||||
GVAR(drawing_lineMarkers) = GVAR(drawing_lineMarkers) - [_x];
|
||||
};
|
||||
_handled = true;
|
||||
};
|
||||
} forEach GVAR(drawing_lineMarkers);
|
||||
};
|
||||
};
|
||||
|
||||
_handled
|
||||
|
@ -31,72 +31,72 @@ if (_button != 0) exitWith {};
|
||||
|
||||
// If releasing
|
||||
if (_dir != 1 && (GVAR(mapTool_isDragging) or GVAR(mapTool_isRotating))) exitWith {
|
||||
GVAR(mapTool_isDragging) = false;
|
||||
GVAR(mapTool_isRotating) = false;
|
||||
_handled = true;
|
||||
_handled
|
||||
GVAR(mapTool_isDragging) = false;
|
||||
GVAR(mapTool_isRotating) = false;
|
||||
_handled = true;
|
||||
_handled
|
||||
};
|
||||
|
||||
// If clicking
|
||||
if (_dir == 1) exitWith {
|
||||
|
||||
if !(call FUNC(canDraw)) exitWith {_handled = false;};
|
||||
if !(call FUNC(canDraw)) exitWith {_handled = false;};
|
||||
|
||||
// Transform mouse screen position to coordinates
|
||||
_pos = _control ctrlMapScreenToWorld _screenPos;
|
||||
_pos set [count _pos, 0];
|
||||
// Transform mouse screen position to coordinates
|
||||
_pos = _control ctrlMapScreenToWorld _screenPos;
|
||||
_pos set [count _pos, 0];
|
||||
|
||||
if (GVAR(drawing_isDrawing)) exitWith {
|
||||
// Already drawing -> Add tempLineMarker to permanent list
|
||||
if (GVAR(drawing_syncMarkers)) then {
|
||||
deleteMarkerLocal (GVAR(drawing_tempLineMarker) select 0);
|
||||
// [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);
|
||||
} else {
|
||||
GVAR(drawing_tempLineMarker) call FUNC(updateLineMarker);
|
||||
GVAR(drawing_lineMarkers) pushBack (+GVAR(drawing_tempLineMarker));
|
||||
if (GVAR(drawing_isDrawing)) exitWith {
|
||||
// Already drawing -> Add tempLineMarker to permanent list
|
||||
if (GVAR(drawing_syncMarkers)) then {
|
||||
deleteMarkerLocal (GVAR(drawing_tempLineMarker) select 0);
|
||||
// [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);
|
||||
} else {
|
||||
GVAR(drawing_tempLineMarker) call FUNC(updateLineMarker);
|
||||
GVAR(drawing_lineMarkers) pushBack (+GVAR(drawing_tempLineMarker));
|
||||
};
|
||||
GVAR(drawing_tempLineMarker) = [];
|
||||
GVAR(drawing_isDrawing) = false;
|
||||
_handled = true;
|
||||
};
|
||||
GVAR(drawing_tempLineMarker) = [];
|
||||
GVAR(drawing_isDrawing) = false;
|
||||
_handled = true;
|
||||
};
|
||||
|
||||
if (_altKey) exitWith {
|
||||
// Start drawing
|
||||
GVAR(drawing_isDrawing) = true;
|
||||
// Create tempLineMarker
|
||||
_gui = format ["%1%2%3%4", random (100), random (100), random (100), random (100)];
|
||||
GVAR(drawing_tempLineMarker) = [_gui, + _pos, + _pos, GVAR(drawing_drawColor)];
|
||||
_marker = createMarkerLocal [_gui, [0,0]];
|
||||
GVAR(drawing_tempLineMarker) call FUNC(updateLineMarker);
|
||||
_handled = true;
|
||||
};
|
||||
|
||||
GVAR(mapTool_isDragging) = false;
|
||||
GVAR(mapTool_isRotating) = false;
|
||||
|
||||
// If no map tool marker then exit
|
||||
if (isNil QGVAR(mapTool_markerRotatingFixed)) exitWith {_handled = false;};
|
||||
|
||||
// Check if clicking the maptool
|
||||
if (_pos call FUNC(isInsideMapTool)) exitWith {
|
||||
// Store data for dragging
|
||||
GVAR(mapTool_startPos) = + GVAR(mapTool_pos);
|
||||
GVAR(mapTool_startDragPos) = + _pos;
|
||||
if (_ctrlKey) then {
|
||||
// Store data for rotating
|
||||
GVAR(mapTool_startAngle) = + GVAR(mapTool_angle);
|
||||
GVAR(mapTool_startDragAngle) = (180 + ((GVAR(mapTool_startDragPos) select 0) - (GVAR(mapTool_startPos) select 0)) atan2 ((GVAR(mapTool_startDragPos) select 1) - (GVAR(mapTool_startPos) select 1)) mod 360);
|
||||
// Start rotating
|
||||
GVAR(mapTool_isRotating) = true;
|
||||
} else {
|
||||
// Start dragging
|
||||
GVAR(mapTool_isDragging) = true;
|
||||
if (_altKey) exitWith {
|
||||
// Start drawing
|
||||
GVAR(drawing_isDrawing) = true;
|
||||
// Create tempLineMarker
|
||||
_gui = format ["%1%2%3%4", random (100), random (100), random (100), random (100)];
|
||||
GVAR(drawing_tempLineMarker) = [_gui, + _pos, + _pos, GVAR(drawing_drawColor)];
|
||||
_marker = createMarkerLocal [_gui, [0,0]];
|
||||
GVAR(drawing_tempLineMarker) call FUNC(updateLineMarker);
|
||||
_handled = true;
|
||||
};
|
||||
|
||||
GVAR(mapTool_isDragging) = false;
|
||||
GVAR(mapTool_isRotating) = false;
|
||||
|
||||
// If no map tool marker then exit
|
||||
if (GVAR(mapTool_Shown) == 0) exitWith {_handled = false;};
|
||||
|
||||
// Check if clicking the maptool
|
||||
if (_pos call FUNC(isInsideMapTool)) exitWith {
|
||||
// Store data for dragging
|
||||
GVAR(mapTool_startPos) = + GVAR(mapTool_pos);
|
||||
GVAR(mapTool_startDragPos) = + _pos;
|
||||
if (_ctrlKey) then {
|
||||
// Store data for rotating
|
||||
GVAR(mapTool_startAngle) = + GVAR(mapTool_angle);
|
||||
GVAR(mapTool_startDragAngle) = (180 + ((GVAR(mapTool_startDragPos) select 0) - (GVAR(mapTool_startPos) select 0)) atan2 ((GVAR(mapTool_startDragPos) select 1) - (GVAR(mapTool_startPos) select 1)) mod 360);
|
||||
// Start rotating
|
||||
GVAR(mapTool_isRotating) = true;
|
||||
} else {
|
||||
// Start dragging
|
||||
GVAR(mapTool_isDragging) = true;
|
||||
};
|
||||
_handled = true;
|
||||
};
|
||||
_handled = true;
|
||||
};
|
||||
};
|
||||
|
||||
_handled
|
||||
|
@ -22,42 +22,42 @@ GVAR(mousePosition) set [2, 0]; //convert 2d pos to 3d
|
||||
|
||||
// If cannot draw then exit
|
||||
if !(call FUNC(canDraw)) exitWith {
|
||||
// If was drawing, cancel
|
||||
if (GVAR(drawing_isDrawing)) then {
|
||||
call FUNC(cancelDrawing);
|
||||
};
|
||||
false
|
||||
// If was drawing, cancel
|
||||
if (GVAR(drawing_isDrawing)) then {
|
||||
call FUNC(cancelDrawing);
|
||||
};
|
||||
false
|
||||
};
|
||||
|
||||
// Handle drawing
|
||||
if (GVAR(drawing_isDrawing)) exitWith {
|
||||
GVAR(drawing_tempLineMarker) set [2, GVAR(mousePosition)];
|
||||
GVAR(drawing_tempLineMarker) call FUNC(updateLineMarker);
|
||||
false
|
||||
GVAR(drawing_tempLineMarker) set [2, GVAR(mousePosition)];
|
||||
GVAR(drawing_tempLineMarker) call FUNC(updateLineMarker);
|
||||
false
|
||||
};
|
||||
|
||||
// Handle Map tools
|
||||
if (isNil QGVAR(mapTool_markerRotatingFixed)) exitWith {false};
|
||||
if (GVAR(mapTool_Shown) == 0) exitWith {false};
|
||||
|
||||
// Translation
|
||||
if (GVAR(mapTool_isDragging)) exitWith {
|
||||
GVAR(mapTool_pos) set [0, (GVAR(mapTool_startPos) select 0) + (GVAR(mousePosition) select 0) - (GVAR(mapTool_startDragPos) select 0)];
|
||||
GVAR(mapTool_pos) set [1, (GVAR(mapTool_startPos) select 1) + (GVAR(mousePosition) select 1) - (GVAR(mapTool_startDragPos) select 1)];
|
||||
GVAR(mapTool_pos) set [0, (GVAR(mapTool_startPos) select 0) + (GVAR(mousePosition) select 0) - (GVAR(mapTool_startDragPos) select 0)];
|
||||
GVAR(mapTool_pos) set [1, (GVAR(mapTool_startPos) select 1) + (GVAR(mousePosition) select 1) - (GVAR(mapTool_startDragPos) select 1)];
|
||||
|
||||
// Update the size and rotation of the maptool
|
||||
[] call FUNC(updateMapToolMarkers);
|
||||
true
|
||||
// Update the size and rotation of the maptool
|
||||
[] call FUNC(updateMapToolMarkers);
|
||||
true
|
||||
};
|
||||
|
||||
// Rotation
|
||||
if (GVAR(mapTool_isRotating)) exitWith {
|
||||
// Get new angle
|
||||
_angle = (180 + ((GVAR(mousePosition) select 0) - (GVAR(mapTool_startPos) select 0)) atan2 ((GVAR(mousePosition) select 1) - (GVAR(mapTool_startPos) select 1)) mod 360);
|
||||
GVAR(mapTool_angle) = GVAR(mapTool_startAngle) + _angle - GVAR(mapTool_startDragAngle);
|
||||
// Get new angle
|
||||
_angle = (180 + ((GVAR(mousePosition) select 0) - (GVAR(mapTool_startPos) select 0)) atan2 ((GVAR(mousePosition) select 1) - (GVAR(mapTool_startPos) select 1)) mod 360);
|
||||
GVAR(mapTool_angle) = GVAR(mapTool_startAngle) + _angle - GVAR(mapTool_startDragAngle);
|
||||
|
||||
// Update the size and rotation of the maptool
|
||||
[] call FUNC(updateMapToolMarkers);
|
||||
true
|
||||
// Update the size and rotation of the maptool
|
||||
[] call FUNC(updateMapToolMarkers);
|
||||
true
|
||||
};
|
||||
|
||||
false
|
||||
|
@ -29,16 +29,16 @@ _handled = true;
|
||||
// ACE_Map_drawColors is never defined
|
||||
|
||||
/* if (count GVAR(drawing_tempLineMarker) > 0) then {
|
||||
ACE_Map_drawColor = if (_dir > 0) then {ACE_Map_drawColor + 1} else {ACE_Map_drawColor - 1};
|
||||
if (ACE_Map_drawColor >= count ACE_Map_drawColors) then {
|
||||
ACE_Map_drawColor = if (_dir > 0) then {ACE_Map_drawColor + 1} else {ACE_Map_drawColor - 1};
|
||||
if (ACE_Map_drawColor >= count ACE_Map_drawColors) then {
|
||||
ACE_Map_drawColor = ACE_Map_drawColor - count ACE_Map_drawColors;
|
||||
};
|
||||
if (ACE_Map_drawColor < 0) then {
|
||||
};
|
||||
if (ACE_Map_drawColor < 0) then {
|
||||
ACE_Map_drawColor = ACE_Map_drawColor + count ACE_Map_drawColors;
|
||||
};
|
||||
GVAR(drawing_tempLineMarker) set [3, ACE_Map_drawColor];
|
||||
GVAR(drawing_tempLineMarker) call ACE_Map_fnc_updateLineMarker;
|
||||
};
|
||||
GVAR(drawing_tempLineMarker) set [3, ACE_Map_drawColor];
|
||||
GVAR(drawing_tempLineMarker) call ACE_Map_fnc_updateLineMarker;
|
||||
|
||||
_handled = true;
|
||||
_handled = true;
|
||||
}; */
|
||||
_handled
|
||||
|
@ -1,16 +1,14 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* Return true if the position is inside the map marker (to allow dragging).
|
||||
*
|
||||
* Argument:
|
||||
* 0: x Position (in meters)
|
||||
* 1: y Position (in meters)
|
||||
* Arguments:
|
||||
* 0: x Position (in meters) <NUMBER>
|
||||
* 1: y Position (in meters) <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* Boolean
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define TEXTURE_WIDTH_IN_M 6205
|
||||
@ -18,6 +16,7 @@
|
||||
#define DIST_TOP_TO_CENTER_PERC 0.65
|
||||
#define DIST_LEFT_TO_CENTER_PERC 0.30
|
||||
|
||||
|
||||
if (GVAR(mapTool_Shown) == 0) exitWith {false};
|
||||
_textureWidth = [TEXTURE_WIDTH_IN_M, TEXTURE_WIDTH_IN_M / 2] select (GVAR(mapTool_Shown) - 1);
|
||||
|
||||
|
@ -2,39 +2,32 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (visibleMap) then {
|
||||
// Show/Hide draw buttons
|
||||
if ("ACE_MapTools" in items ACE_player) then {
|
||||
{ ((finddisplay 12) displayctrl _x) ctrlShow true; } forEach GVAR(drawing_controls);
|
||||
} else {
|
||||
{ ((finddisplay 12) displayctrl _x) ctrlShow false; } forEach GVAR(drawing_controls);
|
||||
if (GVAR(drawing_isDrawing)) then {
|
||||
call FUNC(cancelDrawing);
|
||||
// Show/Hide draw buttons
|
||||
if ("ACE_MapTools" in items ACE_player) then {
|
||||
{ ((finddisplay 12) displayctrl _x) ctrlShow true; } forEach GVAR(drawing_controls);
|
||||
} else {
|
||||
{ ((finddisplay 12) displayctrl _x) ctrlShow false; } forEach GVAR(drawing_controls);
|
||||
if (GVAR(drawing_isDrawing)) then {
|
||||
call FUNC(cancelDrawing);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//When Map is Closed:
|
||||
if (GVAR(mapVisableLastFrame) && (!visibleMap)) then {
|
||||
GVAR(mapVisableLastFrame) = false;
|
||||
// Hide GPS
|
||||
[false] call FUNC(openMapGps);
|
||||
// Hide Map tools
|
||||
deleteMarkerLocal MARKERNAME_MAPTOOL_FIXED;
|
||||
deleteMarkerLocal MARKERNAME_MAPTOOL_ROTATINGNORMAL;
|
||||
deleteMarkerLocal MARKERNAME_MAPTOOL_ROTATINGSMALL;
|
||||
GVAR(mapTool_markerRotatingFixed) = nil;
|
||||
GVAR(mapTool_markerRotatingNormal) = nil;
|
||||
GVAR(mapTool_markerRotatingSmall) = nil;
|
||||
// Cancel drawing
|
||||
call FUNC(cancelDrawing);
|
||||
GVAR(mapVisableLastFrame) = false;
|
||||
// Hide GPS
|
||||
[false] call FUNC(openMapGps);
|
||||
// Cancel drawing
|
||||
call FUNC(cancelDrawing);
|
||||
};
|
||||
|
||||
//When Map is Opened:
|
||||
if ((!GVAR(mapVisableLastFrame)) && (visibleMap)) then {
|
||||
//todo: "mapOpened" Event????
|
||||
GVAR(mapVisableLastFrame) = true;
|
||||
// Show and update map tools if required
|
||||
[] call FUNC(updateMapToolMarkers);
|
||||
// Show GPS if required
|
||||
[GVAR(mapGpsShow)] call FUNC(openMapGps);
|
||||
//todo: "mapOpened" Event????
|
||||
GVAR(mapVisableLastFrame) = true;
|
||||
// Show and update map tools if required
|
||||
[] call FUNC(updateMapToolMarkers);
|
||||
// Show GPS if required
|
||||
[GVAR(mapGpsShow)] call FUNC(openMapGps);
|
||||
};
|
||||
|
@ -1,25 +1,24 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* Opens or closes the gps on the map screen, showing coordinates
|
||||
*
|
||||
* Argument:
|
||||
* 0: Open GPS? (Boolean)
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
*/
|
||||
|
||||
* Author: esteldunedain
|
||||
* Opens or closes the gps on the map screen, showing coordinates
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Open GPS? <BOOL>
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
_shouldOpenGps = _this select 0;
|
||||
_isOpen = !(isNull (uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull]));
|
||||
|
||||
if (_shouldOpenGps && {"ItemGPS" in assignedItems ACE_player} && {!_isOpen}) then {
|
||||
("RscACE_MapGps" call BIS_fnc_rscLayer) cutRsc ["RscACE_MapGps","PLAIN"];
|
||||
("RscACE_MapGps" call BIS_fnc_rscLayer) cutRsc ["RscACE_MapGps","PLAIN"];
|
||||
|
||||
[FUNC(openMapGpsUpdate), 0.5, []] call CBA_fnc_addPerFrameHandler; //update bearing/altitude every 0.5 sec (ticktime)
|
||||
[FUNC(openMapGpsUpdate), 0.5, []] call CBA_fnc_addPerFrameHandler; //update bearing/altitude every 0.5 sec (ticktime)
|
||||
} else {
|
||||
("RscACE_MapGps" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
|
||||
("RscACE_MapGps" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
|
||||
};
|
||||
|
||||
|
@ -11,8 +11,8 @@ disableSerialization;
|
||||
|
||||
_mapGpsDisplay = uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull];
|
||||
_ctrl = _mapGpsDisplay displayCtrl 913590;
|
||||
_ctrl ctrlSetText str(round(getDir player)); //set Heading
|
||||
_ctrl ctrlSetText str(round(getDir ACE_player)); //set Heading
|
||||
_ctrl = _mapGpsDisplay displayCtrl 913591;
|
||||
_ctrl ctrlSetText str(round((getPosASL player) select 2)); //set Altitude
|
||||
_ctrl ctrlSetText str(round((getPosASL ACE_player) select 2)); //set Altitude
|
||||
_ctrl = _mapGpsDisplay displayCtrl 913592;
|
||||
_ctrl ctrlSetText mapGridPosition player; //set grid cords
|
||||
_ctrl ctrlSetText mapGridPosition ACE_player; //set grid cords
|
||||
|
@ -1,10 +1,9 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* Remove the line marker
|
||||
*
|
||||
* Argument:
|
||||
* 0: Marker Name (string)
|
||||
* Arguments:
|
||||
* 0: Marker Name <STRING>
|
||||
*
|
||||
* Return value:
|
||||
* Return
|
||||
@ -12,20 +11,20 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
_name = _this select 0;
|
||||
_name = _this select 0;
|
||||
|
||||
deleteMarkerLocal _name;
|
||||
deleteMarkerLocal _name;
|
||||
{
|
||||
if ((_x select 0) == _name) exitWith {
|
||||
GVAR(drawing_lineMarkers) = GVAR(drawing_lineMarkers) - [_x];
|
||||
};
|
||||
if ((_x select 0) == _name) exitWith {
|
||||
GVAR(drawing_lineMarkers) = GVAR(drawing_lineMarkers) - [_x];
|
||||
};
|
||||
} forEach GVAR(drawing_lineMarkers);
|
||||
|
||||
if (isServer && GVAR(drawing_syncMarkers)) then {
|
||||
{
|
||||
if ((_x select 0) == _name) exitWith {
|
||||
GVAR(drawing_serverLineMarkers) = GVAR(drawing_serverLineMarkers) - [_x];
|
||||
publicVariable QGVAR(drawing_serverLineMarkers);
|
||||
};
|
||||
} forEach GVAR(drawing_serverLineMarkers);
|
||||
{
|
||||
if ((_x select 0) == _name) exitWith {
|
||||
GVAR(drawing_serverLineMarkers) = GVAR(drawing_serverLineMarkers) - [_x];
|
||||
publicVariable QGVAR(drawing_serverLineMarkers);
|
||||
};
|
||||
} forEach GVAR(drawing_serverLineMarkers);
|
||||
};
|
||||
|
@ -1,24 +1,22 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* Updates the line marker position and scale
|
||||
*
|
||||
* Argument:
|
||||
* 0: Marker Name (string)
|
||||
* 1: Marker start pos (array)
|
||||
* 2: Marker end pos (array)
|
||||
* 3: Color index (Number)
|
||||
* Arguments:
|
||||
* 0: Marker Name <STRING>
|
||||
* 1: Marker start pos <ARRAY>
|
||||
* 2: Marker end pos <ARRAY>
|
||||
* 3: Color index <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* Return
|
||||
* None
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
_name = _this select 0;
|
||||
_startPos = _this select 1;
|
||||
_difPos = (_this select 2) vectorDiff _startPos ;
|
||||
_color = _this select 3;
|
||||
_name = _this select 0;
|
||||
_startPos = _this select 1;
|
||||
_difPos = (_this select 2) vectorDiff _startPos ;
|
||||
_color = _this select 3;
|
||||
|
||||
_name setMarkerShapeLocal "RECTANGLE";
|
||||
_name setMarkerAlphaLocal 1;
|
||||
@ -26,9 +24,9 @@ _name setMarkerColorLocal GVAR(drawing_drawColor);
|
||||
_name setMarkerPosLocal (_startPos vectorAdd (_difPos vectorMultiply 0.5));
|
||||
_mag = vectorMagnitude _difPos;
|
||||
if (_mag > 0) then {
|
||||
_name setMarkerSizeLocal [5, _mag / 2];
|
||||
_name setMarkerDirLocal (180 + (_difPos select 0) atan2 (_difPos select 1) mod 360);
|
||||
_name setMarkerSizeLocal [5, _mag / 2];
|
||||
_name setMarkerDirLocal (180 + (_difPos select 0) atan2 (_difPos select 1) mod 360);
|
||||
} else {
|
||||
_name setMarkerSizeLocal [5, 5];
|
||||
_name setMarkerDirLocal 0;
|
||||
_name setMarkerSizeLocal [5, 5];
|
||||
_name setMarkerDirLocal 0;
|
||||
};
|
||||
|
@ -1,73 +1,46 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* Update the map tool markers, position, size, rotation and visibility.
|
||||
*
|
||||
* Argument:
|
||||
* None
|
||||
* Arguments:
|
||||
* 0: The Map <CONTROL>
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define TEXTURE_WIDTH_IN_M 6205
|
||||
#define CENTER_OFFSET_Y_PERC 0.1606
|
||||
#define CONSTANT_SCALE 0.2
|
||||
|
||||
// If markers exist and they should'nt, delete them
|
||||
if (!("ACE_MapTools" in items ACE_player) || {GVAR(mapTool_Shown) == 0}) then {
|
||||
// If markers exist, delete them
|
||||
if (!isNil QGVAR(mapTool_markerRotatingFixed)) then {
|
||||
deleteMarkerLocal MARKERNAME_MAPTOOL_FIXED;
|
||||
GVAR(mapTool_markerRotatingFixed) = nil;
|
||||
};
|
||||
};
|
||||
if (!("ACE_MapTools" in items ACE_player) || {GVAR(mapTool_Shown) != 1}) then {
|
||||
if (!isNil QGVAR(mapTool_markerRotatingNormal)) then {
|
||||
deleteMarkerLocal MARKERNAME_MAPTOOL_ROTATINGNORMAL;
|
||||
GVAR(mapTool_markerRotatingNormal) = nil;
|
||||
};
|
||||
};
|
||||
if (!("ACE_MapTools" in items ACE_player) || {GVAR(mapTool_Shown) != 2}) then {
|
||||
if (!isNil QGVAR(mapTool_markerRotatingSmall)) then {
|
||||
deleteMarkerLocal MARKERNAME_MAPTOOL_ROTATINGSMALL;
|
||||
GVAR(mapTool_markerRotatingSmall) = nil;
|
||||
};
|
||||
};
|
||||
PARAMS_1(_theMap);
|
||||
|
||||
if (!("ACE_MapTools" in items ACE_player)|| {GVAR(mapTool_Shown) == 0}) exitWith {};
|
||||
|
||||
// If markers don't exist and should, create them
|
||||
if (isNil QGVAR(mapTool_markerRotatingFixed)) then {
|
||||
GVAR(mapTool_markerRotatingFixed) = createMarkerLocal [MARKERNAME_MAPTOOL_FIXED, GVAR(mapTool_pos)];
|
||||
MARKERNAME_MAPTOOL_FIXED setMarkerType MARKERNAME_MAPTOOL_FIXED;
|
||||
_rotatingTexture = "";
|
||||
_textureWidth = 0;
|
||||
if (GVAR(mapTool_Shown) == 1) then {
|
||||
_rotatingTexture = QUOTE(PATHTOF(data\mapToolRotatingNormal.paa));
|
||||
_textureWidth = TEXTURE_WIDTH_IN_M;
|
||||
} else {
|
||||
_rotatingTexture = QUOTE(PATHTOF(data\mapToolRotatingSmall.paa));
|
||||
_textureWidth = TEXTURE_WIDTH_IN_M / 2;
|
||||
};
|
||||
if ((isNil QGVAR(mapTool_markerRotatingNormal)) && {GVAR(mapTool_Shown) == 1}) then {
|
||||
GVAR(mapTool_markerRotatingNormal) = createMarkerLocal [MARKERNAME_MAPTOOL_ROTATINGNORMAL, GVAR(mapTool_pos)];
|
||||
MARKERNAME_MAPTOOL_ROTATINGNORMAL setMarkerType MARKERNAME_MAPTOOL_ROTATINGNORMAL;
|
||||
};
|
||||
if ((isNil QGVAR(mapTool_markerRotatingSmall)) && {GVAR(mapTool_Shown) == 2}) then {
|
||||
GVAR(mapTool_markerRotatingSmall) = createMarkerLocal [MARKERNAME_MAPTOOL_ROTATINGSMALL, GVAR(mapTool_pos)];
|
||||
MARKERNAME_MAPTOOL_ROTATINGSMALL setMarkerType MARKERNAME_MAPTOOL_ROTATINGSMALL;
|
||||
};
|
||||
|
||||
_rotatingMarker = [MARKERNAME_MAPTOOL_ROTATINGNORMAL, MARKERNAME_MAPTOOL_ROTATINGSMALL] select (GVAR(mapTool_Shown) - 1);
|
||||
_textureWidth = [TEXTURE_WIDTH_IN_M, TEXTURE_WIDTH_IN_M / 2] select (GVAR(mapTool_Shown) - 1);
|
||||
|
||||
// Update scale of both parts
|
||||
_scale = _textureWidth * CONSTANT_SCALE * (call FUNC(calculateMapScale));
|
||||
MARKERNAME_MAPTOOL_FIXED setMarkerSizeLocal [_scale,_scale];
|
||||
_rotatingMarker setMarkerSizeLocal [_scale,_scale];
|
||||
_scale = _textureWidth * CONSTANT_SCALE * (call FUNC(calculateMapScale));
|
||||
|
||||
// Position of the fixed part
|
||||
_xPos = GVAR(mapTool_pos) select 0;
|
||||
_yPos = (GVAR(mapTool_pos) select 1) + _textureWidth * CENTER_OFFSET_Y_PERC;
|
||||
MARKERNAME_MAPTOOL_FIXED setMarkerPosLocal [_xPos,_yPos];
|
||||
|
||||
_theMap drawIcon [QUOTE(PATHTOF(data\mapToolFixed.paa)), [1,1,1,1], [_xPos,_yPos], (32 * _scale), (32 * _scale), 0, "", 0];
|
||||
|
||||
// Position and rotation of the rotating part
|
||||
_xPos = (GVAR(mapTool_pos) select 0) + sin(GVAR(mapTool_angle)) * _textureWidth * CENTER_OFFSET_Y_PERC;
|
||||
_yPos = (GVAR(mapTool_pos) select 1) + cos(GVAR(mapTool_angle)) * _textureWidth * CENTER_OFFSET_Y_PERC;
|
||||
_rotatingMarker setMarkerPosLocal [_xPos,_yPos];
|
||||
_rotatingMarker setMarkerDirLocal GVAR(mapTool_angle);
|
||||
|
||||
_theMap drawIcon [_rotatingTexture, [1,1,1,1], [_xPos,_yPos], (32 * _scale), (32 * _scale), GVAR(mapTool_angle), "", 0];
|
||||
|
@ -10,8 +10,3 @@
|
||||
#endif
|
||||
|
||||
#include "\z\ace\Addons\main\script_macros.hpp"
|
||||
|
||||
|
||||
#define MARKERNAME_MAPTOOL_FIXED "ACE_MapToolFixed"
|
||||
#define MARKERNAME_MAPTOOL_ROTATINGNORMAL "ACE_MapToolRotatingNormal"
|
||||
#define MARKERNAME_MAPTOOL_ROTATINGSMALL "ACE_MapToolRotatingSmall"
|
||||
|
@ -94,4 +94,13 @@ class RscDisplayInterruptEditor3D: RscStandardDisplay {
|
||||
class controls {
|
||||
class ACE_Open_settingsMenu_Btn : ACE_Open_SettingsMenu_BtnBase {};
|
||||
};
|
||||
};
|
||||
};
|
||||
class RscDisplayMain: RscStandardDisplay {
|
||||
class controls {
|
||||
class ACE_Open_settingsMenu_Btn : ACE_Open_SettingsMenu_BtnBase {
|
||||
action = "if (missionName != '') then {createDialog 'ACE_settingsMenu';};";
|
||||
y = "4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + safezoneY";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -188,10 +188,16 @@ def find_bi_tools(work_drive):
|
||||
else:
|
||||
raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.")
|
||||
|
||||
def find_depbo_tools():
|
||||
def find_depbo_tools(regKey):
|
||||
"""Use registry entries to find DePBO-based tools."""
|
||||
stop = False
|
||||
|
||||
if regKey == "HKCU":
|
||||
reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER)
|
||||
stop = True
|
||||
else:
|
||||
reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
|
||||
|
||||
reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER)
|
||||
try:
|
||||
k = winreg.OpenKey(reg, r"Software\Mikero\pboProject")
|
||||
try:
|
||||
@ -217,7 +223,10 @@ def find_depbo_tools():
|
||||
except:
|
||||
print_error("Could not find makepbo.")
|
||||
except:
|
||||
raise Exception("BadDePBO", "DePBO tools not installed correctly")
|
||||
if stop == True:
|
||||
raise Exception("BadDePBO", "DePBO tools not installed correctly")
|
||||
return -1
|
||||
|
||||
|
||||
#Strip any quotations from the path due to a MikeRo tool bug which leaves a trailing space in some of its registry paths.
|
||||
return [pboproject_path.strip('"'),rapify_path.strip('"'),makepbo_path.strip('"')]
|
||||
@ -439,7 +448,9 @@ See the make.cfg file for additional build options.
|
||||
|
||||
if build_tool == "pboproject":
|
||||
try:
|
||||
depbo_tools = find_depbo_tools()
|
||||
depbo_tools = find_depbo_tools("HKLM")
|
||||
if depbo_tools == -1:
|
||||
depbo_tools = find_depbo_tools("HKCU")
|
||||
pboproject = depbo_tools[0]
|
||||
rapifyTool = depbo_tools[1]
|
||||
makepboTool = depbo_tools[2]
|
||||
@ -580,7 +591,7 @@ See the make.cfg file for additional build options.
|
||||
|
||||
os.chdir("P:\\")
|
||||
|
||||
cmd = [os.path.join(work_drive, "CfgConvert", "CfgConvert.exe"), "-bin", "-dst", os.path.join(work_drive, prefix, module, "config.bin"), os.path.join(work_drive, prefix, module, "config.cpp")]
|
||||
cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-bin", "-dst", os.path.join(work_drive, prefix, module, "config.bin"), os.path.join(work_drive, prefix, module, "config.cpp")]
|
||||
ret = subprocess.call(cmd)
|
||||
#ret = subprocess.call(["cfgConvertGUI.exe", os.path.join(work_drive, prefix, module, "config.cpp")])
|
||||
|
||||
@ -589,7 +600,7 @@ See the make.cfg file for additional build options.
|
||||
input("Press Enter to continue...")
|
||||
|
||||
|
||||
cmd = [os.path.join(work_drive, "CfgConvert", "CfgConvert.exe"), "-txt", "-dst", os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.bin")]
|
||||
cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-txt", "-dst", os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.bin")]
|
||||
ret = subprocess.call(cmd)
|
||||
if ret != 0:
|
||||
print_error("CfgConvert -txt) return code == " + str(ret))
|
||||
|
358
tools/cba/addons/xeh/init_pre.sqf
Normal file
358
tools/cba/addons/xeh/init_pre.sqf
Normal file
@ -0,0 +1,358 @@
|
||||
// #define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
SCRIPT(init_pre);
|
||||
|
||||
if !(isNil'SLX_XEH_MACHINE') exitWith {}; // Doublecheck..
|
||||
|
||||
LOG(MSG_INIT);
|
||||
// No _this in pre/PostInit, also fixes call to init_compile
|
||||
private "_this";
|
||||
_this = nil;
|
||||
|
||||
private ["_id", "_cfgRespawn", "_respawn", "_level"];
|
||||
|
||||
// UNIQUE Session ID since start of game
|
||||
_id = uiNamespace getVariable "SLX_XEH_ID";
|
||||
if (isNil "_id") then { _id = 1 } else { if (typeName _id != "SCALAR") then { _id = 0 }; if (_id < 0) then { _id = 0 }; INC(_id) };
|
||||
uiNamespace setVariable ["SLX_XEH_ID", _id];
|
||||
|
||||
CBA_isCached = uiNamespace getVariable "CBA_isCached";
|
||||
CBA_isCached = if (isNil "CBA_isCached" && {isMultiplayer} && {!isDedicated}) then { -1 } else { _id };
|
||||
uiNamespace setVariable ["CBA_isCached", CBA_isCached];
|
||||
|
||||
if (isNil "SLX_XEH_RECOMPILE") then { SLX_XEH_RECOMPILE = CACHE_DIS(xeh) };
|
||||
|
||||
if (!isMultiplayer || {isDedicated} || {CBA_isCached == -1}) then {
|
||||
uiNamespace setVariable ["SLX_XEH_CACHE_KEYS", []];
|
||||
uiNamespace setVariable ["SLX_XEH_CACHE_KEYS2", []];
|
||||
uiNamespace setVariable ["SLX_XEH_CACHE_KEYS3", []];
|
||||
uiNamespace setVariable ["CBA_CACHE_KEYS", []];
|
||||
};
|
||||
|
||||
SLX_XEH_CACHE_KEYS = uiNamespace getVariable "SLX_XEH_CACHE_KEYS";
|
||||
SLX_XEH_CACHE_KEYS2 = uiNamespace getVariable "SLX_XEH_CACHE_KEYS2";
|
||||
SLX_XEH_CACHE_KEYS3 = uiNamespace getVariable "SLX_XEH_CACHE_KEYS3";
|
||||
CBA_CACHE_KEYS = uiNamespace getVariable "CBA_CACHE_KEYS";
|
||||
|
||||
// Always compile cache function once
|
||||
call compile preProcessFileLineNumbers 'x\cba\addons\xeh\init_compile.sqf';
|
||||
|
||||
// Log
|
||||
SLX_XEH_DisableLogging = isClass(configFile/"CfgPatches"/"Disable_XEH_Logging");
|
||||
|
||||
// Backup functions for macros
|
||||
// TODO: Cleanup...
|
||||
// CBA_fnc_log = { diag_log [diag_frameNo, diag_tickTime, time, _this] };
|
||||
|
||||
|
||||
/* CBA_fnc_defaultParam = {
|
||||
PARAMS_3(_params,_index,_defaultValue);
|
||||
|
||||
private "_value";
|
||||
|
||||
if (!isNil "_defaultValue") then {
|
||||
_value = _defaultValue;
|
||||
};
|
||||
|
||||
if (!isNil "_params" && {(typeName _params) == "ARRAY"} && {count _params > _index} && {!isNil { _params select _index }}) then {
|
||||
_value = _params select _index;
|
||||
};
|
||||
|
||||
// Return.
|
||||
if (isNil "_value") then {
|
||||
nil;
|
||||
} else {
|
||||
_value;
|
||||
};
|
||||
};
|
||||
*/
|
||||
|
||||
XEH_LOG("XEH: PreInit Started. v"+getText(configFile >> "CfgPatches" >> "CBA_XEH" >> "version")+". "+PFORMAT_5("MISSINIT",missionName,worldName,isMultiplayer,isServer,isDedicated));
|
||||
if (time > 0) then { XEH_LOG("XEH WARNING: Time > 0; This probably means there are no XEH compatible units by default on the map, perhaps add the SLX_XEH_Logic module.") };
|
||||
|
||||
// Compile all necessary scripts and start one vehicle crew initialisation thread
|
||||
_cfgRespawn = (missionConfigFile/"respawn");
|
||||
_respawn = false;
|
||||
if ( isNumber(_cfgRespawn) ) then {
|
||||
_respawn = !(getNumber(_cfgRespawn) in [0, 1, 4, 5]);
|
||||
};
|
||||
if ( isText(_cfgRespawn) ) then {
|
||||
_respawn = !(getText(_cfgRespawn) in ["none", "bird", "group", "side"]);
|
||||
};
|
||||
|
||||
SLX_XEH_objects = []; // Temporary array, to track InitPosts at mission initialization
|
||||
SLX_XEH_INIT_MEN = []; // Temporary array, to track ManBased inits - to workaround JIP issue "Double init eh ran for crew units"
|
||||
SLX_XEH_DELAYED = []; // Temporary array, to track Delayed Inits at mission initialization
|
||||
|
||||
|
||||
// Game version detection
|
||||
_level = 0; // pre v1.60
|
||||
// TODO: Improve v1.60 detection
|
||||
// TODO: Temporary disabled due to #28652
|
||||
//if ((isNumber (configFile >> "CfgDifficulties" >> "recruit" >> "recoilCoef")) && (isNumber (configFile >> "CfgVehicles" >> "Car" >> "turnCoef"))) then {
|
||||
//_level = 1; // v1.60
|
||||
//};
|
||||
|
||||
FUNC(determineProductVersion) = {
|
||||
private "_pv";
|
||||
_pv = call {productVersion};
|
||||
|
||||
// A2 (and OA pre 1.61beta, and TOH pre 1.05?) does not support productVersion so we deal with it manually
|
||||
if (isNil "_pv") then {
|
||||
_pv = if (isClass(configFile >> "CfgPatches" >> "A3_Map_Stratis")) then {
|
||||
// A3 Backup
|
||||
["Arma 3 Alpha","Arma3Alpha", -1, -1]; //,5,102571]
|
||||
|
||||
} else {
|
||||
if (isClass(configFile >> "CfgPatches" >> "United_States_H")) then {
|
||||
// TOH Backup
|
||||
["TakeOn H", "TakeOnH", -1, -1];
|
||||
} else {
|
||||
if (isClass(configFile >> "CfgPatches" >> "Takistan")) then {
|
||||
// OA Backup
|
||||
["ArmA 2OA", "ArmA2OA", -1, -1];
|
||||
} else {
|
||||
// A2 Backup
|
||||
["ArmA 2", "ArmA2", -1, -1];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
_pv;
|
||||
};
|
||||
|
||||
FUNC(determineGame) = {
|
||||
// 0 = A2
|
||||
// 1 = OA
|
||||
// 2 = TOH
|
||||
// 3 = A3 :P
|
||||
private "_pv";
|
||||
_pv = call FUNC(determineProductVersion);
|
||||
|
||||
switch (_pv select 1) do {
|
||||
case "ArmA2": {0};
|
||||
case "ArmA2OA": {1};
|
||||
case "TakeOnH": {2};
|
||||
case "Arma3Alpha": {3};
|
||||
case "Arma3": {3};
|
||||
default {0};
|
||||
};
|
||||
};
|
||||
|
||||
// System array with machine / mission / session information
|
||||
SLX_XEH_MACHINE =
|
||||
[
|
||||
!isDedicated, // 0 - isClient (and thus has player)
|
||||
false, // 1 - isJip
|
||||
!isServer, // 2 - isDedicatedClient (and thus not a Client-Server)
|
||||
isServer, // 3 - isServer
|
||||
isDedicated, // 4 - isDedicatedServer (and thus not a Client-Server)
|
||||
false, // 5 - Player Check Finished
|
||||
!isMultiplayer, // 6 - SP?
|
||||
false, // 7 - StartInit Passed
|
||||
false, // 8 - Postinit Passed
|
||||
isMultiplayer && {_respawn}, // 9 - Multiplayer && respawn?
|
||||
if (isDedicated) then { 0 } else { if (isServer) then { 1 } else { 2 } }, // 10 - Machine type (only 3 possible configurations)
|
||||
_id, // 11 - SESSION_ID
|
||||
_level, // 12 - LEVEL - Used for version determination
|
||||
false, // 13 - TIMEOUT - PostInit timedOut
|
||||
call FUNC(determineGame), // 14 - Game
|
||||
call FUNC(determineProductVersion) // 15 - Product+Version
|
||||
];
|
||||
|
||||
SLX_XEH_DUMMY = switch (SLX_XEH_MACHINE select 14) do {
|
||||
case 2: {"Helipad_Invisible_H" };
|
||||
case 3: {"Land_HelipadEmpty_F" };
|
||||
default { "HeliHEmpty" };
|
||||
};
|
||||
|
||||
SLX_XEH_STR = ""; // Empty string
|
||||
SLX_XEH_STR_INIT_EH = "Extended_Init_EventHandlers";
|
||||
SLX_XEH_STR_INIT_POST_EH = "Extended_InitPost_EventHandlers";
|
||||
SLX_XEH_STR_PreInit = "Extended_PreInit_EventHandlers";
|
||||
SLX_XEH_STR_PostInit = "Extended_PostInit_EventHandlers";
|
||||
SLX_XEH_STR_DEH = "DefaultEventhandlers";
|
||||
SLX_XEH_STR_TAG = "SLX_XEH_";
|
||||
SLX_XEH_STR_PLAYABLE = "SLX_XEH_PLAYABLE";
|
||||
|
||||
SLX_XEH_STR_PROCESSED = "SLX_XEH_PROCESSED";
|
||||
SLX_XEH_AR_FALSE = [SLX_XEH_STR_PROCESSED, false];
|
||||
SLX_XEH_AR_TRUE = [SLX_XEH_STR_PROCESSED, true];
|
||||
|
||||
SLX_XEH_OTHER_EVENTS = [XEH_EVENTS,XEH_CUSTOM_EVENTS]; // All events except the init event
|
||||
SLX_XEH_OTHER_EVENTS_FULL = [];
|
||||
{ SLX_XEH_OTHER_EVENTS_FULL pushBack format["Extended_%1_EventHandlers", _x] } forEach SLX_XEH_OTHER_EVENTS;
|
||||
SLX_XEH_OTHER_EVENTS_XEH = [];
|
||||
{ SLX_XEH_OTHER_EVENTS_XEH pushBack format["Extended_%1EH", _x] } forEach SLX_XEH_OTHER_EVENTS;
|
||||
SLX_XEH_OTHER_EVENTS_XEH_PLAYERS = [];
|
||||
{ SLX_XEH_OTHER_EVENTS_XEH_PLAYERS pushBack format["Extended_%1EH_Player", _x] } forEach SLX_XEH_OTHER_EVENTS;
|
||||
SLX_XEH_OTHER_EVENTS_PLAYERS = [];
|
||||
|
||||
// HitPart is special in that the passed parameter to the event handler is an array of arrays
|
||||
{
|
||||
if (_x == "HitPart") then
|
||||
{
|
||||
SLX_XEH_OTHER_EVENTS_PLAYERS pushBack (compile format["{ { _this call _x } forEach (((_this select 0) select 0) getVariable [SLX_XEH_STR_%1_Player,[]]) }",_x])
|
||||
}
|
||||
else
|
||||
{
|
||||
SLX_XEH_OTHER_EVENTS_PLAYERS pushBack (compile format["{ { _this call _x } forEach ((_this select 0) getVariable [SLX_XEH_STR_%1_Player,[]]) }",_x])
|
||||
}
|
||||
} forEach SLX_XEH_OTHER_EVENTS;
|
||||
|
||||
SLX_XEH_CONFIG_FILES = [configFile, campaignConfigFile, missionConfigFile];
|
||||
SLX_XEH_CONFIG_FILES_VARIABLE = [campaignConfigFile, missionConfigFile];
|
||||
|
||||
SLX_XEH_DEF_CLASSES = [SLX_XEH_STR, "All"];
|
||||
|
||||
// XEH for non XEH supported addons
|
||||
// Only works until someone uses removeAllEventhandlers on the object
|
||||
// Only works if there is at least 1 XEH-enabled object on the Map - Place SLX_XEH_Logic to make sure XEH initializes.
|
||||
// TODO: Perhaps do a config verification - if no custom eventhandlers detected in _all_ CfgVehicles classes, don't run this XEH handler - might be too much processing.
|
||||
SLX_XEH_EVENTS_NAT = [XEH_EVENTS];
|
||||
SLX_XEH_EVENTS_FULL_NAT = [];
|
||||
{ SLX_XEH_EVENTS_FULL_NAT pushBack format["Extended_%1_EventHandlers", _x] } forEach SLX_XEH_EVENTS_NAT;
|
||||
|
||||
SLX_XEH_EXCLUDES = []; // TODO: Anything else?? - Ammo crates for instance have no XEH by default due to crashes) - however, they don't appear in 'vehicles' list anyway.
|
||||
SLX_XEH_CLASSES = []; // Used to cache classes that have full XEH setup - TODO: Performance test.. Could use object with a variable space, classname as key
|
||||
SLX_XEH_FULL_CLASSES = []; // Used to cache classes that NEED full XEH setup
|
||||
SLX_XEH_EXCL_CLASSES = []; // Used for exclusion classes
|
||||
|
||||
|
||||
// Function Compilation
|
||||
SLX_XEH_LOG = { XEH_LOG(_this); };
|
||||
|
||||
PREP(init_once); // Pre and PostInits
|
||||
|
||||
PREP(init_delayed);
|
||||
PREP(init_playable);
|
||||
|
||||
// Inits and InitPosts
|
||||
PREP(init);
|
||||
PREP(init_enum);
|
||||
PREP(init_enum_cache);
|
||||
PREP(init_post);
|
||||
|
||||
// Init Others
|
||||
PREP(init_others);
|
||||
PREP(init_others_enum);
|
||||
PREP(init_others_enum_cache);
|
||||
|
||||
PREP(addPlayerEvents); // Add / Remove the playerEvents
|
||||
PREP(removePlayerEvents);
|
||||
PREP(support_monitor);
|
||||
PREP(support_monitor2);
|
||||
|
||||
call COMPILE_FILE(init_eh); // All XEH Event functions
|
||||
|
||||
|
||||
/*
|
||||
* Process the crews of vehicles. This "thread" will run just
|
||||
* before PostInit and the mission init.sqf is processed. The order of execution is
|
||||
*
|
||||
* 1) all config.cpp init EHs (including all Extended_Init_Eventhandlers)
|
||||
* 2) all the init lines in the mission.sqm
|
||||
* 3) spawn:ed "threads" are started
|
||||
* 4) the mission's init.sqf/sqs is run
|
||||
*/
|
||||
|
||||
GVAR(init_obj) = SLX_XEH_DUMMY createVehicleLocal [0, 0, 0];
|
||||
GVAR(init_obj) addEventHandler ["killed", {
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
XEH_LOG("XEH: VehicleCrewInit: "+str(count vehicles));
|
||||
#endif
|
||||
|
||||
{
|
||||
_sim = getText(configFile/"CfgVehicles"/(typeOf _x)/"simulation");
|
||||
_crew = crew _x;
|
||||
/*
|
||||
* If it's a vehicle then start event handlers for the crew.
|
||||
* (Vehicles have crew and are neither humanoids nor game logics)
|
||||
*/
|
||||
if (count _crew > 0 && {{ _sim == _x }count["soldier", "invisible"] == 0}) then {
|
||||
{ if !(_x in SLX_XEH_INIT_MEN) then { [_x] call SLX_XEH_EH_Init } } forEach _crew;
|
||||
};
|
||||
} forEach vehicles;
|
||||
SLX_XEH_INIT_MEN = nil;
|
||||
|
||||
deleteVehicle GVAR(init_obj);GVAR(init_obj) = nil
|
||||
}];
|
||||
|
||||
GVAR(init_obj) setDamage 1; // Schedule to run itsy bitsy later
|
||||
|
||||
// Prepare postInit
|
||||
GVAR(init_obj2) = SLX_XEH_DUMMY createVehicleLocal [0, 0, 0];
|
||||
GVAR(init_obj2) addEventHandler ["killed", {
|
||||
call COMPILE_FILE(init_post);
|
||||
deleteVehicle GVAR(init_obj2);GVAR(init_obj2) = nil;
|
||||
}];
|
||||
|
||||
// Schedule PostInit
|
||||
SLX_XEH_STR spawn {
|
||||
// Warn if PostInit takes longer than 10 tickTime seconds
|
||||
SLX_XEH_STR spawn {
|
||||
private["_time2Wait"];
|
||||
_time2Wait = diag_ticktime + 10;
|
||||
waituntil {diag_ticktime > _time2Wait};
|
||||
if !(SLX_XEH_MACHINE select 8) then {
|
||||
XEH_LOG("WARNING: PostInit did not finish in a timely fashion");
|
||||
waitUntil {time > 0};
|
||||
// Consider there will be no player if neither PostInit-Ready, nor PlayerCheck-Ready
|
||||
if !(SLX_XEH_MACHINE select 8 || {SLX_XEH_MACHINE select 5}) then { SLX_XEH_MACHINE set [13, true]; };
|
||||
};
|
||||
};
|
||||
|
||||
// On Server + Non JIP Client, we are now after all objects have inited
|
||||
// and at the briefing, still time == 0
|
||||
if (isNull player) then {
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
"NULL PLAYER" call SLX_XEH_LOG;
|
||||
#endif
|
||||
if !((SLX_XEH_MACHINE select 4) || {(SLX_XEH_MACHINE select 6)}) then { // only if MultiPlayer and not dedicated
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
"JIP" call SLX_XEH_LOG;
|
||||
#endif
|
||||
|
||||
SLX_XEH_MACHINE set [1, true]; // set JIP
|
||||
// TEST for weird jip-is-server-issue :S
|
||||
if (!(SLX_XEH_MACHINE select 2) || {SLX_XEH_MACHINE select 3} || {SLX_XEH_MACHINE select 4}) then {
|
||||
str(["WARNING: JIP Client, yet wrong detection", SLX_XEH_MACHINE]) call SLX_XEH_LOG;
|
||||
SLX_XEH_MACHINE set [2, true]; // set Dedicated client
|
||||
SLX_XEH_MACHINE set [3, false]; // set server
|
||||
SLX_XEH_MACHINE set [4, false]; // set dedicatedserver
|
||||
};
|
||||
waitUntil { !(isNull player) || {SLX_XEH_MACHINE select 13} };
|
||||
if (SLX_XEH_MACHINE select 13) then { XEH_LOG("WARNING: TimedOut waiting for player object to be ready. Continueing PostInit without Player ready") };
|
||||
};
|
||||
};
|
||||
|
||||
if !(isNull player) then {
|
||||
if (isNull (group player) && {player isKindOf "CAManBase"}) then {
|
||||
// DEBUG TEST: Crashing due to JIP, or when going from briefing
|
||||
// into game
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
"NULLGROUP" call SLX_XEH_LOG;
|
||||
#endif
|
||||
waitUntil { !(isNull (group player)) };
|
||||
};
|
||||
waitUntil { local player };
|
||||
};
|
||||
|
||||
GVAR(init_obj2) setDamage 1; // Schedule to run itsy bitsy later
|
||||
|
||||
SLX_XEH_MACHINE set [5, true]; // set player check = complete
|
||||
};
|
||||
|
||||
// Load and call any "pre-init", run-once event handlers
|
||||
/*
|
||||
Compile code strings in the Extended_PreInit_EventHandlers class and call
|
||||
them. This is done once per mission and before any extended init event
|
||||
handler code is run. An addon maker can put run-once initialisation code
|
||||
in such a pre-init "EH" rather than in a normal XEH init EH which might be
|
||||
called several times.
|
||||
*/
|
||||
{ (_x/SLX_XEH_STR_PreInit) call FUNC(init_once) } forEach SLX_XEH_CONFIG_FILES;
|
||||
|
||||
|
||||
XEH_LOG("XEH: PreInit Finished. " + PFORMAT_3("CACHE DISABLED? (Disable caching with cba_cache_disable.pbo)",SLX_XEH_RECOMPILE,CBA_COMPILE_RECOMPILE,CBA_FUNC_RECOMPILE));
|
Loading…
Reference in New Issue
Block a user