Merge pull request #1816 from voiperr/ace_map_dev

Flashlight simulation on map
This commit is contained in:
Glowbal 2015-08-26 09:01:30 +02:00
commit 13740c06e4
52 changed files with 950 additions and 38 deletions

View File

@ -111,6 +111,7 @@ if(!isServer) then {
if (isServer) then {
[FUNC(syncedEventPFH), 0.5, []] call CBA_fnc_addPerFrameHandler;
};
call FUNC(checkFiles);
@ -203,10 +204,11 @@ GVAR(OldCameraView) = cameraView;
GVAR(OldPlayerVehicle) = vehicle ACE_player;
GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
GVAR(OldVisibleMap) = false;
// PFH to raise varios events
[{
private ["_newCameraView", "_newInventoryDisplayIsOpen", "_newPlayerInventory", "_newPlayerTurret", "_newPlayerVehicle", "_newPlayerVisionMode", "_newPlayerWeapon", "_newZeusDisplayIsOpen"];
private ["_newCameraView", "_newInventoryDisplayIsOpen", "_newPlayerInventory", "_newPlayerTurret", "_newPlayerVehicle", "_newPlayerVisionMode", "_newPlayerWeapon", "_newZeusDisplayIsOpen", "_newVisibleMap"];
// "playerInventoryChanged" event
_newPlayerInventory = [ACE_player] call FUNC(getAllGear);
if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then {
@ -270,7 +272,15 @@ GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
GVAR(OldPlayerWeapon) = _newPlayerWeapon;
["playerWeaponChanged", [ACE_player, _newPlayerWeapon]] call FUNC(localEvent);
};
// "visibleMapChanged" event
_newVisibleMap = visibleMap;
if (!_newVisibleMap isEqualTo GVAR(OldVisibleMap)) then {
// Raise ACE event locally
GVAR(OldVisibleMap) = _newVisibleMap;
["visibleMapChanged", [ACE_player, _newVisibleMap]] call FUNC(localEvent);
};
}, 0, []] call CBA_fnc_addPerFrameHandler;

View File

@ -0,0 +1 @@
z\ace\addons\flashlights

View File

@ -0,0 +1,5 @@
class Extended_PostInit_EventHandlers {
class ADDON {
clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient) );
};
};

View File

@ -0,0 +1,7 @@
class CfgSounds {
class ACE_flashlights_flashlightClick {
name = "ACE_flashlights_flashlightClick";
sound[] = {"\a3\sounds_f\weapons\Other\dry4.wss", 0.2, 2};
titles[] = {};
};
};

View File

@ -0,0 +1,89 @@
class CfgVehicles {
class Man;
class CAManBase: Man {
class ACE_SelfActions {
//todo: add flashlight attach actions
};
};
class Item_Base_F;
class ACE_Flashlight_MX991Item: Item_Base_F {
scope = 2;
scopeCurator = 2;
displayName = CSTRING(MX991_DisplayName);
author = ECSTRING(common,ACETeam);
vehicleClass = "WeaponAccessories";
class TransportItems {
class ACE_Flashlight_MX991 {
name = "ACE_Flashlight_MX991";
count = 1;
};
};
};
class ACE_Flashlight_KSF1Item: Item_Base_F {
scope = 2;
scopeCurator = 2;
displayName = CSTRING(KSF1_DisplayName);
author = ECSTRING(common,ACETeam);
vehicleClass = "WeaponAccessories";
class TransportItems {
class ACE_Flashlight_KSF1 {
name = "ACE_Flashlight_KSF1";
count = 1;
};
};
};
class ACE_Flashlight_XL50Item: Item_Base_F {
scope = 2;
scopeCurator = 2;
displayName = CSTRING(XL50_DisplayName);
author = ECSTRING(common,ACETeam);
vehicleClass = "WeaponAccessories";
class TransportItems {
class ACE_Flashlight_XL50 {
name = "ACE_Flashlight_XL50";
count = 1;
};
};
};
class NATO_Box_Base;
class EAST_Box_Base;
class IND_Box_Base;
class FIA_Box_Base_F;
class Box_NATO_Support_F: NATO_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_Flashlight_MX991,12);
};
};
class Box_East_Support_F: EAST_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_Flashlight_KSF1,12);
};
};
class Box_IND_Support_F: IND_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_Flashlight_XL50,12);
};
};
class Box_FIA_Support_F: FIA_Box_Base_F {
class TransportItems {
MACRO_ADDITEM(ACE_Flashlight_MX991,12);
};
};
class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_Flashlight_MX991,12);
MACRO_ADDITEM(ACE_Flashlight_KSF1,12);
MACRO_ADDITEM(ACE_Flashlight_XL50,12);
};
};
};

View File

