mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix attempt.
This commit is contained in:
parent
e5eaefafdb
commit
2144a56be1
@ -15,6 +15,10 @@ class ACE_Settings {
|
||||
value = 1;
|
||||
typeName = "BOOL";
|
||||
};
|
||||
class GVAR(mapGlow) {
|
||||
value = 1;
|
||||
typeName = "BOOL";
|
||||
};
|
||||
class GVAR(mapShake) {
|
||||
value = 1;
|
||||
typeName = "BOOL";
|
||||
|
48
addons/map/CfgAmmo.hpp
Normal file
48
addons/map/CfgAmmo.hpp
Normal file
@ -0,0 +1,48 @@
|
||||
class CfgAmmo {
|
||||
|
||||
class FlareCore;
|
||||
|
||||
class FlareBase: FlareCore {};
|
||||
class F_20mm_White: FlareBase {};
|
||||
|
||||
class ACE_FlashlightProxy_White: F_20mm_White {
|
||||
model = "";
|
||||
effectFlare = "FlareShell";
|
||||
|
||||
triggerTime = 0;
|
||||
intensity = 1;
|
||||
flareSize = 1;
|
||||
timeToLive = 10e10;
|
||||
|
||||
lightColor[] = {1,1,1,1};
|
||||
|
||||
grenadeBurningSound[] = {};
|
||||
grenadeFireSound[] = {};
|
||||
soundTrigger[] = {};
|
||||
SmokeShellSoundHit1[] = {};
|
||||
SmokeShellSoundHit2[] = {};
|
||||
SmokeShellSoundHit3[] = {};
|
||||
SmokeShellSoundLoop1[] = {};
|
||||
SmokeShellSoundLoop2[] = {};
|
||||
};
|
||||
|
||||
class ACE_FlashlightProxy_Red: ACE_FlashlightProxy_White {
|
||||
intensity = 2.5;
|
||||
lightColor[] = {1,0,0,1};
|
||||
};
|
||||
|
||||
class ACE_FlashlightProxy_Green: ACE_FlashlightProxy_White {
|
||||
intensity = 1.5;
|
||||
lightColor[] = {0,1,0,1};
|
||||
};
|
||||
|
||||
class ACE_FlashlightProxy_Blue: ACE_FlashlightProxy_White {
|
||||
intensity = 2.5;
|
||||
lightColor[] = {0.25,0.25,1,1};
|
||||
};
|
||||
|
||||
class ACE_FlashlightProxy_Yellow: ACE_FlashlightProxy_White {
|
||||
intensity = 1.5;
|
||||
lightColor[] = {1,1,0.5,1};
|
||||
};
|
||||
};
|
7
addons/map/CfgSounds.hpp
Normal file
7
addons/map/CfgSounds.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
class CfgSounds {
|
||||
class ACE_map_flashlightClick {
|
||||
name = "ACE_map_flashlightClick";
|
||||
sound[] = {"\a3\sounds_f\weapons\Other\dry4.wss", 0.2, 2};
|
||||
titles[] = {};
|
||||
};
|
||||
};
|
@ -1,4 +1,20 @@
|
||||
class CfgVehicles {
|
||||
class Man;
|
||||
class CAManBase: Man {
|
||||
class ACE_SelfActions {
|
||||
class ACE_MapFlashlight {
|
||||
displayName = CSTRING(Action_Flashlights);
|
||||
icon = QUOTE(\a3\ui_f\data\IGUI\Cfg\VehicleToggles\lightsiconon_ca.paa);
|
||||
condition = QUOTE(GVAR(mapIllumination) && visibleMap && (count ([ACE_player] call FUNC(getUnitFlashlights)) > 0));
|
||||
statement = "true";
|
||||
exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"};
|
||||
insertChildren = QUOTE(_this call DFUNC(compileFlashlightMenu));
|
||||
showDisabled = 0;
|
||||
priority = 99;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_Module;
|
||||
class ACE_ModuleMap: ACE_Module {
|
||||
author = ECSTRING(common,ACETeam);
|
||||
@ -15,6 +31,12 @@ class CfgVehicles {
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class MapGlow {
|
||||
displayName = CSTRING(MapGlow_DisplayName);
|
||||
description = CSTRING(MapGlow_Description);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class MapShake {
|
||||
displayName = CSTRING(MapShake_DisplayName);
|
||||
description = CSTRING(MapShake_Description);
|
||||
@ -39,13 +61,14 @@ class CfgVehicles {
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_ModuleBlueForceTracking: ACE_Module {
|
||||
class Module_F;
|
||||
class ACE_ModuleBlueForceTracking: Module_F {
|
||||
author = ECSTRING(common,ACETeam);
|
||||
category = "ACE";
|
||||
displayName = CSTRING(BFT_Module_DisplayName);
|
||||
function = QFUNC(blueForceTrackingModule);
|
||||
scope = 2;
|
||||
isGlobal = 0;
|
||||
isGlobal = 1;
|
||||
icon = PATHTOF(UI\Icon_Module_BFTracking_ca.paa);
|
||||
class Arguments {
|
||||
class Enabled {
|
||||
@ -71,4 +94,4 @@ class CfgVehicles {
|
||||
description = CSTRING(BFT_Module_Description);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
@ -1,23 +1,24 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
// Exit on Headless as well
|
||||
if !(hasInterface) exitWith {};
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
LOG(MSG_INIT);
|
||||
|
||||
// Calculate the maximum zoom allowed for this map
|
||||
call FUNC(determineZoom);
|
||||
|
||||
// This spawn is probably worth keeping, as pfh don't work natively on the briefing screen and IDK how reliable the hack we implemented for them is.
|
||||
// The thread dies as soon as the mission start, so it's not really compiting for scheduler space.
|
||||
[] spawn {
|
||||
// Wait until the map display is detected
|
||||
waitUntil {(!isNull findDisplay 12)};
|
||||
[{
|
||||
if (isNull findDisplay 12) exitWith {};
|
||||
|
||||
GVAR(lastStillPosition) = ((findDisplay 12) displayCtrl 51) ctrlMapScreenToWorld [0.5, 0.5];
|
||||
GVAR(lastStillTime) = ACE_time;
|
||||
GVAR(isShaking) = false;
|
||||
|
||||
//map sizes are multiples of 1280
|
||||
GVAR(worldSize) = worldSize / 1280;
|
||||
GVAR(mousePos) = [0.5,0.5];
|
||||
|
||||
//Allow panning the lastStillPosition while mapShake is active
|
||||
GVAR(rightMouseButtonLastPos) = [];
|
||||
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", {[] call FUNC(updateMapEffects);}];
|
||||
@ -42,13 +43,60 @@ call FUNC(determineZoom);
|
||||
GVAR(rightMouseButtonLastPos) = [];
|
||||
};
|
||||
}];
|
||||
};
|
||||
|
||||
//get mouse position on map
|
||||
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseMoving", {
|
||||
GVAR(mousePos) = (_this select 0) ctrlMapScreenToWorld [_this select 1, _this select 2];
|
||||
}];
|
||||
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseHolding", {
|
||||
GVAR(mousePos) = (_this select 0) ctrlMapScreenToWorld [_this select 1, _this select 2];
|
||||
}];
|
||||
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
}, 0] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
["SettingsInitialized", {
|
||||
// Start Blue Force Tracking if Enabled
|
||||
if (GVAR(BFT_Enabled)) then {
|
||||
diag_log text "[ACE] Blue Force Tracking Enabled (client)";
|
||||
GVAR(BFT_markers) = [];
|
||||
[FUNC(blueForceTrackingUpdate), GVAR(BFT_Interval), []] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
//illumination settings
|
||||
if (GVAR(mapIllumination)) then {
|
||||
GVAR(flashlightInUse) = "";
|
||||
GVAR(aceNVG) = ["ace_nightvision"] call EFUNC(common,isModLoaded);
|
||||
GVAR(glow) = objNull;
|
||||
|
||||
["playerInventoryChanged", {
|
||||
_flashlights = [ACE_player] call FUNC(getUnitFlashlights);
|
||||
if ((GVAR(flashlightInUse) != "") && !(GVAR(flashlightInUse) in _flashlights)) then {
|
||||
GVAR(flashlightInUse) = "";
|
||||
};
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
if (GVAR(mapGlow)) then {
|
||||
["visibleMapChanged", {
|
||||
params ["_player", "_mapOn"];
|
||||
if (_mapOn) then {
|
||||
if (!alive _player && !isNull GVAR(glow)) then {
|
||||
GVAR(flashlightInUse) = "";
|
||||
};
|
||||
if (GVAR(flashlightInUse) != "") then {
|
||||
if (isNull GVAR(glow)) then {
|
||||
[GVAR(flashlightInUse)] call FUNC(flashlightGlow);
|
||||
};
|
||||
} else {
|
||||
if (!isNull GVAR(glow)) then {
|
||||
[""] call FUNC(flashlightGlow);
|
||||
};
|
||||
};
|
||||
} else {
|
||||
if (!isNull GVAR(glow)) then {
|
||||
[""] call FUNC(flashlightGlow);
|
||||
};
|
||||
};
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
};
|
||||
};
|
||||
}] call EFUNC(common,addEventHandler);
|
@ -5,10 +5,15 @@ LOG(MSG_INIT);
|
||||
|
||||
PREP(blueForceTrackingModule);
|
||||
PREP(blueForceTrackingUpdate);
|
||||
PREP(compileFlashlightMenu);
|
||||
PREP(determineMapLight);
|
||||
PREP(determineZoom);
|
||||
PREP(flashlightGlow);
|
||||
PREP(getUnitFlashlights);
|
||||
PREP(moduleMap);
|
||||
PREP(onDrawMap);
|
||||
PREP(simulateMapLight);
|
||||
PREP(switchFlashlight);
|
||||
PREP(updateMapEffects);
|
||||
|
||||
ADDON = true;
|
||||
|
@ -27,6 +27,8 @@ class RscEdit;
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgMarkers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgAmmo.hpp"
|
||||
#include "CfgSounds.hpp"
|
||||
|
||||
class RscMapControl {
|
||||
maxSatelliteAlpha = 0.5;
|
||||
|
@ -12,12 +12,15 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
if !(hasInterface) exitWith {};
|
||||
|
||||
PARAMS_1(_logic);
|
||||
PARAMS_3(_logic,_units,_activated);
|
||||
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
[_logic, QGVAR(BFT_Enabled), "Enabled"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(BFT_Interval), "Interval"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(BFT_HideAiGroups), "HideAiGroups"] call EFUNC(common,readSettingFromModule);
|
||||
|
||||
diag_log text "[ACE]: Blue Force Tracking Module initialized. (server)";
|
||||
diag_log text "[ACE]: Blue Force Tracking Module initialized.";
|
||||
TRACE_2("[ACE]: Blue Force Tracking Module initialized.", GVAR(BFT_Interval), GVAR(BFT_HideAiGroups));
|
||||
|
65
addons/map/functions/fnc_compileFlashlightMenu.sqf
Normal file
65
addons/map/functions/fnc_compileFlashlightMenu.sqf
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Author: voiper
|
||||
* Compile list of flashlight classnames and add to the "Flashlight" parent menu.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
* 1: Player <OBJECT>
|
||||
* 3: Parameters <ARRAY>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_player, _player, []] call ace_map_fnc_compileFlashlightMenu;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_vehicle", "_player", "_parameters"];
|
||||
|
||||
_actions = [];
|
||||
_flashlights = [_player] call FUNC(getUnitFlashlights);
|
||||
|
||||
//add all carried flashlight menus and on/off submenu actions
|
||||
{
|
||||
_displayName = getText (configFile >> "CfgWeapons" >> _x >> "displayName");
|
||||
_icon = getText (configFile >> "CfgWeapons" >> _x >> "picture");
|
||||
|
||||
_children = {
|
||||
params ["_vehicle", "_player", "_flashlight"];
|
||||
_actions = [];
|
||||
|
||||
_onAction = [
|
||||
(_flashlight + "_On"),
|
||||
"On",
|
||||
"",
|
||||
{[_this select 2] call FUNC(switchFlashlight)},
|
||||
{GVAR(flashlightInUse) != (_this select 2)},
|
||||
{},
|
||||
_flashlight
|
||||
] call EFUNC(interact_menu,createAction);
|
||||
|
||||
_offAction = [
|
||||
(_flashlight + "_Off"),
|
||||
"Off",
|
||||
"",
|
||||
{[""] call FUNC(switchFlashlight)},
|
||||
{GVAR(flashlightInUse) == (_this select 2)},
|
||||
{},
|
||||
_flashlight
|
||||
] call EFUNC(interact_menu,createAction);
|
||||
|
||||
_actions pushBack [_onAction, [], _player];
|
||||
_actions pushBack [_offAction, [], _player];
|
||||
|
||||
_actions
|
||||
};
|
||||
|
||||
_parentAction = [_x, _displayName, _icon, {true}, {true}, _children, _x] call EFUNC(interact_menu,createAction);
|
||||
_actions pushBack [_parentAction, [], _player];
|
||||
} forEach _flashlights;
|
||||
|
||||
_actions
|
@ -55,11 +55,13 @@ _fnc_calcColor = {
|
||||
|
||||
_lightLevel = 0.04 + (0.96 * call EFUNC(common,ambientBrightness));
|
||||
|
||||
/*
|
||||
// check if player has NVG enabled
|
||||
if (currentVisionMode _unit == 1) exitWith {
|
||||
// stick to nvg color
|
||||
[true, [154/255,253/255,177/255,0.5]]
|
||||
};
|
||||
*/
|
||||
|
||||
// Do not obscure the map if the ambient light level is above 0.95
|
||||
if (_lightLevel > 0.95) exitWith {
|
||||
@ -122,4 +124,4 @@ if (_lightLevel > 0.95) exitWith {
|
||||
};
|
||||
|
||||
// Calculate resulting map color
|
||||
[true, [_lightTint, _lightLevel] call _fnc_calcColor]
|
||||
[true, [_lightTint, _lightLevel] call _fnc_calcColor]
|
41
addons/map/functions/fnc_flashlightGlow.sqf
Normal file
41
addons/map/functions/fnc_flashlightGlow.sqf
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Author: voiper
|
||||
* Add or remove global flashlight glow for when player is looking at map.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Flashlight classname ("" for off) <STRING>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* ["ACE_Flashlight_MX991"] call ace_map_fnc_flashlightGlow;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_flashlight"];
|
||||
|
||||
_light = GVAR(glow);
|
||||
if (!isNull _light) then {deleteVehicle _light};
|
||||
|
||||
if (_flashlight != "") then {
|
||||
_colour = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour");
|
||||
|
||||
_class = switch (_colour) do {
|
||||
case "white": {"ACE_FlashlightProxy_White"};
|
||||
case "red": {"ACE_FlashlightProxy_Red"};
|
||||
case "green": {"ACE_FlashlightProxy_Green"};
|
||||
case "blue": {"ACE_FlashlightProxy_Blue"};
|
||||
case "yellow": {"ACE_FlashlightProxy_Yellow"};
|
||||
};
|
||||
|
||||
_light = _class createVehicle [0,0,0];
|
||||
_light attachTo [ACE_player, [0,0.5,-0.1], "head"];
|
||||
} else {
|
||||
_light = objNull;
|
||||
};
|
||||
|
||||
GVAR(glow) = _light;
|
29
addons/map/functions/fnc_getUnitFlashlights.sqf
Normal file
29
addons/map/functions/fnc_getUnitFlashlights.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Author: voiper
|
||||
* Check a unit for any flashlights that can be used on map.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit to check <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Flashlight classnames (empty for none) <ARRAY>
|
||||
*
|
||||
* Example:
|
||||
* [unit] call ace_map_fnc_getUnitFlashlights;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
_flashlights = [];
|
||||
|
||||
{
|
||||
if ((isText (configFile >> "CfgWeapons" >> _x >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour")) && !(_x in _flashlights)) then {
|
||||
_flashlights pushBack _x;
|
||||
};
|
||||
} forEach (items _unit);
|
||||
|
||||
_flashlights
|
@ -8,15 +8,17 @@
|
||||
* Return Value:
|
||||
* None
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
if !(isServer) exitWith {};
|
||||
|
||||
PARAMS_3(_logic,_units,_activated);
|
||||
params ["_logic", "_units", "_activated"];
|
||||
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
[_logic, QGVAR(mapIllumination), "MapIllumination" ] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(mapGlow), "MapGlow" ] 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);
|
||||
|
136
addons/map/functions/fnc_simulateMapLight.sqf
Normal file
136
addons/map/functions/fnc_simulateMapLight.sqf
Normal file
@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Author: voiper
|
||||
* Draw sexy flashlight beams and NVG on main map.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Map control (Control)
|
||||
* 1: Map zoom level (Number)
|
||||
* 2: Current map centre (Array)
|
||||
* 3: Light level from ace_map_fnc_determineMapLight (Array)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_mapCtrl", "_mapScale", "_mapCentre", "_lightLevel"];
|
||||
|
||||
_hmd = hmd ACE_player;
|
||||
_nvgOn = (((getText (configFile >> 'CfgWeapons' >> _hmd >> 'simulation')) == 'NVGoggles') && (currentVisionMode ACE_player == 1));
|
||||
_aceNVG = GVAR(aceNVG);
|
||||
_flashlight = GVAR(flashlightInUse);
|
||||
|
||||
//map width (on screen) in pixels
|
||||
_screenSize = 640 * safeZoneW;
|
||||
|
||||
//resolution params (every frame in case resolution change)
|
||||
getResolution params ["_resX", "_resY", "_viewPortX", "_viewPortY", "", "_uiScale"];
|
||||
|
||||
//engine rounds the viewport ratios, when they should be fractions; this can cause problems
|
||||
_realViewPortY = _resY * _uiScale;
|
||||
_realViewPortX = _realViewPortY * 4/3;
|
||||
|
||||
//textures
|
||||
_blackTex = "#(rgb,8,8,3)color(0,0,0,1)";
|
||||
_whiteTex = "#(rgb,8,8,3)color(1,1,1,1)";
|
||||
|
||||
//colour/alpha
|
||||
_lightLevel params ["_r", "_g", "_b", "_a"];
|
||||
_colourAlpha = (_r + _g + _b) min _a;
|
||||
_shadeAlpha = _a;
|
||||
|
||||
if (_nvgOn) then {
|
||||
_flashlightAdd = if (_flashlight != "") then {0.75} else {0};
|
||||
_shadeAlpha = 0.8 - _a + _flashlightAdd;
|
||||
_fillTex = _whiteTex;
|
||||
|
||||
if (_aceNVG) then {
|
||||
_nvgAlpha = ACE_player getVariable [QEGVAR(nightvision,NVGBrightness), 0];
|
||||
|
||||
if (_nvgAlpha >= 0) then {
|
||||
_shadeAlpha = _shadeAlpha + _nvgAlpha / 2;
|
||||
} else {
|
||||
//if flashlight off
|
||||
if (_flashlight == "") then {
|
||||
//if there's nearby light
|
||||
if (_shadeAlpha > 0) then {
|
||||
_shadeAlpha = _shadeAlpha + _nvgAlpha / 2;
|
||||
} else {
|
||||
_fillTex = _blackTex;
|
||||
_shadeAlpha = -_nvgAlpha / 1.5;
|
||||
};
|
||||
} else {
|
||||
_shadeAlpha = _shadeAlpha + _nvgAlpha;
|
||||
};
|
||||
};
|
||||
|
||||
_grainConfig = (configFile >> "CfgWeapons" >> _hmd >> "ACE_NightVision_grain");
|
||||
_grain = if (isNumber _grainConfig) then {
|
||||
(getNumber _grainConfig) / 2
|
||||
} else {
|
||||
0
|
||||
};
|
||||
|
||||
if (_grain > 0) then {
|
||||
_posX = (_mapCentre select 0) + (_mapScale * random 500);
|
||||
_posY = (_mapCentre select 1) + (_mapScale * random 500);
|
||||
_mapCtrl drawIcon [format["#(ai,2048,2048,1)perlinNoise(%1,%2,0,1)", _resX, _resX], [0.25,0.25,0.25,_grain], [_posX, _posY], _screenSize * 2.5, _screenSize * 2.5, 0, "", 0]; //noise
|
||||
};
|
||||
};
|
||||
|
||||
_mapCtrl drawIcon ["#(rgb,8,8,3)color(0,0.5,0,1)", [1,1,1,0.5], _mapCentre, _screenSize, _screenSize, 0, "", 0]; //nvg green
|
||||
_mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], _mapCentre, _screenSize, _screenSize, 0, "", 0]; //alpha fill
|
||||
} else {
|
||||
_fillTex = _blackTex;
|
||||
|
||||
_colourList = [_r, _g, _b];
|
||||
_colourList sort false;
|
||||
_maxColour = _colourList select 0;
|
||||
|
||||
//ambient colour fill
|
||||
_mapCtrl drawIcon [format["#(rgb,8,8,3)color(%1,%2,%3,1)", _r / _maxColour, _g / _maxColour, _b / _maxColour], [1,1,1,_colourAlpha], _mapCentre, _screenSize, _screenSize, 0, "", 0];
|
||||
|
||||
if (_flashlight == "") then {
|
||||
//ambient shade fill
|
||||
_mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], _mapCentre, _screenSize, _screenSize, 0, "", 0];
|
||||
} else {
|
||||
//mouse pos
|
||||
_mousePos = GVAR(mousePos);
|
||||
|
||||
//flashlight settings
|
||||
_colour = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour");
|
||||
_size = getNumber (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Size");
|
||||
_flashTex = format[QUOTE(PATHTOF_SYS(ace,flashlights,UI\Flashlight_Beam_%1_ca.paa)), _colour];
|
||||
_beamSize = _screenSize / _size;
|
||||
|
||||
//after 5x zoom, it's simulated to be fixed (it actually gets bigger relative to zoom)
|
||||
if (_mapScale < 0.2) then {_beamSize = _beamSize / (_mapScale * (1 / 0.2))};
|
||||
|
||||
//assign corrective ratio to fix sub-pixel gaps/overlaps (symptom of viewport * X/Y resolution rounding)
|
||||
_viewPortRatioFixY = if (_realViewPortY != _viewPortY) then {
|
||||
_realViewPortX / (_realViewPortY / _viewPortY * _viewPortX)
|
||||
} else {
|
||||
if (_realViewPortX != _viewPortX) then {
|
||||
_realViewPortX / _viewPortX
|
||||
} else {
|
||||
1
|
||||
};
|
||||
};
|
||||
|
||||
//offset the elements
|
||||
_offsetX = _mapScale * GVAR(worldSize) * (_screenSize * 2 + _beamSize);
|
||||
_offsetYDown = _mapScale * GVAR(worldSize) * (_screenSize + _beamSize) * _viewPortRatioFixY;
|
||||
//up is bigger because of a potential exploit
|
||||
_offsetYUp = _mapScale * GVAR(worldSize) * (_screenSize * 4 + _beamSize) * _viewPortRatioFixY;
|
||||
|
||||
//draw the matrix /whoa
|
||||
_mapCtrl drawIcon [_flashTex, [1,1,1,_shadeAlpha], _mousePos, _beamSize, _beamSize, 0, "", 0]; //centre beam
|
||||
_mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0) - _offsetX, (_mousePos select 1)], _screenSize * 2, _beamSize, 0, "", 0]; //left
|
||||
_mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0) + _offsetX, (_mousePos select 1)], _screenSize * 2, _beamSize, 0, "", 0]; //right
|
||||
_mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0), (_mousePos select 1) - _offsetYDown], _screenSize * 4, _screenSize, 0, "", 0]; //down
|
||||
_mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], [(_mousePos select 0), (_mousePos select 1) + _offsetYUp], _screenSize * 4, _screenSize * 4, 0, "", 0]; //up
|
||||
};
|
||||
};
|
25
addons/map/functions/fnc_switchFlashlight.sqf
Normal file
25
addons/map/functions/fnc_switchFlashlight.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: voioper
|
||||
* Switch flashlight.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Flashlight classname ("" for off) <STRING>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* ["ACE_Flashlight_MX991"] call ace_map_fnc_switchFlashlight;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_flashlight"];
|
||||
|
||||
GVAR(flashlightInUse) = _flashlight;
|
||||
if (GVAR(mapGlow)) then {
|
||||
[GVAR(flashlightInUse)] call FUNC(flashlightGlow);
|
||||
};
|
||||
playSound "ACE_map_flashlightClick";
|
@ -10,23 +10,21 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_mapCtrl","_mapScale"];
|
||||
|
||||
_mapCtrl = ((findDisplay 12) displayCtrl 51);
|
||||
_mapCtrl = findDisplay 12 displayCtrl 51;
|
||||
_mapScale = ctrlMapScale _mapCtrl;
|
||||
_mapCentre = _mapCtrl ctrlMapScreenToWorld [0.5, 0.5];
|
||||
|
||||
if (GVAR(mapIllumination)) then {
|
||||
private ["_data","_darkenFill"];
|
||||
//get nearby lighting
|
||||
_light = [[ACE_player], FUNC(determineMapLight), missionNamespace, QGVAR(mapLight), 0.1] call EFUNC(common,cachedCall);
|
||||
|
||||
// Calculate map illumination
|
||||
_data = [[ACE_player], FUNC(determineMapLight), missionNamespace, QGVAR(mapLight), 0.1] call EFUNC(common,cachedCall);
|
||||
_light params ["_applyLighting", "_lightLevel"];
|
||||
|
||||
EXPLODE_2_PVT(_data,_darkenMap,_darkenColor);
|
||||
if (_darkenMap) then {
|
||||
_darkenFill = format["#(rgb,1,1,1)color(%1,%2,%3,%4)",_darkenColor select 0, _darkenColor select 1, _darkenColor select 2, _darkenColor select 3];
|
||||
_mapCtrl drawRectangle [(getArray(configFile >> 'CfgWorlds' >> worldName >> 'centerPosition')),80000,80000,0,_darkenColor,_darkenFill];
|
||||
if (_applyLighting) then {
|
||||
[_mapCtrl, _mapScale, _mapCentre, _lightLevel] call FUNC(simulateMapLight);
|
||||
};
|
||||
};
|
||||
|
||||
@ -63,7 +61,7 @@ if (GVAR(mapShake)) then {
|
||||
GVAR(isShaking) = false;
|
||||
} else {
|
||||
// The map is still, store state
|
||||
GVAR(lastStillPosition) = _mapCtrl ctrlMapScreenToWorld [0.5, 0.5];
|
||||
GVAR(lastStillPosition) = _mapCentre;
|
||||
GVAR(lastStillTime) = ACE_time;
|
||||
};
|
||||
};
|
||||
@ -72,7 +70,7 @@ if (GVAR(mapShake)) then {
|
||||
if (GVAR(mapLimitZoom)) then {
|
||||
if (GVAR(minMapSize) >= _mapScale) then {
|
||||
ctrlMapAnimClear _mapCtrl;
|
||||
_mapCtrl ctrlMapAnimAdd [0, GVAR(minMapSize) + 0.001, (_mapCtrl ctrlMapScreenToWorld [0.5, 0.5])];
|
||||
_mapCtrl ctrlMapAnimAdd [0, GVAR(minMapSize) + 0.001, _mapCentre];
|
||||
ctrlMapAnimCommit _mapCtrl;
|
||||
};
|
||||
};
|
||||
};
|
@ -18,12 +18,13 @@
|
||||
<Portuguese>Iluminação do mapa?</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Map_MapIllumination_Description">
|
||||
<English>Calculate dynamic map illumination based on light conditions?</English>
|
||||
<Polish>Oblicza dynamiczne oświetlenie mapy bazujące na warunkach oświetleniowych</Polish>
|
||||
<Spanish>Calcula la iluminación dinámica del mapa basandose en las condiciones de luz</Spanish>
|
||||
<German>Berechne die Kartenauslichtung anhand des Umgebungslichts?</German>
|
||||
<Czech>Vypočítat dynamické osvětlení mapy na základně světelných podmínek?</Czech>
|
||||
<Portuguese>Calcular a iluminação dinâmica do mapa de acordo com as condições de luz?</Portuguese>
|
||||
<English>Simulate map lighting based on ambient lighting and player's items?</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Map_MapGlow_DisplayName">
|
||||
<English>Map flashlight glow?</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Map_MapGlow_Description">
|
||||
<English>Add external glow to players who use flashlight on map?</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Map_MapShake_DisplayName">
|
||||
<English>Map shake?</English>
|
||||
@ -74,7 +75,7 @@
|
||||
<Portuguese>Mostrar as coordenadas de grade no ponteiro do mouse?</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Map_Module_Description">
|
||||
<English>This module allows you to customize the map screen.</English>
|
||||
<English></English>
|
||||
<Polish>Moduł ten pozwala dostosować opcje widoku ekranu mapy.</Polish>
|
||||
<German>Dieses Modul erweitert die Kartenfunktionen.</German>
|
||||
<Czech>Tento modul umožňuje přizpůsobit mapu s obrazem.</Czech>
|
||||
@ -83,7 +84,7 @@
|
||||
<Key ID="STR_ACE_Map_BFT_Module_DisplayName">
|
||||
<English>Blue Force Tracking</English>
|
||||
<Polish>Blue Force Tracking</Polish>
|
||||
<Spanish>Blue Force Tracking</Spanish>
|
||||
<Spanish>Seguimiento de fuerzas amigas</Spanish>
|
||||
<German>Blue Force Tracking</German>
|
||||
<Czech>Blue Force Tracking</Czech>
|
||||
<Portuguese>Rastreio de forças azuis</Portuguese>
|
||||
@ -93,14 +94,12 @@
|
||||
<Portuguese>RFA ativo</Portuguese>
|
||||
<Polish>Aktywuj BFT</Polish>
|
||||
<Czech>Povolit BFT</Czech>
|
||||
<Spanish>Activar BFT</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Map_BFT_Enabled_Description">
|
||||
<English>Enable Blue Force Tracking. Default: No</English>
|
||||
<Portuguese>Ativa Rastreio de Forças Azuis. Padrão: Não</Portuguese>
|
||||
<Polish>Aktywuj Blue Force Tracking. Domyślnie: Nie</Polish>
|
||||
<Czech>Povolit Blue Force Tracking. Výchozí: Ne</Czech>
|
||||
<Spanish>Activar Blue Force Tracking. Por defecto: No</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Map_BFT_Interval_DisplayName">
|
||||
<English>Interval</English>
|
||||
@ -135,11 +134,35 @@
|
||||
<Portuguese>Esconder marcadores que pertencem ao grupo de IA?</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Map_BFT_Module_Description">
|
||||
<English>This module allows the tracking of allied units with BFT map markers.</English>
|
||||
<English></English>
|
||||
<Polish>Pozwala śledzić na mapie pozycje sojuszniczych jednostek za pomocą markerów BFT.</Polish>
|
||||
<German>Dieses Modul ermöglicht es verbündete Einheiten mit dem BFT auf der Karte zu verfolgen.</German>
|
||||
<Czech>Umožňuje sledovat přátelské jednokty na mapě v rámci BFT.</Czech>
|
||||
<Portuguese>Permite que você acompanhe as posições no mapa das unidades aliadas com marcadores RFA.</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Map_Action_Flashlights">
|
||||
<English>Flashlights</English>
|
||||
<Polish>Latarki</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Map_Action_NVG">
|
||||
<English>NVG</English>
|
||||
<Polish>Noktowizja</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Map_Action_NVGOn">
|
||||
<English>On</English>
|
||||
<Polish>Włącz</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Map_Action_NVGOff">
|
||||
<English>Off</English>
|
||||
<Polish>Wyłącz</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Map_Action_NVGUp">
|
||||
<English>Increase Brightness</English>
|
||||
<Polish>Zwiększ czułość</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Map_Action_NVGDown">
|
||||
<English>Decrease Brightness</English>
|
||||
<Polish>Zmniejsz czułość</Polish>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user