diff --git a/addons/common/RscInfoType.hpp b/addons/common/RscInfoType.hpp index fe21b05265..429d1d7b02 100644 --- a/addons/common/RscInfoType.hpp +++ b/addons/common/RscInfoType.hpp @@ -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);); +}; diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 95a639b943..b7da27ea75 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -193,6 +193,7 @@ PREP(getHitPoints); PREP(getHitPointsWithSelections); PREP(getReflectorsWithSelections); PREP(getLightProperties); +PREP(getLightPropertiesWeapon); PREP(getVehicleCrew); // turrets diff --git a/addons/common/functions/fnc_getLightPropertiesWeapon.sqf b/addons/common/functions/fnc_getLightPropertiesWeapon.sqf new file mode 100644 index 0000000000..d444654b5f --- /dev/null +++ b/addons/common/functions/fnc_getLightPropertiesWeapon.sqf @@ -0,0 +1,58 @@ +/* + * Author: commy2 + * Read properties of given flashlight. @todo, Can weapons themselves still have flashlights (no attachment)? + * + * Arguments: + * 0: A flashlight (String) + * + * Return Value: + * Stuff from config (Array) + * + */ +#include "script_component.hpp" + +private "_weapon"; + +_weapon = _this select 0; + +private "_config"; +_config = configFile >> "CfgWeapons" >> _weapon >> "ItemInfo" >> "FlashLight"; + +private ["_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"]; + +_intensity = getNumber (_config >> "intensity"); +_position = getText (_config >> "position"); +_direction = getText (_config >> "direction"); +_innerAngle = getNumber (_config >> "innerAngle"); +_outerAngle = getNumber (_config >> "outerAngle"); + +[_intensity, _position, _direction, _innerAngle, _outerAngle] + +/* +class FlashLight +{ + color[] = {180,156,120}; + ambient[] = {0.9,0.78,0.6}; + intensity = 20; + size = 1; + innerAngle = 20; + outerAngle = 80; + coneFadeCoef = 5; + position = "flash dir"; + direction = "flash"; + useFlare = 1; + flareSize = 1.4; + flareMaxDistance = "100.0f"; + dayLight = 0; + class Attenuation + { + start = 0.5; + constant = 0; + linear = 0; + quadratic = 1.1; + hardLimitStart = 20; + hardLimitEnd = 30; + }; + scale[] = {0}; +}; +*/ diff --git a/addons/common/functions/fnc_getTurnedOnLights.sqf b/addons/common/functions/fnc_getTurnedOnLights.sqf index 6f0dc5a9bb..e50c15f593 100644 --- a/addons/common/functions/fnc_getTurnedOnLights.sqf +++ b/addons/common/functions/fnc_getTurnedOnLights.sqf @@ -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; diff --git a/addons/common/functions/fnc_lightIntensityFromObject.sqf b/addons/common/functions/fnc_lightIntensityFromObject.sqf index cf9e215403..98e7935f9f 100644 --- a/addons/common/functions/fnc_lightIntensityFromObject.sqf +++ b/addons/common/functions/fnc_lightIntensityFromObject.sqf @@ -20,37 +20,90 @@ _lightSource = _this select 1; private "_unitPos"; _unitPos = _unit modelToWorld (_unit selectionPosition "spine3"); -private ["_lights", "_lightLevel"]; - -_lights = [_lightSource] call FUNC(getTurnedOnLights); - +private "_lightLevel"; _lightLevel = 0; -{ - private ["_properties", "_intensity", "_innerAngle", "_outerAngle", "_position", "_direction", "_directionToUnit", "_distance", "_angle"]; +if (_lightSource isKindOf "CAManBase") then { + // handle persons with flashlights - _properties = [_lightSource, _x] call FUNC(getLightProperties); + private "_weapon"; + _weapon = currentWeapon _lightSource; - // @todo intensity affects range? - //_intensity = _properties select 0; + if !(_lightSource isFlashlightOn _weapon) exitWith {}; + + private ["_flashlight", "_properties", "_intensity", "_innerAngle", "_outerAngle", "_position", "_direction", "_directionToUnit", "_distance", "_angle"]; + + _flashlight = switch (_weapon) do { + case (primaryWeapon _lightSource): { + primaryWeaponItems _lightSource select 1 + }; + case (secondaryWeapon _lightSource): { + secondaryWeaponItems _lightSource select 1 + }; + case (handgunWeapon _lightSource): { + handgunItems _lightSource select 1 + }; + default {""}; + }; + + _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; - // get world position and direction - _position = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 1)); - _direction = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 2)); + _position = _lightSource modelToWorld (_lightSource selectionPosition "rightHand"); + _direction = _lightSource weaponDirection _weapon; - _direction = _position vectorFromTo _direction; _directionToUnit = _position vectorFromTo _unitPos; _distance = _unitPos distance _position; _angle = acos (_direction vectorDotProduct _directionToUnit); - _lightLevel = _lightLevel max ((linearConversion [0, 30, _distance, 1, 0, true]) * (linearConversion [_innerAngle, _outerAngle, _angle, 1, 0, true])); + _lightLevel = (linearConversion [0, 30, _distance, 1, 0, true]) * (linearConversion [_innerAngle, _outerAngle, _angle, 1, 0, true]); -//systemChat format ["%1 %2", (linearConversion [0, 30, _distance, 1, 0, true]), (linearConversion [_innerAngle, _outerAngle, _angle, 1, 0, true])]; +} else { + // handle any object, strcutures, cars, tanks, etc. -} forEach _lights; + private "_lights"; + _lights = [_lightSource] call FUNC(getTurnedOnLights); + + { + private ["_properties", "_intensity", "_innerAngle", "_outerAngle", "_position", "_direction", "_directionToUnit", "_distance", "_angle"]; + + _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; + + _innerAngle = (_properties select 3) / 2; + _outerAngle = (_properties select 4) / 2; + + // get world position and direction + _position = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 1)); + _direction = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 2)); + + _direction = _position vectorFromTo _direction; + _directionToUnit = _position vectorFromTo _unitPos; + + _distance = _unitPos distance _position; + _angle = acos (_direction vectorDotProduct _directionToUnit); + + _lightLevel = _lightLevel max ((linearConversion [0, 30, _distance, 1, 0, true]) * (linearConversion [_innerAngle, _outerAngle, _angle, 1, 0, true])); + + //systemChat format ["%1 %2", (linearConversion [0, 30, _distance, 1, 0, true]), (linearConversion [_innerAngle, _outerAngle, _angle, 1, 0, true])]; + + } 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 diff --git a/addons/common/scripts/Version/checkVersionNumber.sqf b/addons/common/scripts/Version/checkVersionNumber.sqf index 87b89a8b6b..467ebd9c1a 100644 --- a/addons/common/scripts/Version/checkVersionNumber.sqf +++ b/addons/common/scripts/Version/checkVersionNumber.sqf @@ -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; diff --git a/addons/map/CfgVehicles.hpp b/addons/map/CfgVehicles.hpp index b8d3a54d96..612cadb006 100644 --- a/addons/map/CfgVehicles.hpp +++ b/addons/map/CfgVehicles.hpp @@ -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;}; + }; + }; }; }; diff --git a/addons/map/XEH_preInit.sqf b/addons/map/XEH_preInit.sqf index 7899c6a637..c5645a52e7 100644 --- a/addons/map/XEH_preInit.sqf +++ b/addons/map/XEH_preInit.sqf @@ -8,6 +8,7 @@ PREP(blueForceTrackingUpdate); PREP(determineMapLight); PREP(determineZoom); PREP(moduleMap); +PREP(onDrawMap); PREP(updateMapEffects); ADDON = true; diff --git a/addons/map/config.cpp b/addons/map/config.cpp index e544a67c12..cb3cbc8d6d 100644 --- a/addons/map/config.cpp +++ b/addons/map/config.cpp @@ -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 { diff --git a/addons/map/functions/fnc_moduleMap.sqf b/addons/map/functions/fnc_moduleMap.sqf index b6e556c92e..a22bbbb385 100644 --- a/addons/map/functions/fnc_moduleMap.sqf +++ b/addons/map/functions/fnc_moduleMap.sqf @@ -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."; diff --git a/addons/map/functions/fnc_onDrawMap.sqf b/addons/map/functions/fnc_onDrawMap.sqf new file mode 100644 index 0000000000..bc147884e4 --- /dev/null +++ b/addons/map/functions/fnc_onDrawMap.sqf @@ -0,0 +1,4 @@ +// by commy2 +#include "script_component.hpp" + +((_this select 0) displayCtrl 1016) ctrlShow GVAR(mapShowCursorCoordinates); diff --git a/addons/maptools/CfgMarkers.hpp b/addons/maptools/CfgMarkers.hpp deleted file mode 100644 index 8a2b86fc13..0000000000 --- a/addons/maptools/CfgMarkers.hpp +++ /dev/null @@ -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; - }; -}; diff --git a/addons/maptools/MapGpsUI.hpp b/addons/maptools/MapGpsUI.hpp index ff8ec8b96e..170f0d1620 100644 --- a/addons/maptools/MapGpsUI.hpp +++ b/addons/maptools/MapGpsUI.hpp @@ -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"; diff --git a/addons/maptools/UI/mapGps.paa b/addons/maptools/UI/mapGps.paa index f4ed1dfc54..defcdbc63b 100644 Binary files a/addons/maptools/UI/mapGps.paa and b/addons/maptools/UI/mapGps.paa differ diff --git a/addons/maptools/XEH_postInitClient.sqf b/addons/maptools/XEH_postInitClient.sqf index e94cdaf266..26fb005e9f 100644 --- a/addons/maptools/XEH_postInitClient.sqf +++ b/addons/maptools/XEH_postInitClient.sqf @@ -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);}]; }; diff --git a/addons/maptools/config.cpp b/addons/maptools/config.cpp index d5b1f26396..6ccf874e69 100644 --- a/addons/maptools/config.cpp +++ b/addons/maptools/config.cpp @@ -32,7 +32,6 @@ class RscEdit; #include "MapGpsUI.hpp" #include "CfgEventHandlers.hpp" -#include "CfgMarkers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" diff --git a/addons/maptools/functions/fnc_addLineMarker.sqf b/addons/maptools/functions/fnc_addLineMarker.sqf index a55792e98a..83e983d0e3 100644 --- a/addons/maptools/functions/fnc_addLineMarker.sqf +++ b/addons/maptools/functions/fnc_addLineMarker.sqf @@ -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 + * 1: Marker start pos + * 2: Marker end pos + * 3: Color index * * 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); }; diff --git a/addons/maptools/functions/fnc_calculateMapScale.sqf b/addons/maptools/functions/fnc_calculateMapScale.sqf index d8ed1cfcb9..700e089a88 100644 --- a/addons/maptools/functions/fnc_calculateMapScale.sqf +++ b/addons/maptools/functions/fnc_calculateMapScale.sqf @@ -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]; diff --git a/addons/maptools/functions/fnc_canDraw.sqf b/addons/maptools/functions/fnc_canDraw.sqf index a5088f668b..da55043d85 100644 --- a/addons/maptools/functions/fnc_canDraw.sqf +++ b/addons/maptools/functions/fnc_canDraw.sqf @@ -1,5 +1,15 @@ -// by esteldunedain - +/* + * Author: esteldunedain + * canDraw + * + * Arguments: + * None + * + * Return value: + * + * + * Public: No + */ #include "script_component.hpp" (missionNameSpace getVariable [QGVAR(drawing_syncMarkers), true] && {GVAR(EveryoneCanDrawOnBriefing)}) || diff --git a/addons/maptools/functions/fnc_canUseMapGPS.sqf b/addons/maptools/functions/fnc_canUseMapGPS.sqf index f3d0b10c56..381136a1cc 100644 --- a/addons/maptools/functions/fnc_canUseMapGPS.sqf +++ b/addons/maptools/functions/fnc_canUseMapGPS.sqf @@ -1,5 +1,15 @@ -// by esteldunedain - +/* + * Author: esteldunedain + * canUseMapGPS + * + * Arguments: + * None + * + * Return value: + * + * + * Public: No + */ #include "script_component.hpp" visibleMap && diff --git a/addons/maptools/functions/fnc_canUseMapTools.sqf b/addons/maptools/functions/fnc_canUseMapTools.sqf index fe0bf012da..30d86160ab 100644 --- a/addons/maptools/functions/fnc_canUseMapTools.sqf +++ b/addons/maptools/functions/fnc_canUseMapTools.sqf @@ -1,5 +1,15 @@ -// by esteldunedain - +/* + * Author: esteldunedain + * canUseMapTools + * + * Arguments: + * None + * + * Return value: + * + * + * Public: No + */ #include "script_component.hpp" visibleMap && diff --git a/addons/maptools/functions/fnc_cancelDrawing.sqf b/addons/maptools/functions/fnc_cancelDrawing.sqf index 09396e61fe..bc80602cfc 100644 --- a/addons/maptools/functions/fnc_cancelDrawing.sqf +++ b/addons/maptools/functions/fnc_cancelDrawing.sqf @@ -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) = []; diff --git a/addons/maptools/functions/fnc_copyMapReceiveMarkers.sqf b/addons/maptools/functions/fnc_copyMapReceiveMarkers.sqf index d2675a2b06..e3de77316a 100644 --- a/addons/maptools/functions/fnc_copyMapReceiveMarkers.sqf +++ b/addons/maptools/functions/fnc_copyMapReceiveMarkers.sqf @@ -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 * * 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; diff --git a/addons/maptools/functions/fnc_copyMapStart.sqf b/addons/maptools/functions/fnc_copyMapStart.sqf index 11464d7573..a39c74d225 100644 --- a/addons/maptools/functions/fnc_copyMapStart.sqf +++ b/addons/maptools/functions/fnc_copyMapStart.sqf @@ -1,11 +1,10 @@ /* * Author: esteldunedain - * * Send request to remote player * - * Argument: - * 0: Player (Unit) - * 0: Target player (Unit) + * Arguments: + * 0: Player + * 0: Target player * * Code Chain: * START: copyMapStart: triggers event drawing_requestMarkers on remote diff --git a/addons/maptools/functions/fnc_handleKeyDown.sqf b/addons/maptools/functions/fnc_handleKeyDown.sqf index 4553ed62ab..d2b3a060b8 100644 --- a/addons/maptools/functions/fnc_handleKeyDown.sqf +++ b/addons/maptools/functions/fnc_handleKeyDown.sqf @@ -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 diff --git a/addons/maptools/functions/fnc_handleMouseButton.sqf b/addons/maptools/functions/fnc_handleMouseButton.sqf index b0eb848e61..8db6b8b0f1 100644 --- a/addons/maptools/functions/fnc_handleMouseButton.sqf +++ b/addons/maptools/functions/fnc_handleMouseButton.sqf @@ -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 diff --git a/addons/maptools/functions/fnc_handleMouseMove.sqf b/addons/maptools/functions/fnc_handleMouseMove.sqf index 6df07cfead..4111c8fad4 100644 --- a/addons/maptools/functions/fnc_handleMouseMove.sqf +++ b/addons/maptools/functions/fnc_handleMouseMove.sqf @@ -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 diff --git a/addons/maptools/functions/fnc_handleMouseZChanged.sqf b/addons/maptools/functions/fnc_handleMouseZChanged.sqf index 483efc56b7..35626238e5 100644 --- a/addons/maptools/functions/fnc_handleMouseZChanged.sqf +++ b/addons/maptools/functions/fnc_handleMouseZChanged.sqf @@ -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 diff --git a/addons/maptools/functions/fnc_isInsideMapTool.sqf b/addons/maptools/functions/fnc_isInsideMapTool.sqf index 4e2339f9f1..4dd66e2b9a 100644 --- a/addons/maptools/functions/fnc_isInsideMapTool.sqf +++ b/addons/maptools/functions/fnc_isInsideMapTool.sqf @@ -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) + * 1: y Position (in meters) * * 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); diff --git a/addons/maptools/functions/fnc_mapStateUpdater.sqf b/addons/maptools/functions/fnc_mapStateUpdater.sqf index efc5efb956..2b4e634567 100644 --- a/addons/maptools/functions/fnc_mapStateUpdater.sqf +++ b/addons/maptools/functions/fnc_mapStateUpdater.sqf @@ -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); }; diff --git a/addons/maptools/functions/fnc_openMapGps.sqf b/addons/maptools/functions/fnc_openMapGps.sqf index 03b3f5525c..c4e2436b3b 100644 --- a/addons/maptools/functions/fnc_openMapGps.sqf +++ b/addons/maptools/functions/fnc_openMapGps.sqf @@ -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? + * + * 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"]; }; - diff --git a/addons/maptools/functions/fnc_openMapGpsUpdate.sqf b/addons/maptools/functions/fnc_openMapGpsUpdate.sqf index a26a02dd34..ddc177f182 100644 --- a/addons/maptools/functions/fnc_openMapGpsUpdate.sqf +++ b/addons/maptools/functions/fnc_openMapGpsUpdate.sqf @@ -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 diff --git a/addons/maptools/functions/fnc_removeLineMarker.sqf b/addons/maptools/functions/fnc_removeLineMarker.sqf index 15af48217e..45c39611db 100644 --- a/addons/maptools/functions/fnc_removeLineMarker.sqf +++ b/addons/maptools/functions/fnc_removeLineMarker.sqf @@ -1,10 +1,9 @@ /* * Author: esteldunedain - * * Remove the line marker * - * Argument: - * 0: Marker Name (string) + * Arguments: + * 0: Marker Name * * 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); }; diff --git a/addons/maptools/functions/fnc_updateLineMarker.sqf b/addons/maptools/functions/fnc_updateLineMarker.sqf index 9635dc02fa..cf80c1ac26 100644 --- a/addons/maptools/functions/fnc_updateLineMarker.sqf +++ b/addons/maptools/functions/fnc_updateLineMarker.sqf @@ -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 + * 1: Marker start pos + * 2: Marker end pos + * 3: Color index * * 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; }; diff --git a/addons/maptools/functions/fnc_updateMapToolMarkers.sqf b/addons/maptools/functions/fnc_updateMapToolMarkers.sqf index bb096bd064..3a7b919b8b 100644 --- a/addons/maptools/functions/fnc_updateMapToolMarkers.sqf +++ b/addons/maptools/functions/fnc_updateMapToolMarkers.sqf @@ -1,73 +1,46 @@ /* * Author: esteldunedain - * * Update the map tool markers, position, size, rotation and visibility. * - * Argument: - * None + * Arguments: + * 0: The Map * * 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]; diff --git a/addons/maptools/script_component.hpp b/addons/maptools/script_component.hpp index df2a8d3f62..30a9f83d0d 100644 --- a/addons/maptools/script_component.hpp +++ b/addons/maptools/script_component.hpp @@ -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" diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 9f0484f671..097292d9cc 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -295,14 +295,16 @@ class ACE_Medical_Advanced { selections[] = {"All"}; bleedingRate = 0.0001; pain = 0.01; - causes[] = {"falling", "ropeburn", "vehiclecrash"}; + causes[] = {"falling", "ropeburn", "vehiclecrash", "unknown"}; minDamage = 0.01; class Minor { minDamage = 0.01; + maxDamage = 0.2; bleedingRate = 0.0001; }; class Medium { minDamage = 0.2; + maxDamage = 0.3; bleedingRate = 0.00015; }; class Large { @@ -321,10 +323,12 @@ class ACE_Medical_Advanced { minDamage = 0.2; class Minor { minDamage = 0.2; + maxDamage = 0.3; bleedingRate = 0.01; }; class Medium { minDamage = 0.3; + maxDamage = 0.6; bleedingRate = 0.02; }; class Large { @@ -341,14 +345,18 @@ class ACE_Medical_Advanced { pain = 0.05; causes[] = {"bullet", "backblast", "punch","vehiclecrash","falling"}; minDamage = 0.01; + maxDamage = 0.1; class Minor { minDamage = 0.01; + maxDamage = 0.1; }; class Medium { minDamage = 0.1; + maxDamage = 0.15; }; class Large { - minDamage = 0.3; + minDamage = 0.15; + maxDamage = 0.2; }; }; @@ -358,14 +366,16 @@ class ACE_Medical_Advanced { selections[] = {"All"}; bleedingRate = 0.01; pain = 0.1; - causes[] = {"falling", "vehiclecrash", "punch"}; + causes[] = {"falling", "vehiclecrash", "punch", "unknown"}; minDamage = 0.1; class Minor { minDamage = 0.1; + maxDamage = 0.45; bleedingRate = 0.005; }; class Medium { minDamage = 0.4; + maxDamage = 0.7; bleedingRate = 0.007; }; class Large { @@ -380,14 +390,16 @@ class ACE_Medical_Advanced { selections[] = {"All"}; bleedingRate = 0.01; pain = 0.075; - causes[] = {"vehiclecrash", "grenade", "explosive", "shell", "backblast", "stab"}; + causes[] = {"vehiclecrash", "grenade", "explosive", "shell", "backblast", "stab", "unknown"}; minDamage = 0.1; class Minor { minDamage = 0.1; + maxDamage = 0.3; bleedingRate = 0.005; }; class Medium { minDamage = 0.3; + maxDamage = 0.65; bleedingRate = 0.02; }; class Large { @@ -406,10 +418,12 @@ class ACE_Medical_Advanced { minDamage = 0.01; class Minor { minDamage = 0.1; + maxDamage = 0.5; bleedingRate = 0.005; }; class Medium { minDamage = 0.5; + maxDamage = 0.7; bleedingRate = 0.01; }; class Large { @@ -424,10 +438,11 @@ class ACE_Medical_Advanced { selections[] = {"All"}; bleedingRate = 0.01; pain = 0.2; - causes[] = {"bullet", "grenade","explosive", "shell"}; + causes[] = {"bullet", "grenade","explosive", "shell", "unknown"}; minDamage = 0.15; class Minor { minDamage = 0.15; + maxDamage = 0.3; bleedingRate = 0.025; }; class Medium { @@ -450,10 +465,12 @@ class ACE_Medical_Advanced { minDamage = 0.01; class Minor { minDamage = 0.01; + maxDamage = 0.5; bleedingRate = 0.01; }; class Medium { minDamage = 0.5; + maxDamage = 0.75; bleedingRate = 0.03; }; class Large { @@ -518,6 +535,9 @@ class ACE_Medical_Advanced { thresholds[] = {{0.1, 1}}; selectionSpecific = 1; }; + class unknown { + thresholds[] = {{0.1, 1}}; + }; }; }; class Treatment { @@ -751,7 +771,7 @@ class ACE_Medical_Advanced { // specific details for the ACE_Morphine treatment action class Morphine { - painReduce = 0.7; + painReduce = 1; hrIncreaseLow[] = {-10, -30, 35}; hrIncreaseNormal[] = {-10, -50, 40}; hrIncreaseHigh[] = {-10, -40, 50}; diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index 0af12c0a37..4d2f2db9be 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -113,4 +113,8 @@ class ACE_Settings { typeName = "BOOL"; value = 1; }; + class GVAR(healHitPointAfterAdvBandage) { + typeName = "BOOL"; + value = 1; + }; }; diff --git a/addons/medical/CfgWeapons.hpp b/addons/medical/CfgWeapons.hpp index 6545464ea9..51795d266c 100644 --- a/addons/medical/CfgWeapons.hpp +++ b/addons/medical/CfgWeapons.hpp @@ -24,7 +24,7 @@ class CfgWeapons { class ACE_fieldDressing: ACE_ItemCore { scope = 2; model = QUOTE(PATHTOF(data\bandage.p3d)); - picture = QUOTE(PATHTOF(ui\items\fieldDressing.paa)); + picture = QUOTE(PATHTOF(ui\items\fieldDressing_x_ca.paa)); displayName = $STR_ACE_MEDICAL_BANDAGE_BASIC_DISPLAY; descriptionShort = $STR_ACE_MEDICAL_BANDAGE_BASIC_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_BANDAGE_BASIC_DESC_USE; @@ -38,7 +38,7 @@ class CfgWeapons { count = 1; type = 16; displayName = $STR_ACE_MEDICAL_PACKING_BANDAGE_DISPLAY; - picture = QUOTE(PATHTOF(ui\items\packingBandage.paa)); + picture = QUOTE(PATHTOF(ui\items\packingBandage_x_ca.paa)); model = QUOTE(PATHTOF(data\packingbandage.p3d)); descriptionShort = $STR_ACE_MEDICAL_PACKING_BANDAGE_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_PACKING_BANDAGE_DESC_USE; @@ -52,7 +52,7 @@ class CfgWeapons { count = 1; type = 16; displayName = $STR_ACE_MEDICAL_BANDAGE_ELASTIC_DISPLAY; - picture = QUOTE(PATHTOF(ui\items\elasticBandage.paa)); + picture = QUOTE(PATHTOF(ui\items\elasticBandage_x_ca.paa)); model = "\A3\Structures_F_EPA\Items\Medical\Bandage_F.p3d"; descriptionShort = $STR_ACE_MEDICAL_BANDAGE_ELASTIC_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_BANDAGE_ELASTIC_DESC_USE; @@ -66,7 +66,7 @@ class CfgWeapons { count = 1; type = 16; displayName = $STR_ACE_MEDICAL_TOURNIQUET_DISPLAY; - picture = QUOTE(PATHTOF(ui\items\tourniquet.paa)); + picture = QUOTE(PATHTOF(ui\items\tourniquet_x_ca.paa)); model = QUOTE(PATHTOF(data\tourniquet.p3d)); descriptionShort = $STR_ACE_MEDICAL_TOURNIQUET_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_TOURNIQUET_DESC_USE; @@ -80,7 +80,7 @@ class CfgWeapons { count = 1; type = 16; displayName = $STR_ACE_MEDICAL_MORPHINE_DISPLAY; - picture = QUOTE(PATHTOF(ui\items\morphine.paa)); + picture = QUOTE(PATHTOF(ui\items\morphine_x_ca.paa)); model = QUOTE(PATHTOF(data\morphine.p3d)); descriptionShort = $STR_ACE_MEDICAL_MORPHINE_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_MORPHINE_DESC_USE; @@ -94,7 +94,7 @@ class CfgWeapons { count = 1; type = 16; displayName = $STR_ACE_MEDICAL_ATROPINE_DISPLAY; - picture = QUOTE(PATHTOF(ui\items\atropine.paa)); + picture = QUOTE(PATHTOF(ui\items\atropine_x_ca.paa)); model = QUOTE(PATHTOF(data\atropine.p3d)); descriptionShort = $STR_ACE_MEDICAL_ATROPINE_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_ATROPINE_DESC_USE; @@ -109,7 +109,7 @@ class CfgWeapons { count = 1; type = 16; displayName = $STR_ACE_MEDICAL_EPINEPHRINE_DISPLAY; - picture = QUOTE(PATHTOF(ui\items\epinephrine.paa)); + picture = QUOTE(PATHTOF(ui\items\epinephrine_x_ca.paa)); model = QUOTE(PATHTOF(data\epinephrine.p3d)); descriptionShort = $STR_ACE_MEDICAL_EPINEPHRINE_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_EPINEPHRINE_DESC_USE; @@ -122,7 +122,7 @@ class CfgWeapons { value = 1; count = 1; displayName = $STR_ACE_MEDICAL_PLASMA_IV; - picture = QUOTE(PATHTOF(ui\items\plasmaIV.paa)); + picture = QUOTE(PATHTOF(ui\items\plasmaIV_x_ca.paa)); descriptionShort = $STR_ACE_MEDICAL_PLASMA_IV_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_PLASMA_IV_DESC_USE; class ItemInfo: InventoryItem_Base_F { @@ -147,7 +147,7 @@ class CfgWeapons { count = 1; model = "\A3\Structures_F_EPA\Items\Medical\BloodBag_F.p3d"; displayName = $STR_ACE_MEDICAL_BLOOD_IV; - picture = QUOTE(PATHTOF(ui\items\bloodIV.paa)); + picture = QUOTE(PATHTOF(ui\items\bloodIV_x_ca.paa)); descriptionShort = $STR_ACE_MEDICAL_BLOOD_IV_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_BLOOD_IV_DESC_USE; class ItemInfo: InventoryItem_Base_F { @@ -171,7 +171,7 @@ class CfgWeapons { value = 1; count = 1; displayName = $STR_ACE_MEDICAL_SALINE_IV; - picture = QUOTE(PATHTOF(ui\items\salineIV.paa)); + picture = QUOTE(PATHTOF(ui\items\salineIV_x_ca.paa)); descriptionShort = $STR_ACE_MEDICAL_SALINE_IV_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_SALINE_IV_DESC_USE; class ItemInfo: InventoryItem_Base_F { @@ -196,7 +196,7 @@ class CfgWeapons { count = 1; type = 16; displayName = $STR_ACE_MEDICAL_QUIKCLOT_DISPLAY; - picture = QUOTE(PATHTOF(ui\items\quickclot.paa)); + picture = QUOTE(PATHTOF(ui\items\quickclot_x_ca.paa)); descriptionShort = $STR_ACE_MEDICAL_QUIKCLOT_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_QUIKCLOT_DESC_USE; class ItemInfo: InventoryItem_Base_F { @@ -209,7 +209,7 @@ class CfgWeapons { count = 1; type = 16; displayName = $STR_ACE_MEDICAL_AID_KIT_DISPLAY; - picture = QUOTE(PATHTOF(ui\items\personal_aid_kit.paa)); + picture = QUOTE(PATHTOF(ui\items\personal_aid_kit_x_ca.paa)); descriptionShort = $STR_ACE_MEDICAL_AID_KIT_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_AID_KIT_DESC_USE; class ItemInfo: InventoryItem_Base_F { @@ -220,7 +220,7 @@ class CfgWeapons { scope=2; displayName= $STR_ACE_MEDICAL_SURGICALKIT_DISPLAY; model = QUOTE(PATHTOF(data\surgical_kit.p3d)); - picture = QUOTE(PATHTOF(ui\items\surgicalKit.paa)); + picture = QUOTE(PATHTOF(ui\items\surgicalKit_x_ca.paa)); descriptionShort = $STR_ACE_MEDICAL_SURGICALKIT_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_SURGICALKIT_DESC_USE; class ItemInfo: InventoryItem_Base_F { @@ -231,7 +231,7 @@ class CfgWeapons { scope=2; displayName= $STR_ACE_MEDICAL_BODYBAG_DISPLAY; model = QUOTE(PATHTOF(data\bodybagItem.p3d)); - picture = QUOTE(PATHTOF(ui\items\bodybag.paa)); + picture = QUOTE(PATHTOF(ui\items\bodybag_x_ca.paa)); descriptionShort = $STR_ACE_MEDICAL_BODYBAG_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_BODYBAG_DESC_USE; class ItemInfo: InventoryItem_Base_F { diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index 27f2ce07b9..7d52ff36d4 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -8,7 +8,6 @@ GVAR(heartBeatSounds_Fast) = ["ACE_heartbeat_fast_1", "ACE_heartbeat_fast_2", "A GVAR(heartBeatSounds_Normal) = ["ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"]; GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"]; -["Medical_treatmentCompleted", FUNC(onTreatmentCompleted)] call ace_common_fnc_addEventHandler; ["medical_propagateWound", FUNC(onPropagateWound)] call ace_common_fnc_addEventHandler; ["medical_woundUpdateRequest", FUNC(onWoundUpdateRequest)] call ace_common_fnc_addEventHandler; ["interactMenuClosed", {[objNull, false] call FUNC(displayPatientInformation); }] call ace_common_fnc_addEventHandler; @@ -134,9 +133,9 @@ GVAR(effectTimeBlood) = time; _bleeding = ACE_player call FUNC(getBloodLoss); // Bleeding Indicator - if (_bleeding > 0 and GVAR(effectTimeBlood) + 6 < time) then { + if (_bleeding > 0 and GVAR(effectTimeBlood) + 3.5 < time) then { GVAR(effectTimeBlood) = time; - [500 * _bleeding] call BIS_fnc_bloodEffect; + [600 * _bleeding] call BIS_fnc_bloodEffect; }; // Blood Volume Effect diff --git a/addons/medical/functions/fnc_actionLoadUnit.sqf b/addons/medical/functions/fnc_actionLoadUnit.sqf index 7f55d585d6..b4320d8d73 100644 --- a/addons/medical/functions/fnc_actionLoadUnit.sqf +++ b/addons/medical/functions/fnc_actionLoadUnit.sqf @@ -23,9 +23,6 @@ if ([_target] call EFUNC(common,isAwake)) exitwith { ["displayTextStructured", [_caller], [["This person (%1) is awake and cannot be loaded", [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent); }; -[_caller, objNull] call cse_fnc_carryObj; -[_target, objNull] call cse_fnc_carryObj; - _vehicle = [_caller, _target] call EFUNC(common,loadPerson); if (!isNull _vehicle) then { if (!isnil QGVAR(DROP_ADDACTION)) then { diff --git a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf index 75d7b67daa..2eafe36732 100644 --- a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf +++ b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf @@ -26,7 +26,6 @@ _tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; // Check if there is a tourniquet on this bodypart if ((_tourniquets select _part) == 0) exitwith { - // TODO localization _output = "There is no tourniquet on this body part!"; ["displayTextStructured", [_caller], [_output, 1.5, _caller]] call EFUNC(common,targetEvent); }; @@ -37,5 +36,3 @@ _target setvariable [QGVAR(tourniquets), _tourniquets, true]; // Adding the tourniquet item to the caller _caller addItem "ACE_tourniquet"; - -// "AinvPknlMstpSlayWrflDnon_medic diff --git a/addons/medical/functions/fnc_determineIfFatal.sqf b/addons/medical/functions/fnc_determineIfFatal.sqf index 978aa16b2b..6c90e54da3 100644 --- a/addons/medical/functions/fnc_determineIfFatal.sqf +++ b/addons/medical/functions/fnc_determineIfFatal.sqf @@ -16,7 +16,7 @@ _part = _this select 1; _withDamage = if (count _this > 2) then { _this select 2} else {0}; if (!alive _unit) exitwith {true}; -if (_part < 0 || _part > 5) exitwith {}; +if (_part < 0 || _part > 5) exitwith {false}; if ((vehicle _unit != _unit) && {!alive (vehicle _unit)}) exitwith { true }; // Find the correct Damage threshold for unit. diff --git a/addons/medical/functions/fnc_displayPatientInformation.sqf b/addons/medical/functions/fnc_displayPatientInformation.sqf index 599c2f344f..2e0525f1a3 100644 --- a/addons/medical/functions/fnc_displayPatientInformation.sqf +++ b/addons/medical/functions/fnc_displayPatientInformation.sqf @@ -14,11 +14,12 @@ #include "script_component.hpp" -private ["_target", "_show"]; +private ["_target", "_show", "_selectionN"]; _target = _this select 0; _show = if (count _this > 1) then {_this select 1} else {true}; -GVAR(currentSelectedSelectionN) = if (count _this > 2) then {_this select 2} else {0}; +_selectionN = if (count _this > 2) then {_this select 2} else {0}; +GVAR(currentSelectedSelectionN) = if (typeName _selectionN == "SCALAR") then {_selectionN} else {0}; GVAR(displayPatientInformationTarget) = if (_show) then {_target} else {ObjNull}; if (USE_WOUND_EVENT_SYNC) then { @@ -75,6 +76,7 @@ if (_show) then { _genericMessages pushback [format[localize "STR_ACE_MEDICAL_receivingIvVolume", floor _totalIvVolume], [1, 1, 1, 1]]; }; + _damaged = [false, false, false, false, false, false]; _selectionBloodLoss = [0,0,0,0,0,0]; if (GVAR(level) >= 2) then { _openWounds = _target getvariable [QGVAR(openWounds), []]; @@ -82,10 +84,12 @@ if (_show) then { { _amountOf = _x select 3; // Find how much this bodypart is bleeding - _selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + (15 * ((_x select 4) * _amountOf))]; - if (GVAR(currentSelectedSelectionN) == (_x select 2)) then { + if (_amountOf > 0) then { + _damaged set[_x select 2, true]; + _selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + (20 * ((_x select 4) * _amountOf))]; + + if (_selectionN == (_x select 2)) then { // Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this] - if (_amountOf > 0) then { if (_amountOf >= 1) then { // TODO localization _allInjuryTexts pushback [format["%2x %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [1,1,1,1]]; @@ -101,27 +105,28 @@ if (_show) then { { _amountOf = _x select 3; // Find how much this bodypart is bleeding - //if (_selectionBloodLoss select (_x select 2) == 0) then { - // _selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + (15 * ((_x select 4) * _amountOf))]; - //}; - if (GVAR(currentSelectedSelectionN) == (_x select 2)) then { + if !(_damaged select (_x select 2)) then { + _selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + (20 * ((_x select 4) * _amountOf))]; + }; + if (_selectionN == (_x select 2)) then { // Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this] if (_amountOf > 0) then { if (_amountOf >= 1) then { // TODO localization - _allInjuryTexts pushback [format["[B] %2x %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [1,0.5,0.5,1]]; + _allInjuryTexts pushback [format["[B] %2x %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [0.88,0.7,0.65,1]]; } else { // TODO localization - _allInjuryTexts pushback [format["[B] Partial %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6], [1,0.5,0.5,1]]; + _allInjuryTexts pushback [format["[B] Partial %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6], [0.88,0.7,0.65,1]]; }; }; }; }foreach _bandagedwounds; } else { + _damaged = [true, true, true, true, true, true]; { _selectionBloodLoss set [_forEachIndex, _target getHitPointDamage _x]; - if (_target getHitPointDamage _x > 0.1) then { + if (_target getHitPointDamage _x > 0.1 && {_forEachIndex == _selectionN}) then { // @todo localize _allInjuryTexts pushBack [format ["%1 %2", ["Lightly wounded", "Heavily wounded"] select (_target getHitPointDamage _x > 0.5), @@ -132,7 +137,7 @@ if (_show) then { }; // Handle the body image coloring - _damaged = [false, false, false, false, false, false]; + _availableSelections = [50,51,52,53,54,55]; { private ["_red", "_green", "_blue"]; @@ -141,27 +146,30 @@ if (_show) then { _red = 1; _green = 1; _blue = 1; - if (_total >0) then { - _green = 0.9 - _total; - if (_green < 0.0) then { - _green = 0.0; + if (_total > 0) then { + if (_damaged select _forEachIndex) then { + _green = (0.9 - _total) max 0; + _blue = _green; + } else { + _green = (0.9 - _total) max 0; + _red = _green; + //_blue = _green; }; - _blue = _green; - _damaged set[_foreachIndex, true]; }; (_display displayCtrl (_availableSelections select _foreachIndex)) ctrlSetTextColor [_red, _green, _blue, 1.0]; }foreach _selectionBloodLoss; - // TODO fill the lb with the appropiate information for the patient _lbCtrl = (_display displayCtrl 200); lbClear _lbCtrl; { _lbCtrl lbAdd (_x select 0); _lbCtrl lbSetColor [_foreachIndex, _x select 1]; }foreach _genericMessages; + + _amountOfGeneric = count _genericMessages; { _lbCtrl lbAdd (_x select 0); - _lbCtrl lbSetColor [_foreachIndex, _x select 1]; + _lbCtrl lbSetColor [_foreachIndex + _amountOfGeneric, _x select 1]; }foreach _allInjuryTexts; if (count _allInjuryTexts == 0) then { _lbCtrl lbAdd "No injuries on this bodypart.."; diff --git a/addons/medical/functions/fnc_handleDamage_wounds.sqf b/addons/medical/functions/fnc_handleDamage_wounds.sqf index b2d7b3514d..1eebe038cd 100644 --- a/addons/medical/functions/fnc_handleDamage_wounds.sqf +++ b/addons/medical/functions/fnc_handleDamage_wounds.sqf @@ -33,6 +33,13 @@ _injuryTypeInfo = missionNamespace getvariable [format[QGVAR(woundInjuryType_%1) // This are the available injuries for this damage type. Format [[classtype, selections, bloodloss, minimalDamage, pain], ..] _allInjuriesForDamageType = _injuryTypeInfo select 2; +// It appears we are dealing with an unknown type of damage. + +if (count _allInjuriesForDamageType == 0) then { + // grabbing the configuration for unknown damage type + _injuryTypeInfo = missionNamespace getvariable [QGVAR(woundInjuryType_unknown),[[], false, []]]; + _allInjuriesForDamageType = _injuryTypeInfo select 2; +}; // find the available injuries for this damage type and damage amount _highestPossibleSpot = -1; @@ -67,10 +74,7 @@ _allPossibleInjuries = []; // No possible wounds available for this damage type or damage amount. if (_highestPossibleSpot < 0) exitwith { - // It appears we are dealing with an unknown type of damage. - if (count _allInjuriesForDamageType == 0) then { - }; }; // Administration for open wounds and ids @@ -84,7 +88,7 @@ _woundsCreated = []; for "_i" from 0 to (1+ floor(random(_x select 1)-1)) /* step +1 */ do { // Find the injury we are going to add. Format [ classID, allowdSelections, bloodloss, painOfInjury, minimalDamage] - _toAddInjury = if (random(1) >= 0.5) then {_allInjuriesForDamageType select _highestPossibleSpot} else {_allPossibleInjuries select (floor(random (count _allPossibleInjuries)));}; + _toAddInjury = if (random(1) >= 0.85) then {_allInjuriesForDamageType select _highestPossibleSpot} else {_allPossibleInjuries select (floor(random (count _allPossibleInjuries)));}; _toAddClassID = _toAddInjury select 0; _foundIndex = -1; diff --git a/addons/medical/functions/fnc_parseConfigForInjuries.sqf b/addons/medical/functions/fnc_parseConfigForInjuries.sqf index 4efc7ac8ae..c624b1af1b 100644 --- a/addons/medical/functions/fnc_parseConfigForInjuries.sqf +++ b/addons/medical/functions/fnc_parseConfigForInjuries.sqf @@ -12,10 +12,9 @@ #include "script_component.hpp" -private ["_injuriesRootConfig", "_woundsConfig", "_allWoundClasses", "_amountOf", "_entry","_classType", "_selections", "_bloodLoss", "_pain","_minDamage","_causes", "_allTypes", "_damageTypesConfig", "_thresholds", "_typeThresholds", "_selectionSpecific", "_selectionSpecificType", "_classDisplayName", "_subClassDisplayName", "_maxDamage", "_subClassmaxDamage", "_defaultMinLethalDamage", "_minLethalDamage"]; +private ["_injuriesRootConfig", "_woundsConfig", "_allWoundClasses", "_amountOf", "_entry","_classType", "_selections", "_bloodLoss", "_pain","_minDamage","_causes", "_damageTypesConfig", "_thresholds", "_typeThresholds", "_selectionSpecific", "_selectionSpecificType", "_classDisplayName", "_subClassDisplayName", "_maxDamage", "_subClassmaxDamage", "_defaultMinLethalDamage", "_minLethalDamage"]; _injuriesRootConfig = (configFile >> "ACE_Medical_Advanced" >> "Injuries"); -_allTypes = ["stab", "grenade", "bullet", "explosive", "shell", "punch", "vehiclecrash", "backblast", "falling", "bite", "ropeburn"]; _allFoundDamageTypes = []; _configDamageTypes = (_injuriesRootConfig >> "damageTypes"); diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf index b08057f615..146e996d25 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf @@ -37,7 +37,6 @@ if !([_target] call FUNC(hasMedicalEnabled)) exitwith { }; }foreach _items;*/ -["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent; [_target, "activity", "STR_ACE_MEDICAL_ACTIVITY_bandagedPatient", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf index 0eaa8b4fa8..217a69cd4d 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf @@ -96,8 +96,11 @@ if (_impact > 0 && {GVAR(enableAdvancedWounds)}) then { }; // If all wounds have been bandaged, we will reset all damage to 0, so the unit is not showing any blood on the model anymore. -if (count _openWounds == 0) then { - _target setDamage 0; +if (GVAR(healHitPointAfterAdvBandage) && {{(_x select 2) == _part && {_x select 3 > 0}}count _openWounds == 0}) then { + _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; + _hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; + _point = _hitPoints select (_hitSelections find _selectionName); + [_target, _point, 0] call FUNC(setHitPointDamage); // _target setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true]; }; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf index 4d83a97c2e..508040b8af 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf @@ -32,7 +32,6 @@ _items = _this select 4; }; }foreach _items; -["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent; [_target, "activity", "STR_ACE_MEDICAL_ACTIVITY_usedItem", [[_caller] call EFUNC(common,getName), _className]] call FUNC(addToLog); true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf index 714f0f7e7f..bbf5aea6c0 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf @@ -71,9 +71,11 @@ if (alive _target) then { }; }; -// Reduce the pain level -_pain = _target getvariable [QGVAR(pain), 0]; -_target setvariable [QGVAR(pain), (_pain - _painReduce) max 0]; +if (_painReduce > 0) then { + // Reduce the pain level + _pain = _target getvariable [QGVAR(pain), 0]; + _target setvariable [QGVAR(pain), (_pain - (_pain * _painReduce)) max 0]; +}; _resistance = _unit getvariable [QGVAR(peripheralResistance), 100]; _resistance = _resistance + _viscosityChange; diff --git a/addons/medical/functions/fnc_treatmentIV.sqf b/addons/medical/functions/fnc_treatmentIV.sqf index 532b1a733c..c171d7364f 100644 --- a/addons/medical/functions/fnc_treatmentIV.sqf +++ b/addons/medical/functions/fnc_treatmentIV.sqf @@ -28,6 +28,5 @@ if (count _items == 0) exitwith {}; _removeItem = _items select 0; [[_target, _removeItem], QUOTE(DFUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ -["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent; [_target, _removeItem] call FUNC(addToTriageCard); [_target, "activity", "STR_ACE_MEDICAL_ACTIVITY_gaveIV", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); diff --git a/addons/medical/functions/fnc_treatmentTourniquet.sqf b/addons/medical/functions/fnc_treatmentTourniquet.sqf index 379ddbda7a..cff9458426 100644 --- a/addons/medical/functions/fnc_treatmentTourniquet.sqf +++ b/addons/medical/functions/fnc_treatmentTourniquet.sqf @@ -41,7 +41,7 @@ if ((_tourniquets select _part) > 0) exitwith { _removeItem = _items select 0; [[_target, _removeItem], QUOTE(DFUNC(treatmentTourniquetLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ -["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent; + [_target, _removeItem] call FUNC(addToTriageCard); [_target, "activity", "STR_ACE_MEDICAL_ACTIVITY_appliedTourniquet", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); diff --git a/addons/medical/ui/items/atropine.paa b/addons/medical/ui/items/atropine_x_ca.paa similarity index 100% rename from addons/medical/ui/items/atropine.paa rename to addons/medical/ui/items/atropine_x_ca.paa diff --git a/addons/medical/ui/items/bloodIV.paa b/addons/medical/ui/items/bloodIV_x_ca.paa similarity index 100% rename from addons/medical/ui/items/bloodIV.paa rename to addons/medical/ui/items/bloodIV_x_ca.paa diff --git a/addons/medical/ui/items/bodybag.paa b/addons/medical/ui/items/bodybag_x_ca.paa similarity index 100% rename from addons/medical/ui/items/bodybag.paa rename to addons/medical/ui/items/bodybag_x_ca.paa diff --git a/addons/medical/ui/items/elasticBandage.paa b/addons/medical/ui/items/elasticBandage_x_ca.paa similarity index 100% rename from addons/medical/ui/items/elasticBandage.paa rename to addons/medical/ui/items/elasticBandage_x_ca.paa diff --git a/addons/medical/ui/items/epinephrine.paa b/addons/medical/ui/items/epinephrine_x_ca.paa similarity index 100% rename from addons/medical/ui/items/epinephrine.paa rename to addons/medical/ui/items/epinephrine_x_ca.paa diff --git a/addons/medical/ui/items/fieldDressing.paa b/addons/medical/ui/items/fieldDressing_x_ca.paa similarity index 100% rename from addons/medical/ui/items/fieldDressing.paa rename to addons/medical/ui/items/fieldDressing_x_ca.paa diff --git a/addons/medical/ui/items/morphine.paa b/addons/medical/ui/items/morphine_x_ca.paa similarity index 100% rename from addons/medical/ui/items/morphine.paa rename to addons/medical/ui/items/morphine_x_ca.paa diff --git a/addons/medical/ui/items/packingBandage.paa b/addons/medical/ui/items/packingBandage_x_ca.paa similarity index 100% rename from addons/medical/ui/items/packingBandage.paa rename to addons/medical/ui/items/packingBandage_x_ca.paa diff --git a/addons/medical/ui/items/personal_aid_kit.paa b/addons/medical/ui/items/personal_aid_kit_x_ca.paa similarity index 100% rename from addons/medical/ui/items/personal_aid_kit.paa rename to addons/medical/ui/items/personal_aid_kit_x_ca.paa diff --git a/addons/medical/ui/items/plasmaIV.paa b/addons/medical/ui/items/plasmaIV_x_ca.paa similarity index 100% rename from addons/medical/ui/items/plasmaIV.paa rename to addons/medical/ui/items/plasmaIV_x_ca.paa diff --git a/addons/medical/ui/items/quickclot.paa b/addons/medical/ui/items/quickclot_x_ca.paa similarity index 100% rename from addons/medical/ui/items/quickclot.paa rename to addons/medical/ui/items/quickclot_x_ca.paa diff --git a/addons/medical/ui/items/salineIV.paa b/addons/medical/ui/items/salineIV_x_ca.paa similarity index 100% rename from addons/medical/ui/items/salineIV.paa rename to addons/medical/ui/items/salineIV_x_ca.paa diff --git a/addons/medical/ui/items/surgicalKit.paa b/addons/medical/ui/items/surgicalKit_x_ca.paa similarity index 100% rename from addons/medical/ui/items/surgicalKit.paa rename to addons/medical/ui/items/surgicalKit_x_ca.paa diff --git a/addons/medical/ui/items/tourniquet.paa b/addons/medical/ui/items/tourniquet_x_ca.paa similarity index 100% rename from addons/medical/ui/items/tourniquet.paa rename to addons/medical/ui/items/tourniquet_x_ca.paa diff --git a/tools/ace_build_tool/pabstFrankensteinBuilder.py b/tools/ace_build_tool/pabstFrankensteinBuilder.py index a0c57f2b3e..f58f192a53 100644 --- a/tools/ace_build_tool/pabstFrankensteinBuilder.py +++ b/tools/ace_build_tool/pabstFrankensteinBuilder.py @@ -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] @@ -576,33 +587,25 @@ See the make.cfg file for additional build options. if build_tool == "pboproject": try: #PABST: Convert config (run the macro'd config.cpp through CfgConvert twice to produce a de-macro'd cpp that pboProject can read without fucking up: - os.chdir(os.path.join(arma3tools_path, "CfgConvert")) shutil.copyfile(os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.backup")) - ret = subprocess.call(["cfgConvertGUI.exe", os.path.join(work_drive, prefix, module, "config.cpp")]) - if ret != 0: - print_error("cfgConvertGUI (bin) return code == " + str(ret)) - input("Press Enter to continue...") - - #PABST: Need micro sleeps because cfgConvertGUI can return before it's finished procressing - time.sleep(0.05) - - ret = subprocess.call(["cfgConvertGUI.exe", os.path.join(work_drive, prefix, module, "config.bin")]) - if ret != 0: - print_error("cfgConvertGUI (txt) return code == " + str(ret)) - input("Press Enter to continue...") - - time.sleep(0.05) - - #cmd = [rapifyTool, "-L", "-P", os.path.join(work_drive, prefix, module, "config.cpp")]; - #ret = subprocess.call(cmd) - #if ret != 0: - # print_error("rapifyTool return code == " + str(ret) + str(cmd)) - # input("Press Enter to continue...") - - # Call pboProject os.chdir("P:\\") + 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")]) + + if ret != 0: + print_error("CfgConvert -bin return code == " + str(ret)) + input("Press Enter to continue...") + + + 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)) + input("Press Enter to continue...") + if os.path.isfile(os.path.join(work_drive, prefix, module, "$NOBIN$")): print_green("$NOBIN$ Found. Proceeding with non-binarizing!") cmd = [makepboTool, "-P","-A","-L","-N","-G", os.path.join(work_drive, prefix, module),os.path.join(module_root, release_dir, project,"Addons")] diff --git a/tools/cba/addons/xeh/init_pre.sqf b/tools/cba/addons/xeh/init_pre.sqf new file mode 100644 index 0000000000..8e6a31f8c8 --- /dev/null +++ b/tools/cba/addons/xeh/init_pre.sqf @@ -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));