@ -0,0 +1,61 @@
class CfgWeapons {
class ItemCore;
class ACE_ItemCore;
class InventoryItem_Base_F;
class InventoryFlashlightItem_Base_F;
class acc_flashlight: ItemCore {
class ItemInfo: InventoryFlashlightItem_Base_F {
class Flashlight {
ACE_Flashlight_Colour = "white";
ACE_Flashlight_Size = 2.75;
};
};
};
class ACE_Flashlight_MX991: ACE_ItemCore {
displayName = CSTRING(MX991_DisplayName);
descriptionShort = CSTRING(MX991_Description);
model = QUOTE(PATHTOF(data\MX_991.p3d));
picture = PATHTOF(UI\mx991_ca.paa);
scope = 2;
class ItemInfo: InventoryItem_Base_F {
mass = 1;
class FlashLight {
ACE_Flashlight_Colour = "red";
ACE_Flashlight_Size = 1.75;
};
};
};
class ACE_Flashlight_KSF1: ACE_ItemCore {
displayName = CSTRING(KSF1_DisplayName);
descriptionShort = CSTRING(KSF1_Description);
model = QUOTE(PATHTOF(data\KSF_1.p3d));
picture = PATHTOF(UI\ksf1_ca.paa);
scope = 2;
class ItemInfo: InventoryItem_Base_F {
mass = 1;
class FlashLight {
ACE_Flashlight_Colour = "red";
ACE_Flashlight_Size = 1.5;
};
};
};
class ACE_Flashlight_XL50: ACE_ItemCore {
displayName = CSTRING(XL50_DisplayName);
descriptionShort = CSTRING(XL50_Description);
model = QUOTE(PATHTOF(data\Maglight.p3d));
picture = PATHTOF(UI\xl50_ca.paa);
scope = 2;
class ItemInfo: InventoryItem_Base_F {
mass = 1;
class FlashLight {
ACE_Flashlight_Colour = "white";
ACE_Flashlight_Size = 2.15;
};
};
};
};

View File

@ -0,0 +1,11 @@
ace_flashlights
=======
Flashlights for use on map and to attach to player.
## Maintainers
The people responsible for merging changes to this component or answering potential questions.
- [voiper](https://github.com/voiperr)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,8 @@
#include "script_component.hpp"
// Exit on Headless as well
if !(hasInterface) exitWith {};
LOG(MSG_INIT);
//todo: make flashlights attachable to players

View File

@ -0,0 +1,18 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {"ACE_Flashlight_MX991", "ACE_Flashlight_KSF1", "ACE_Flashlight_XL50"};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_interaction"};
author[] = {"voiper"};
authorUrl = "https://github.com/voiperr/";
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
#include "CfgSounds.hpp"

Binary file not shown.

View File

@ -0,0 +1,79 @@
ambient[]={1,1,1,1};
diffuse[]={1,1,1,1};
forcedDiffuse[]={0,0,0,0};
emmisive[]={0,0,0,1};
specular[]={0.6,0.6,0.6,1}; //amount of glossiness - the higher the number, the higher the glossiness
specularPower=700; //area of glossiness - the higher the number, the smaller the area
PixelShaderID="Super";
VertexShaderID="Super";
class Stage1 {
texture="z\ace\addons\flashlights\data\KSF_1_nohq.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage2 {
texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,dt)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage3 {
texture="#(argb,8,8,3)color(0,0,0,0,mc)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage4 {
texture="#(argb,8,8,3)color(1,1,1,1,as)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,1};
};
};
class Stage5 {
texture="z\ace\addons\flashlights\data\KSF_1_smdi.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage6 {
texture="#(ai,64,64,1)fresnel(4.7,1.2)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};
class Stage7 {
texture="a3\data_f\env_land_ca.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,79 @@
ambient[]={1,1,1,1};
diffuse[]={1,1,1,1};
forcedDiffuse[]={0,0,0,0};
emmisive[]={0,0,0,1};
specular[]={0.6,0.6,0.6,1}; //amount of glossiness - the higher the number, the higher the glossiness
specularPower=700; //area of glossiness - the higher the number, the smaller the area
PixelShaderID="Super";
VertexShaderID="Super";
class Stage1 {
texture="z\ace\addons\flashlights\data\MX_991_nohq.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage2 {
texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,dt)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage3 {
texture="#(argb,8,8,3)color(0,0,0,0,mc)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage4 {
texture="#(argb,8,8,3)color(1,1,1,1,as)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,1};
};
};
class Stage5 {
texture="#(rgb,1,1,1)color(0.2,0.2,1,1)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage6 {
texture="#(ai,64,64,1)fresnel(4.7,1.2)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};
class Stage7 {
texture="a3\data_f\env_land_ca.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,79 @@
ambient[]={1,1,1,1};
diffuse[]={1,1,1,1};
forcedDiffuse[]={0,0,0,0};
emmisive[]={0,0,0,1};
specular[]={0.6,0.6,0.6,1}; //amount of glossiness - the higher the number, the higher the glossiness
specularPower=700; //area of glossiness - the higher the number, the smaller the area
PixelShaderID="Super";
VertexShaderID="Super";
class Stage1 {
texture="z\ace\addons\flashlights\data\Maglite_nohq.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage2 {
texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,dt)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage3 {
texture="#(argb,8,8,3)color(0,0,0,0,mc)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage4 {
texture="#(argb,8,8,3)color(1,1,1,1,as)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,1};
};
};
class Stage5 {
texture="z\ace\addons\flashlights\data\Maglite_smdi.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage6 {
texture="#(ai,64,64,1)fresnel(4.7,1.2)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};
class Stage7 {
texture="a3\data_f\env_land_ca.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,12 @@
#define COMPONENT flashlights
#include "\z\ace\addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_FLASHLIGHTS
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_FLASHLIGHTS
#define DEBUG_SETTINGS DEBUG_SETTINGS_FLASHLIGHTS
#endif
#include "\z\ace\addons\main\script_macros.hpp"

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="Flashlights">
<Key ID="STR_ACE_Flashlights_MX991_DisplayName">
<English>Fulton MX-991</English>
<Polish>Fulton MX-991</Polish>
</Key>
<Key ID="STR_ACE_Flashlights_MX991_Description">
<English>Flashlight with red filter. For use on map.</English>
<Polish>Latarka z czerwonym filtrem. Używana do podświetlania mapy.</Polish>
</Key>
<Key ID="STR_ACE_Flashlights_XL50_DisplayName">
<English>Maglite XL50</English>
<Polish>Maglite XL50</Polish>
</Key>
<Key ID="STR_ACE_Flashlights_XL50_Description">
<English>White mini flashlight. For use on map.</English>
<Polish>Mini latarka. Światło białe. Używana do podświetlania mapy.</Polish>
</Key>
<Key ID="STR_ACE_Flashlights_KSF1_DisplayName">
<English>KSF-1</English>
<Polish>KSF-1</Polish>
</Key>
<Key ID="STR_ACE_Flashlights_KSF1_Description">
<English>Flashlight with red filter. For use on map.</English>
<Polish>Latarka z czerwonym filtrem. Używana do podświetlania mapy.</Polish>
</Key>
</Package>
</Project>

View File

@ -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
View 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 = 0.5;
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 = 1;
lightColor[] = {1,0,0,1};
};
class ACE_FlashlightProxy_Green: ACE_FlashlightProxy_White {
intensity = 1;
lightColor[] = {0,1,0,1};
};
class ACE_FlashlightProxy_Blue: ACE_FlashlightProxy_White {
intensity = 1.5;
lightColor[] = {0.25,0.25,1,1};
};
class ACE_FlashlightProxy_Yellow: ACE_FlashlightProxy_White {
intensity = 1;
lightColor[] = {1,1,0.5,1};
};
};

7
addons/map/CfgSounds.hpp Normal file
View 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[] = {};
};
};

View File

@ -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);
@ -45,7 +67,7 @@ class CfgVehicles {
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 +93,4 @@ class CfgVehicles {
description = CSTRING(BFT_Module_Description);
};
};
};
};

View File

@ -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,59 @@ 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(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);

View File

@ -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;

View File

@ -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;

View File

@ -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));

View 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

View File

@ -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]

View File

@ -0,0 +1,35 @@
/*
* 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");
if !(_colour in ["white", "red", "green", "blue", "yellow"]) then {_colour = "white"};
_class = format["ACE_FlashlightProxy_%1", _colour];
_light = _class createVehicle [0,0,0];
_light attachTo [ACE_player, [0,0.5,-0.1], "head"];
} else {
_light = objNull;
};
GVAR(glow) = _light;

View 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

View File

@ -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);

View File

@ -0,0 +1,89 @@
/*
* Author: voiper
* Draw nearby lighting and sexy flashlight beams 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;
_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
_fillTex = "#(rgb,8,8,3)color(0,0,0,1)";
//colour/alpha
_lightLevel params ["_r", "_g", "_b", "_a"];
_colourAlpha = (_r + _g + _b) min _a;
_shadeAlpha = _a;
_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");
if !(_colour in ["white", "red", "green", "blue", "yellow"]) then {_colour = "white"};
_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
};

View 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";

View File

@ -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;
};
};
};

View File

@ -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>
@ -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>
@ -141,5 +142,29 @@
<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>

View File

@ -633,4 +633,12 @@ class CfgVehicles {
class Weapon_MMG_02_sand_F: Weapon_Base_F {
displayName = CSTRING(MMG_02_sand);
};*/
//attachments
class Item_Base_F;
class Item_acc_flashlight: Item_Base_F {
displayName="UTG Defender 126";
};
};

View File

@ -568,4 +568,12 @@ class CfgWeapons {
displayName = "L21A1 RARDEN";
};
};
//attachments
class Itemcore;
class acc_flashlight: ItemCore {
displayName = "UTG Defender 126";
};
};